?? RIGHT := 110 ??
?? NEWTITLE := 'MODULE nfm$preprocess_uri' ??
MODULE nfm$preprocess_uri;

{ PURPOSE:
{   Translate a file containing NOS/VE batch format effectors into a
{   transparent file in the URI Access Data Format printable on a URI printer.
{
{ DESIGN:
{   Examine each format effector and generate the corresponding ASCII paper
{   instruction commands.  Put the rest of the text on the line into the
{   output file.  URI Access Data Format commands are added for end-of-line
{   and end-of-file markers.
{
{ NOTES:
{   The input file read by this program must be in coded format.  It must not
{   be called if the input file is transparent.  The main filter should be
{   modified such that this requirement is followed.
{

?? NEWTITLE := 'Global Declarations Referenced by This Module.', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc cle$ecc_parsing
*copyc cle$incompatible_params_given
?? POP ??
*copyc amp$get_file_attributes
*copyc amp$get_next
*copyc amp$get_partial
*copyc amp$put_next
*copyc clp$evaluate_parameters
*copyc fsp$close_file
*copyc fsp$open_file
*copyc jmp$close_output_file
*copyc jmp$open_output_file
*copyc osp$append_status_parameter
*copyc osp$set_status_abnormal
?? OLDTITLE ??
?? NEWTITLE := 'PROCEDURE nfp$preprocess_uri', EJECT ??

  PROCEDURE [XDCL] nfp$preprocess_uri
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{    PROCEDURE  preprocess_uri, preu (
{      input, i: record
{          system_file_name: name 19..19
{          password: string 1..31
{          file: file = $optional
{        recend = $required
{      output, o: file = $required
{      file_print_density, fpd: key
{           six, eight
{        keyend = six
{      device_print_density, dpd: key
{           six_any, six_only, eight_any, eight_only
{        keyend = six_any
{      page_length, pl: integer 1..4398046511103 = $required
{      page_width, pw: integer 10..255 = $required
{      status)

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 13] of clt$pdt_parameter_name,
      parameters: array [1 .. 7] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
        qualifier: clt$record_type_qualifier,
        field_spec_1: clt$field_specification,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$name_type_qualifier,
        recend,
        field_spec_2: clt$field_specification,
        element_type_spec_2: record
          header: clt$type_specification_header,
          qualifier: clt$string_type_qualifier,
        recend,
        field_spec_3: clt$field_specification,
        element_type_spec_3: record
          header: clt$type_specification_header,
        recend,
      recend,
      type2: record
        header: clt$type_specification_header,
      recend,
      type3: record
        header: clt$type_specification_header,
        qualifier: clt$keyword_type_qualifier,
        keyword_specs: array [1 .. 2] of clt$keyword_specification,
        default_value: string (3),
      recend,
      type4: record
        header: clt$type_specification_header,
        qualifier: clt$keyword_type_qualifier,
        keyword_specs: array [1 .. 4] of clt$keyword_specification,
        default_value: string (7),
      recend,
      type5: record
        header: clt$type_specification_header,
        qualifier: clt$integer_type_qualifier,
      recend,
      type6: record
        header: clt$type_specification_header,
        qualifier: clt$integer_type_qualifier,
      recend,
      type7: record
        header: clt$type_specification_header,
      recend,
    recend := [
    [1,
    [90, 10, 15, 14, 43, 30, 358],
    clc$command, 13, 7, 4, 0, 0, 0, 7, ''], [
    ['DEVICE_PRINT_DENSITY           ',clc$nominal_entry, 4],
    ['DPD                            ',clc$abbreviation_entry, 4],
    ['FILE_PRINT_DENSITY             ',clc$nominal_entry, 3],
    ['FPD                            ',clc$abbreviation_entry, 3],
    ['I                              ',clc$abbreviation_entry, 1],
    ['INPUT                          ',clc$nominal_entry, 1],
    ['O                              ',clc$abbreviation_entry, 2],
    ['OUTPUT                         ',clc$nominal_entry, 2],
    ['PAGE_LENGTH                    ',clc$nominal_entry, 5],
    ['PAGE_WIDTH                     ',clc$nominal_entry, 6],
    ['PL                             ',clc$abbreviation_entry, 5],
    ['PW                             ',clc$abbreviation_entry, 6],
    ['STATUS                         ',clc$nominal_entry, 7]],
    [
{ PARAMETER 1
    [6, 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, 131, clc$required_parameter, 0, 0],
{ PARAMETER 2
    [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, 3, clc$required_parameter, 0, 0],
{ PARAMETER 3
    [3, 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, 81, clc$optional_default_parameter, 0, 3],
{ PARAMETER 4
    [1, 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_default_parameter, 0, 7],
{ PARAMETER 5
    [9, 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, 20, clc$required_parameter, 0, 0],
{ PARAMETER 6
    [10, 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, 20, clc$required_parameter, 0, 0],
{ PARAMETER 7
    [13, 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$record_type], [3],
    ['SYSTEM_FILE_NAME               ', clc$required_field, 5], [[1, 0,
  clc$name_type], [19, 19]],
    ['PASSWORD                       ', clc$required_field, 8], [[1, 0,
  clc$string_type], [1, 31, FALSE]],
    ['FILE                           ', clc$optional_field, 3], [[1, 0,
  clc$file_type]]
    ],
{ PARAMETER 2
    [[1, 0, clc$file_type]],
{ PARAMETER 3
    [[1, 0, clc$keyword_type], [2], [
    ['EIGHT                          ', clc$nominal_entry,
  clc$normal_usage_entry, 2],
    ['SIX                            ', clc$nominal_entry,
  clc$normal_usage_entry, 1]]
    ,
    'six'],
{ PARAMETER 4
    [[1, 0, clc$keyword_type], [4], [
    ['EIGHT_ANY                      ', clc$nominal_entry,
  clc$normal_usage_entry, 3],
    ['EIGHT_ONLY                     ', clc$nominal_entry,
  clc$normal_usage_entry, 4],
    ['SIX_ANY                        ', clc$nominal_entry,
  clc$normal_usage_entry, 1],
    ['SIX_ONLY                       ', clc$nominal_entry,
  clc$normal_usage_entry, 2]]
    ,
    'six_any'],
{ PARAMETER 5
    [[1, 0, clc$integer_type], [1, 4398046511103, 10]],
{ PARAMETER 6
    [[1, 0, clc$integer_type], [10, 255, 10]],
{ PARAMETER 7
    [[1, 0, clc$status_type]]];

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

    CONST
      p$input = 1,
      p$output = 2,
      p$file_print_density = 3,
      p$device_print_density = 4,
      p$page_length = 5,
      p$page_width = 6,
      p$status = 7;

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

  CONST
    file_field = 3,
    password_field = 2,
    sfn_field = 1;


  CONST
    fe_sequence_length_max = 8, {Maximum length of format effector sequence
    maximum_input_bytes = 2048,
    maximum_output_bytes = 256 + fe_sequence_length_max + postprint_buffer_flusher_length,
    postprint_buffer_flusher_length = 5; {Length of sequence used to flush the
                                         {buffer for a postprint format effector

  TYPE
    character_range = 0 .. 127;


{ Variables used for reading & writing data.

  VAR
    input_file_byte_address: amt$file_byte_address, {keeps track of input file position
    input_file_byte_count: amt$transfer_count, {number of characters read
    input_file_id: amt$file_identifier,
    input_file_position: amt$file_position,
    input_line: string (maximum_input_bytes),
    output_file_byte_address: amt$file_byte_address, { keeps track of output file position
    output_file_id: amt$file_identifier,
    output_line: string (maximum_output_bytes);


{
{ The following type, format_effector_action, declares the different types of
{ actions to be taken for the various format effectors.
{   Preprint - the action should be done before the printing.
{   Postprint - the action should be done after the printing.
{   VFU_load_dape - for format effector Q, deselect_auto_page_eject.  A VFU
{                   must be created and written to the output file.
{   VFU_load_sape - for format effector R, select_auto_page_eject.  A VFU
{                   must be created and written to the output file.
{   VFU_load_6lpi - for format effector S, six lines per inch.  A VFU
{                   must be created and written to the output file.
{   VFU_load_8lpi - for format effector T, eight lines per inch.  A VFU
{                   must be created and written to the output file.
{   Undefined - the format effector is not defined for the URI printer.
{

  TYPE
    format_effector_action = (preprint, postprint, vfu_load_dape, vfu_load_sape, vfu_load_6lpi,
          vfu_load_8lpi, undefined);

  TYPE
    format_effector_action_rec = record
      print_action: format_effector_action,
      paper_instruction: char,
    recend;

{ The variable fe_command_sequences, defines the print action to be done
{ for each ASCII character when it is used as a format effector.

  VAR
    fe_command_sequences: [READ] array [character_range] of format_effector_action_rec :=

    {NUL} [[undefined, $CHAR (0ff(16))],
          {SOH} [undefined, $CHAR (0ff(16))],
          {STX} [undefined, $CHAR (0ff(16))],
          {ETX} [undefined, $CHAR (0ff(16))],
          {EOT} [undefined, $CHAR (0ff(16))],
          {ENQ} [undefined, $CHAR (0ff(16))],
          {ACK} [undefined, $CHAR (0ff(16))],
          {BEL} [undefined, $CHAR (0ff(16))],
          {BS } [undefined, $CHAR (0ff(16))],
          {HT } [undefined, $CHAR (0ff(16))],
          {LF } [undefined, $CHAR (0ff(16))],
          {VT } [undefined, $CHAR (0ff(16))],
          {FF } [undefined, $CHAR (0ff(16))],
          {CR } [undefined, $CHAR (0ff(16))],
          {SO } [undefined, $CHAR (0ff(16))],
          {SI } [undefined, $CHAR (0ff(16))],
          {DLE} [undefined, $CHAR (0ff(16))],
          {DC1} [undefined, $CHAR (0ff(16))],
          {DC2} [undefined, $CHAR (0ff(16))],
          {DC3} [undefined, $CHAR (0ff(16))],
          {DC4} [undefined, $CHAR (0ff(16))],
          {NAK} [undefined, $CHAR (0ff(16))],
          {SYN} [undefined, $CHAR (0ff(16))],
          {ETB} [undefined, $CHAR (0ff(16))],
          {CAN} [undefined, $CHAR (0ff(16))],
          {EM } [undefined, $CHAR (0ff(16))],
          {SUB} [undefined, $CHAR (0ff(16))],
          {ESC} [undefined, $CHAR (0ff(16))],
          {FS } [undefined, $CHAR (0ff(16))],
          {GS } [undefined, $CHAR (0ff(16))],
          {RS } [undefined, $CHAR (0ff(16))],
          {US } [preprint, $CHAR (11(16))], { advance 1 line
          {SP } [preprint, $CHAR (11(16))], { advance 1 line
          { ! } [undefined, $CHAR (0ff(16))],
          { " } [undefined, $CHAR (0ff(16))],
          { # } [undefined, $CHAR (0ff(16))],
          { $ } [undefined, $CHAR (0ff(16))],
          { % } [undefined, $CHAR (0ff(16))],
          { & } [undefined, $CHAR (0ff(16))],
          { ' } [undefined, $CHAR (0ff(16))],
          { ( } [undefined, $CHAR (0ff(16))],
          { ) } [undefined, $CHAR (0ff(16))],
          { * } [undefined, $CHAR (0ff(16))],
          { + } [preprint, $CHAR (10(16))], { advance 0 lines
          { , } [undefined, $CHAR (0ff(16))],
          { - } [preprint, $CHAR (13(16))], { advance 3 lines
          { . } [undefined, $CHAR (0ff(16))],
          { / } [postprint, $CHAR (10(16))], { advance 0 lines
          { 0 } [preprint, $CHAR (12(16))], { advance 2 lines
          { 1 } [preprint, $CHAR (00(16))], { advance TOF
          { 2 } [preprint, $CHAR (0B(16))], { advance BOF
          { 3 } [preprint, $CHAR (05(16))], { advance channel 6
          { 4 } [preprint, $CHAR (04(16))], { advance channel 5
          { 5 } [preprint, $CHAR (03(16))], { advance channel 4
          { 6 } [preprint, $CHAR (02(16))], { advance channel 3
          { 7 } [preprint, $CHAR (01(16))], { advance channel 2
          { 8 } [preprint, $CHAR (00(16))], { advance channel 1
          { 9 } [preprint, $CHAR (06(16))], { advance channel 7
          { : } [undefined, $CHAR (0ff(16))],
          { ; } [undefined, $CHAR (0ff(16))],
          { < } [undefined, $CHAR (0ff(16))],
          { = } [undefined, $CHAR (0ff(16))],
          { > } [undefined, $CHAR (0ff(16))],
          { ? } [undefined, $CHAR (0ff(16))],
          { @ } [undefined, $CHAR (0ff(16))],
          { A } [postprint, $CHAR (00(16))], { advance TOF
          { B } [postprint, $CHAR (0B(16))], { advance BOF
          { C } [postprint, $CHAR (05(16))], { advance channel 6
          { D } [postprint, $CHAR (04(16))], { advance channel 5
          { E } [postprint, $CHAR (03(16))], { advance channel 4
          { F } [postprint, $CHAR (02(16))], { advance channel 3
          { G } [postprint, $CHAR (01(16))], { advance channel 2
          { H } [postprint, $CHAR (00(16))], { advance channel 1
          { I } [postprint, $CHAR (06(16))], { advance channel 7
          { J } [postprint, $CHAR (07(16))], { advance channel 8
          { K } [postprint, $CHAR (08(16))], { advance channel 9
          { L } [postprint, $CHAR (09(16))], { advance channel 10
          { M } [postprint, $CHAR (0A(16))], { advance channel 11
          { N } [postprint, $CHAR (0B(16))], { advance channel 12
          { O } [undefined, $CHAR (0ff(16))],
          { P } [undefined, $CHAR (0ff(16))],
          { Q } [vfu_load_dape, $CHAR (0ff(16))], { select auto eject off
          { R } [vfu_load_sape, $CHAR (0ff(16))], { select auto eject on
          { S } [vfu_load_6lpi, $CHAR (0ff(16))], { select 6 lines/inch
          { T } [vfu_load_8lpi, $CHAR (0ff(16))], { select 8 lines/inch
          { U } [preprint, $CHAR (0B(16))], { advance channel 12
          { V } [undefined, $CHAR (0ff(16))], { load VFU
          { W } [preprint, $CHAR (0A(16))], { advance channel 11
          { X } [preprint, $CHAR (07(16))], { advance channel 8
          { Y } [preprint, $CHAR (08(16))], { advance channel 9
          { Z } [preprint, $CHAR (09(16))], { advance channel 10
          { [ } [undefined, $CHAR (0ff(16))],
          { \ } [undefined, $CHAR (0ff(16))],
          { ] } [undefined, $CHAR (0ff(16))],
          { ^ } [undefined, $CHAR (0ff(16))],
          { _ } [undefined, $CHAR (0ff(16))],
          { ` } [undefined, $CHAR (0ff(16))],
          { a } [undefined, $CHAR (0ff(16))],
          { b } [undefined, $CHAR (0ff(16))],
          { c } [undefined, $CHAR (0ff(16))],
          { d } [undefined, $CHAR (0ff(16))],
          { e } [undefined, $CHAR (0ff(16))],
          { f } [undefined, $CHAR (0ff(16))],
          { g } [undefined, $CHAR (0ff(16))],
          { h } [undefined, $CHAR (0ff(16))],
          { i } [undefined, $CHAR (0ff(16))],
          { j } [undefined, $CHAR (0ff(16))],
          { k } [undefined, $CHAR (0ff(16))],
          { l } [undefined, $CHAR (0ff(16))],
          { m } [undefined, $CHAR (0ff(16))],
          { n } [undefined, $CHAR (0ff(16))],
          { o } [undefined, $CHAR (0ff(16))],
          { p } [undefined, $CHAR (0ff(16))],
          { q } [undefined, $CHAR (0ff(16))],
          { r } [undefined, $CHAR (0ff(16))],
          { s } [undefined, $CHAR (0ff(16))],
          { t } [undefined, $CHAR (0ff(16))],
          { u } [undefined, $CHAR (0ff(16))],
          { v } [undefined, $CHAR (0ff(16))],
          { w } [undefined, $CHAR (0ff(16))],
          { x } [undefined, $CHAR (0ff(16))],
          { y } [undefined, $CHAR (0ff(16))],
          { z } [undefined, $CHAR (0ff(16))],
          {   } [undefined, $CHAR (0ff(16))],
          { | } [undefined, $CHAR (0ff(16))],
          {   } [undefined, $CHAR (0ff(16))],
          { ~ } [undefined, $CHAR (0ff(16))],
          {DLE} [undefined, $CHAR (0ff(16))]];

{ URI Access Control command constant and variable strings.  These values are
{ used throughout the output file that is created, ie. in the VFU, the format
{ effector sequence, etc.

  CONST
    activate_control_after_ackin = $CHAR (00(16)) CAT $CHAR (09(16)),
    advance_0_lines = $CHAR (10(16)),
    chars_in_common_63_lines = 126,
    chars_in_common_8lpi = 46,
    chars_lines_64_to_66 = 6,
    chars_lines_87_88 = 4,
    chars_vfu_header = 12,
    chars_vfu_trailer = 8,
    deactivate_control = $CHAR (00(16)) CAT $CHAR (02(16)),
    deactivate_control_after_ackin = $CHAR (00(16)) CAT $CHAR (0A(16)),
    define_device_down = $CHAR (00(16)) CAT $CHAR (10(16)) CAT $CHAR (40(16)),
    define_not_ready = $CHAR (00(16)) CAT $CHAR (11(16)) CAT $CHAR (43(16)),
    define_recoverable_error = $CHAR (00(16)) CAT $CHAR (12(16)) CAT $CHAR (2A(16)),
    end_of_file = $CHAR (00(16)) CAT $CHAR (03(16)),
    fill_in_char = 'x',
    line_feed = $CHAR (11(16)),
    nul = $CHAR (00(16)),
    skip_to_top_of_form = $CHAR (00(16)) CAT $CHAR (00(16)),
    start_vfu_load_6lpi = $CHAR (6c(16)),
    start_vfu_load_8lpi = $CHAR (6d(16)),
    stop_vfu_load = $CHAR (6f(16)),
    vfu_load_type_position = 12, {Position in VFU header where load cmd goes.
    vfu_max_len_in_characters = 196, {Without NULs doubled, includes VFU header and trailer.
    wait_for_paper_mvmt_cio1_porta = $CHAR (00(16)) CAT $CHAR (2C(16));

  TYPE
    vfu_range = vfu_load_dape .. vfu_load_8lpi;

  VAR
    act_ctrl_after_ackin_str: [READ] string (2) := $CHAR (00(16)) CAT $CHAR (09(16)),
    currently_6lpi: boolean,
    currently_sape: [STATIC] boolean := TRUE,
    deact_ctrl_after_ackin_str: [READ] string (2) := $CHAR (00(16)) CAT $CHAR (0A(16)),
    device_print_density: clt$keyword,
    initial_vfu_loaded: boolean,
    vfu_id: vfu_range;


  VAR

{ The first 63 lines of a VFU are the same whether the VFU is defined as
{ 6 lines per inch or 8 lines per inch.

    common_63_lines_in_6lpi_8lpi: [READ] string (chars_in_common_63_lines) := {
          {line 01} $CHAR (3F(16)) CAT $CHAR (1D(16)) CAT {
          {line 02} $CHAR (00(16)) CAT $CHAR (00(16)) CAT {
          {line 03} $CHAR (02(16)) CAT $CHAR (00(16)) CAT {
          {line 04} $CHAR (04(16)) CAT $CHAR (00(16)) CAT {
          {line 05} $CHAR (0A(16)) CAT $CHAR (00(16)) CAT {
          {line 06} $CHAR (10(16)) CAT $CHAR (00(16)) CAT {
          {line 07} $CHAR (26(16)) CAT $CHAR (00(16)) CAT {
          {line 08} $CHAR (00(16)) CAT $CHAR (01(16)) CAT {
          {line 09} $CHAR (0A(16)) CAT $CHAR (00(16)) CAT {
          {line 10} $CHAR (04(16)) CAT $CHAR (04(16)) CAT {
          {line 11} $CHAR (12(16)) CAT $CHAR (08(16)) CAT {
          {line 12} $CHAR (00(16)) CAT $CHAR (00(16)) CAT {
          {line 13} $CHAR (2E(16)) CAT $CHAR (00(16)) CAT {
          {line 14} $CHAR (00(16)) CAT $CHAR (00(16)) CAT {
          {line 15} $CHAR (02(16)) CAT $CHAR (01(16)) CAT {
          {line 16} $CHAR (14(16)) CAT $CHAR (00(16)) CAT {
          {line 17} $CHAR (0A(16)) CAT $CHAR (00(16)) CAT {
          {line 18} $CHAR (00(16)) CAT $CHAR (00(16)) CAT {
          {line 19} $CHAR (26(16)) CAT $CHAR (04(16)) CAT {
          {line 20} $CHAR (00(16)) CAT $CHAR (00(16)) CAT {
          {line 21} $CHAR (1A(16)) CAT $CHAR (08(16)) CAT {
          {line 22} $CHAR (04(16)) CAT $CHAR (01(16)) CAT {
          {line 23} $CHAR (02(16)) CAT $CHAR (00(16)) CAT {
          {line 24} $CHAR (00(16)) CAT $CHAR (00(16)) CAT {
          {line 25} $CHAR (2E(16)) CAT $CHAR (00(16)) CAT {
          {line 26} $CHAR (10(16)) CAT $CHAR (00(16)) CAT {
          {line 27} $CHAR (02(16)) CAT $CHAR (00(16)) CAT {
          {line 28} $CHAR (04(16)) CAT $CHAR (04(16)) CAT {
          {line 29} $CHAR (0A(16)) CAT $CHAR (01(16)) CAT {
          {line 30} $CHAR (00(16)) CAT $CHAR (00(16)) CAT {
          {line 31} $CHAR (36(16)) CAT $CHAR (08(16)) CAT {
          {line 32} $CHAR (00(16)) CAT $CHAR (00(16)) CAT {
          {line 33} $CHAR (0A(16)) CAT $CHAR (00(16)) CAT {
          {line 34} $CHAR (04(16)) CAT $CHAR (00(16)) CAT {
          {line 35} $CHAR (02(16)) CAT $CHAR (00(16)) CAT {
          {line 36} $CHAR (10(16)) CAT $CHAR (01(16)) CAT {
          {line 37} $CHAR (2E(16)) CAT $CHAR (04(16)) CAT {
          {line 38} $CHAR (00(16)) CAT $CHAR (00(16)) CAT {
          {line 39} $CHAR (02(16)) CAT $CHAR (00(16)) CAT {
          {line 40} $CHAR (04(16)) CAT $CHAR (00(16)) CAT {
          {line 41} $CHAR (1A(16)) CAT $CHAR (08(16)) CAT {
          {line 42} $CHAR (00(16)) CAT $CHAR (00(16)) CAT {
          {line 43} $CHAR (26(16)) CAT $CHAR (01(16)) CAT {
          {line 44} $CHAR (00(16)) CAT $CHAR (00(16)) CAT {
          {line 45} $CHAR (0A(16)) CAT $CHAR (00(16)) CAT {
          {line 46} $CHAR (14(16)) CAT $CHAR (04(16)) CAT {
          {line 47} $CHAR (02(16)) CAT $CHAR (00(16)) CAT {
          {line 48} $CHAR (00(16)) CAT $CHAR (00(16)) CAT {
          {line 49} $CHAR (2E(16)) CAT $CHAR (00(16)) CAT {
          {line 50} $CHAR (00(16)) CAT $CHAR (01(16)) CAT {
          {line 51} $CHAR (12(16)) CAT $CHAR (08(16)) CAT {
          {line 52} $CHAR (04(16)) CAT $CHAR (00(16)) CAT {
          {line 53} $CHAR (0A(16)) CAT $CHAR (00(16)) CAT {
          {line 54} $CHAR (00(16)) CAT $CHAR (00(16)) CAT {
          {line 55} $CHAR (26(16)) CAT $CHAR (04(16)) CAT {
          {line 56} $CHAR (10(16)) CAT $CHAR (00(16)) CAT {
          {line 57} $CHAR (0A(16)) CAT $CHAR (01(16)) CAT {
          {line 58} $CHAR (04(16)) CAT $CHAR (00(16)) CAT {
          {line 59} $CHAR (02(16)) CAT $CHAR (00(16)) CAT {
          {line 60} $CHAR (00(16)) CAT $CHAR (00(16)) CAT {
          {line 61} $CHAR (3E(16)) CAT $CHAR (08(16)) CAT {
          {line 62} $CHAR (00(16)) CAT $CHAR (00(16)) CAT {
          {line 63} $CHAR (02(16)) CAT $CHAR (00(16)),

{ Lines 64 - 86 are common in an 8 lines per inch VFU.

    common_lines_in_8lpi: [READ] string (chars_in_common_8lpi) := {
          {line 64} $CHAR (04(16)) CAT $CHAR (05(16)) CAT {
          {line 65} $CHAR (0A(16)) CAT $CHAR (00(16)) CAT {
          {line 66} $CHAR (10(16)) CAT $CHAR (00(16)) CAT {
          {line 67} $CHAR (26(16)) CAT $CHAR (00(16)) CAT {
          {line 68} $CHAR (00(16)) CAT $CHAR (00(16)) CAT {
          {line 69} $CHAR (0A(16)) CAT $CHAR (00(16)) CAT {
          {line 70} $CHAR (04(16)) CAT $CHAR (00(16)) CAT {
          {line 71} $CHAR (12(16)) CAT $CHAR (09(16)) CAT {
          {line 72} $CHAR (00(16)) CAT $CHAR (00(16)) CAT {
          {line 73} $CHAR (2E(16)) CAT $CHAR (04(16)) CAT {
          {line 74} $CHAR (00(16)) CAT $CHAR (00(16)) CAT {
          {line 75} $CHAR (02(16)) CAT $CHAR (00(16)) CAT {
          {line 76} $CHAR (14(16)) CAT $CHAR (00(16)) CAT {
          {line 77} $CHAR (0A(16)) CAT $CHAR (00(16)) CAT {
          {line 78} $CHAR (00(16)) CAT $CHAR (01(16)) CAT {
          {line 79} $CHAR (26(16)) CAT $CHAR (00(16)) CAT {
          {line 80} $CHAR (00(16)) CAT $CHAR (00(16)) CAT {
          {line 81} $CHAR (1A(16)) CAT $CHAR (08(16)) CAT {
          {line 82} $CHAR (04(16)) CAT $CHAR (04(16)) CAT {
          {line 83} $CHAR (02(16)) CAT $CHAR (00(16)) CAT {
          {line 84} $CHAR (00(16)) CAT $CHAR (00(16)) CAT {
          {line 85} $CHAR (2E(16)) CAT $CHAR (01(16)) CAT {
          {line 86} $CHAR (10(16)) CAT $CHAR (20(16)),

{ This is the definition of lines 64 - 66 for a 6 line per inch VFU in
{ which deselect_auto_page_eject is also defined.

    lines_64_65_66_in_6lpi_dape: [READ] string (chars_lines_64_to_66) := {
          {line 64} $CHAR (04(16)) CAT $CHAR (25(16)) CAT {
          {line 65} $CHAR (0A(16)) CAT $CHAR (00(16)) CAT {
          {line 66} $CHAR (10(16)) CAT $CHAR (00(16)),

{ This is the definition of lines 64 - 66 for an 6 line per inch VFU in
{ which select_auto_page_eject is also defined.

    lines_64_65_66_in_6lpi_sape: [READ] string (chars_lines_64_to_66) := {
          {line 64} $CHAR (04(16)) CAT $CHAR (25(16)) CAT {
          {line 65} $CHAR (0A(16)) CAT $CHAR (02(16)) CAT {
          {line 66} $CHAR (10(16)) CAT $CHAR (00(16)),

{ This is the definition of lines 87 and 88 for an 8 line per inch VFU in
{ which deselect_auto_page_eject is also defined.

    lines_87_88_in_8lpi_dape: [READ] string (chars_lines_87_88) := {
          {line 87} $CHAR (02(16)) CAT $CHAR (00(16)) CAT {
          {line 88} $CHAR (04(16)) CAT $CHAR (00(16)),

{ This is the definition of lines 87 and 88 for an 8 line per inch VFU in
{ which select_auto_page_eject is also defined.

    lines_87_88_in_8lpi_sape: [READ] string (chars_lines_87_88) := {
          {line 87} $CHAR (02(16)) CAT $CHAR (02(16)) CAT {
          {line 88} $CHAR (04(16)) CAT $CHAR (00(16)),


{ This is the string that preceeds the VFU.  It contains the paper instruction
{ to go to the top of form.  The 'xx' needs to be replaced by $CHAR(6c(16))
{ or $CHAR(6d(16)) for a 6 line per inch or 8 line per inch VFU respectively.

    vfu_header: [STATIC] string (chars_vfu_header) := {
          activate_control_after_ackin CAT {
          skip_to_top_of_form CAT {
          deactivate_control_after_ackin CAT {
          define_recoverable_error CAT {
          activate_control_after_ackin CAT {
          fill_in_char, {fill_in_char is the vfu load command to be filled in

    vfu_trailer: [READ] string (chars_vfu_trailer) := {
          stop_vfu_load CAT {
          deactivate_control_after_ackin CAT {
          wait_for_paper_mvmt_cio1_porta CAT {
          define_recoverable_error;

?? OLDTITLE ??
?? NEWTITLE := 'PROCEDURE double_up_nuls', EJECT ??

{****************************************************************************}
{
{ PROCEDURE NAME: double_up_nuls
{
{ PURPOSE: This procedure looks at each character in the input_string and
{   puts it in the output string.  However, if the character is a NUL, then
{   it puts another NUL in the output string.  Strings passed to this
{   procedure contain NULs that are data.  They are doubled up so that they
{   are not interpreted as command escape characters by the URI TIP.
{
{*****************************************************************************

  PROCEDURE double_up_nuls
    (    input_string: string ( * );
     VAR double_nul_length: integer;
     VAR output_string: string ( * ));

    CONST
      characters_per_line = 2,
      lines_in_6lpi_vfu = 66,
      lines_in_8lpi_vfu = 88;

    VAR
      i: integer,
      j: integer,
      vfu_length: integer;

    IF currently_6lpi THEN
      vfu_length := lines_in_6lpi_vfu * characters_per_line;
    ELSE
      vfu_length := lines_in_8lpi_vfu * characters_per_line;
    IFEND;

    i := 1;
    j := 1;
    WHILE i <= vfu_length DO

      output_string (j) := input_string (i);
      IF input_string (i) = nul THEN
        j := j + 1;
        output_string (j) := nul
      IFEND;

      j := j + 1;
      i := i + 1;
    WHILEND;
    double_nul_length := j - 1;

  PROCEND double_up_nuls;
?? OLDTITLE ??
?? NEWTITLE := 'PROCEDURE generate_file_beginning', EJECT ??

{****************************************************************************}
{
{ PROCEDURE NAME: generate_file_beginning
{
{ PURPOSE: To put the character sequence in the output file to do the
{   Define_device_down and the Define_not_ready commands.
{
{ DESCRIPTION:
{   The Define_device_down and Define_device_ready commands are put in string
{   define_attributes.  In this string there is first a command to deactivate
{   the paper instruction line, next the command to define the device down,
{   next to define not ready and next to terminate the file.
{
{*****************************************************************************

  PROCEDURE generate_file_beginning
    (    output_file_id: amt$file_identifier;
     VAR output_file_byte_address: amt$file_byte_address;
     VAR status: ost$status);

    CONST
      define_string_size = 10; { Number of characters in define commands sequence.

    VAR
      define_attributes: [STATIC] string (define_string_size) := deactivate_control CAT
            define_device_down CAT define_not_ready CAT end_of_file;

    status.normal := TRUE;
    amp$put_next (output_file_id, ^define_attributes, #SIZE (define_attributes),
          output_file_byte_address, status);

  PROCEND generate_file_beginning;
?? OLDTITLE ??
?? NEWTITLE := 'PROCEDURE format_effector_pi', EJECT ??

{****************************************************************************}
{
{ PROCEDURE NAME: generate_format_effector_pi
{
{ PURPOSE: Get the format_effector out of the input_line just read and find the
{   paper instruction that matches the format effector.  Also, return in
{   variable print_action describing whether the format_effector is preprint,
{   postprint, vfu_load_dape, vfu_load_sape, vfu_load_6lpi, vfu_load_8lpi or
{   undefined.
{
{ DESCRIPTION:
{   The table fe_command_sequences contains the paper instruction for the
{   format_effectors and whether the instruction is preprint, postprint,
{   vfu_load_dape, vfu_load_sape, vfu_load_6lpi, vfu_load_8lpi, or
{   undefined.  The table is indexed from 0 to 127 containing an entry for each
{   possible character.  If the character is undefined, the value stored is
{   0ff(16); also the print_action is undefined.  This procedure gets the format
{   effector out of input_line and by indexing into the table
{   fe_command_sequences, returns the corresponding paper instruction and
{   whether or not the paper instruction is preprint, postprint or undefined.
{
{*****************************************************************************

  PROCEDURE generate_format_effector_pi
    (    input_line: string (maximum_input_bytes);
     VAR print_action: format_effector_action;
     VAR paper_instruction: char);


    VAR
      format_effector: character_range;


    format_effector := $INTEGER (input_line (1));
    paper_instruction := fe_command_sequences [format_effector].paper_instruction;
    print_action := fe_command_sequences [format_effector].print_action;


  PROCEND generate_format_effector_pi;
?? OLDTITLE ??
?? NEWTITLE := 'PROCEDURE generate_line_in_output_file', EJECT ??

{****************************************************************************}
{
{ PROCEDURE NAME: generate_line_in_output_file
{
{ PURPOSE: This procedure takes the input_line passed in and generates the
{   matching output line with the appropriate URI Access Data Format commands
{   put into the line.  These commands are the format effector and the
{   define_recoverable error command.  When the output line is generated, it
{   is written to the output file.
{
{ DESCRIPTION:
{   This procedure calls procedures to do its functions.
{
{*****************************************************************************

  PROCEDURE generate_line_in_output_file
    (    input_line: string (maximum_input_bytes);
         input_file_byte_count: amt$transfer_count;
     VAR status: ost$status);

    VAR
      print_action: format_effector_action,
      paper_instruction: char;

    generate_format_effector_pi (input_line, print_action, paper_instruction);
    generate_rest_of_line (input_line, input_file_byte_count, print_action, paper_instruction,
          output_file_id, output_file_byte_address, status);

  PROCEND generate_line_in_output_file;
?? OLDTITLE ??
?? NEWTITLE := 'PROCEDURE generate_rest_of_line', EJECT ??

{****************************************************************************}
{
{ PROCEDURE NAME: generate_rest_of_line
{
{ PURPOSE: Given the paper instruction and print_action passed in, put the rest
{   of the characters in the input_line in the output_line, positioning the
{   paper instruction URI Access Data Format command sequence before or after
{   the characters depending on whether it is preprint or postprint.  Also,
{   if the format effector was undefined, construct the command sequence so that
{   the line gets printed after advancing one line.
{
{ DESCRIPTION:
{   If the format effector was undefined, set the paper instruction to '11' and
{   set the print_action to preprint.  If the instruction is preprint, put
{   the URI Access Data command sequence before the rest of the line.  If it is
{   postprint, put the URI Access Data command sequence after the rest of the
{   line.  Next, put the end of line sequence at the end of output_line.
{
{*****************************************************************************

  PROCEDURE generate_rest_of_line
    (    input_line: string (maximum_input_bytes);
         input_file_byte_count: amt$transfer_count;
     VAR print_action: format_effector_action;
     VAR paper_instruction: char;
     VAR output_file_id: amt$file_identifier;
     VAR output_file_byte_address: amt$file_byte_address;
     VAR status: ost$status);

    VAR
      fe_index: 0 .. 1,
      format_effector_sequence: string (6),
      i: integer,
      character_count: integer,
      sequence_length: integer,
      postprint_buffer_flusher: [STATIC] string (postprint_buffer_flusher_length) :=
            activate_control_after_ackin CAT advance_0_lines CAT
            deactivate_control_after_ackin;


    status.normal := TRUE;

{ If the format effector indicates a VFU load for a six lines per inch VFU
{ or and eight lines per inch VFU, verify that this doesn't conflict with the
{ device print density.  If the format effector does conflict with the
{ device print density, treat the format effector the same as an undefined
{ format effector.

    IF ((print_action = vfu_load_6lpi) AND (device_print_density (1,
          10) = 'EIGHT_ONLY') OR (print_action = vfu_load_8lpi) AND
          (device_print_density (1, 8) = 'SIX_ONLY')) THEN
      print_action := undefined;
    IFEND;

    CASE print_action OF

    = preprint, postprint, undefined =

{ Process the format effector.  Insert the format_effector_sequence before the
{ text or after the text depending on whether it's preprint or postprint.
{ If the print_action is undefined, advance one line before printing.

      IF print_action = undefined THEN
        paper_instruction := line_feed;
        print_action := preprint;
      IFEND;

{ Generate the format effector sequence.

      IF paper_instruction = nul THEN
        STRINGREP (format_effector_sequence, sequence_length, act_ctrl_after_ackin_str,
              $CHAR (00), $CHAR (00), deact_ctrl_after_ackin_str);

      ELSE
        STRINGREP (format_effector_sequence, sequence_length, act_ctrl_after_ackin_str,
              paper_instruction, deact_ctrl_after_ackin_str);
      IFEND;

      IF print_action = preprint THEN
        output_line (1, sequence_length) := format_effector_sequence (1, sequence_length);
        character_count := sequence_length + 1;
      ELSE
        output_line (1, postprint_buffer_flusher_length) := postprint_buffer_flusher;
        character_count := postprint_buffer_flusher_length + 1;
      IFEND;

      FOR i := 2 TO input_file_byte_count DO
        output_line (character_count) := input_line (i);
        character_count := character_count + 1;
      FOREND;

      IF print_action = postprint THEN
        output_line (character_count, sequence_length) :=
              format_effector_sequence (1, sequence_length);
        character_count := character_count + sequence_length
      IFEND;

      output_line (character_count, 3) := define_recoverable_error;

{ Adjust characters to be output depending on whether or not input_line is empty.

      IF input_file_byte_count = 0 THEN
        fe_index := 0
      ELSE
        fe_index := 1;
      IFEND;
      amp$put_next (output_file_id, ^output_line, input_file_byte_count - fe_index +
            sequence_length + 3, output_file_byte_address, status);

    = vfu_load_dape, vfu_load_sape, vfu_load_6lpi, vfu_load_8lpi =

{ Determine which VFU needs to be used and generate it in output_line.

      generate_vfu (print_action, output_file_id, output_file_byte_address, status);

    CASEND;

  PROCEND generate_rest_of_line;
?? OLDTITLE ??
?? NEWTITLE := 'PROCEDURE generate_vfu', EJECT ??

{****************************************************************************}
{
{ PROCEDURE NAME: generate_vfu
{
{ PURPOSE: To write the appropriate VFU to the output file given the vfu_id.
{
{ DESCRIPTION:
{   Given the vfu_id passed in, create the vfu defining it correctly for six
{   lines per inch, deselect auto page eject and select auto page eject.  The
{   VFU is created selecting the appropriate strings defined for a VFU.
{
{*****************************************************************************

  PROCEDURE generate_vfu
    (    vfu_id: vfu_range;
         output_file_id: amt$file_identifier;
     VAR output_file_byte_address: amt$file_byte_address;
     VAR status: ost$status);


    VAR
      temp_string: string (vfu_max_len_in_characters),
      double_nul_length: integer,
      double_nul_string: string (2 * vfu_max_len_in_characters),
      output_vfu: string ((2 * vfu_max_len_in_characters) + 20),
      vfu_length: integer;

    temp_string := ' ';
    double_nul_string := ' ';
    output_vfu := ' ';
    status.normal := TRUE;

{ Set apropriate global variable depending on the value of vfu_id.

    CASE vfu_id OF

    = vfu_load_6lpi =
      IF currently_6lpi AND initial_vfu_loaded THEN
        RETURN; { This VFU is already loaded.
      IFEND;
      currently_6lpi := TRUE;

    = vfu_load_8lpi =
      IF NOT currently_6lpi AND initial_vfu_loaded THEN
        RETURN; { This VFU is already loaded.
      IFEND;
      currently_6lpi := FALSE;

    = vfu_load_sape =
      IF currently_sape AND initial_vfu_loaded THEN
        RETURN; { This VFU is already loaded.
      IFEND;
      currently_sape := TRUE;

    = vfu_load_dape =
      IF NOT currently_sape AND initial_vfu_loaded THEN
        RETURN; { This VFU is already loaded.
      IFEND;
      currently_sape := FALSE;

    CASEND;

    temp_string (1, chars_in_common_63_lines) := common_63_lines_in_6lpi_8lpi;

    IF currently_6lpi THEN
      IF currently_sape THEN
        temp_string (chars_in_common_63_lines + 1, chars_lines_64_to_66) :=
              lines_64_65_66_in_6lpi_sape;
      ELSE
        temp_string (chars_in_common_63_lines + 1, chars_lines_64_to_66) :=
              lines_64_65_66_in_6lpi_dape;
      IFEND;
    ELSE
      temp_string (chars_in_common_63_lines + 1, chars_in_common_8lpi) := common_lines_in_8lpi;

      IF currently_sape THEN
        temp_string (chars_in_common_63_lines + chars_in_common_8lpi + 1,
              chars_lines_87_88) := lines_87_88_in_8lpi_sape
      ELSE
        temp_string (chars_in_common_63_lines + chars_in_common_8lpi + 1,
              chars_lines_87_88) := lines_87_88_in_8lpi_dape
      IFEND;
    IFEND;

{ Double all NULs in the VFU since these are data.

    double_up_nuls (temp_string, double_nul_length, double_nul_string);

{ Put on header and trailer and put in 6c or 6d and output it to a file.

    STRINGREP (output_vfu, vfu_length, vfu_header, double_nul_string (1, double_nul_length),
          vfu_trailer);
    IF currently_6lpi THEN
      output_vfu (vfu_load_type_position) := start_vfu_load_6lpi
    ELSE
      output_vfu (vfu_load_type_position) := start_vfu_load_8lpi
    IFEND;

    amp$put_next (output_file_id, ^output_vfu, vfu_length, output_file_byte_address, status);


  PROCEND generate_vfu;
?? OLDTITLE ??
?? NEWTITLE := 'PROCEDURE process_parameters_open_files', EJECT ??
{****************************************************************************}
{
{ PROCEDURE NAME: process_parameters_open_files
{
{ PURPOSE: This procedure gets and validates the parameters passed in to the
{   program NFM$PREPROCESS_URI.  These parameters are input, output, data_mode,
{   vertical_print_density, page_length, page_width and status.
{   The input and output files specified are opened.
{
{*****************************************************************************

  PROCEDURE process_parameters_open_files
    (VAR input_file_id: amt$file_identifier;
     VAR output_file_id: amt$file_identifier;
     VAR vfu_id: vfu_range;
     VAR status: ost$status);

    VAR
      cycle_attributes: ^fst$file_cycle_attributes,
      file_attachment_options: ^fst$attachment_options,
      file_attributes: array [1 .. 1] of amt$get_item,
      file_prev_opened: boolean,
      ignored_file_contains_data: boolean,
      ignored_file_exists: boolean,
      vertical_print_density_value: ^clt$data_value;


{ Validate the parameters passed to this procedure. Return to the caller on error.

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

{ Process the FILE_PRINT_DENSITY parameter.

    currently_6lpi := (pvt [p$file_print_density].value^.keyword_value (1) = 'S');

{ Process the DEVICE_PRINT_DENSITY parameter.

    device_print_density := pvt [p$device_print_density].value^.keyword_value;

{ If the file_print_density conflicts with the device_print_density, set the
{ file_print_density to match the device_print_density.

    IF currently_6lpi AND (device_print_density (1, 10) = 'EIGHT_ONLY') THEN
      currently_6lpi := FALSE
    ELSEIF NOT currently_6lpi AND (device_print_density (1, 8) = 'SIX_ONLY') THEN
      currently_6lpi := TRUE
    IFEND;

    IF currently_6lpi THEN
      vfu_id := vfu_load_6lpi
    ELSE
      vfu_id := vfu_load_8lpi
    IFEND;

{ Process the INPUT parameter. Note that memory obtained to store file attachment
{ options unconditionally because it will be used at least once when the output
{ file is opened.

    PUSH file_attachment_options: [1 .. 1];

    IF pvt [p$input].value^.field_values^ [file_field].value = NIL THEN

{ The input file is the original queue file in the output queue.


      jmp$open_output_file (pvt [p$input].value^.field_values^ [sfn_field].
            value^.name_value (1, jmc$system_supplied_name_size), amc$record, jmc$public_usage,
            pvt [p$input].value^.field_values^ [password_field].value^.string_value^,
            input_file_id, status);

    ELSE

{ The input file is the output of another filter. Ignore the original queue file.

      file_attachment_options^ [1].selector := fsc$create_file;
      file_attachment_options^ [1].create_file := FALSE;
      fsp$open_file (pvt [p$input].value^.field_values^ [file_field].value^.file_value^,
            amc$record, file_attachment_options, NIL, NIL, NIL, NIL, input_file_id, status);
    IFEND;
    IF NOT status.normal THEN
      RETURN;
    IFEND;

{ Process the OUTPUT parameter.  Return an abnormal status if the output file
{ already exists.

    file_attributes [1].key := amc$null_attribute;
    amp$get_file_attributes (pvt [p$output].value^.file_value^, file_attributes,
          ignored_file_exists, file_prev_opened, ignored_file_contains_data, status);

    IF file_prev_opened THEN
      osp$set_status_abnormal ('PF', pfe$lfn_in_use, pvt [p$output].
            value^.file_value^, status);
      osp$append_status_parameter (osc$status_parameter_delimiter,
            'pvt[p$output].value^.file_value', status);
      RETURN;
    IFEND;
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    PUSH cycle_attributes: [1 .. 5];

{ File contents, page format, page length, and page width attributes are
{ specified to provide accurate file attributes to other batch output filters
{ which may process the output of this filter, and to prevent any batch filter
{ from attempting to 'burst' the file contents.

    cycle_attributes^ [1].selector := fsc$file_contents_and_processor;
    cycle_attributes^ [1].file_contents := 'UNKNOWN';
    cycle_attributes^ [1].file_processor := osc$null_name;

    cycle_attributes^ [2].selector := fsc$page_format;
    cycle_attributes^ [2].page_format := amc$continuous_form;

    cycle_attributes^ [3].selector := fsc$page_length;
    cycle_attributes^ [3].page_length := pvt [p$page_length].value^.integer_value.value;

    cycle_attributes^ [4].selector := fsc$page_width;
    cycle_attributes^ [4].page_width := pvt [p$page_width].value^.integer_value.value;

    cycle_attributes^ [5].selector := fsc$record_type;
    cycle_attributes^ [5].record_type := amc$undefined;

    file_attachment_options^ [1].selector := fsc$create_file;
    file_attachment_options^ [1].create_file := TRUE;


    fsp$open_file (pvt [p$output].value^.file_value^, amc$record, file_attachment_options, NIL,
          cycle_attributes, NIL, NIL, output_file_id, status);


  PROCEND process_parameters_open_files;
?? OLDTITLE ??
?? EJECT ??

{   BEGIN nfp$preprocess_uri;

    status.normal := TRUE;

    process_parameters_open_files (input_file_id, output_file_id, vfu_id, status);
    IF NOT status.normal THEN
      RETURN
    IFEND;

    generate_file_beginning (output_file_id, output_file_byte_address, status);
    IF NOT status.normal THEN
      RETURN
    IFEND;

    initial_vfu_loaded := FALSE;
    generate_vfu (vfu_id, output_file_id, output_file_byte_address, status);
    IF NOT status.normal THEN
      RETURN
    IFEND;
    initial_vfu_loaded := TRUE;

    input_line := ' ';
    amp$get_next (input_file_id, ^input_line, maximum_input_bytes, input_file_byte_count,
          input_file_byte_address, input_file_position, status);
    WHILE (input_file_position <> amc$eoi) AND status.normal DO
      generate_line_in_output_file (input_line, input_file_byte_count, status);
      input_line := ' ';
      amp$get_next (input_file_id, ^input_line, maximum_input_bytes, input_file_byte_count,
            input_file_byte_address, input_file_position, status);

    WHILEND;

    IF pvt [p$input].value^.field_values^ [file_field].value = NIL THEN
      jmp$close_output_file (input_file_id, status);
    ELSE
      fsp$close_file (input_file_id, status);
    IFEND;
    fsp$close_file (output_file_id, status);

  PROCEND nfp$preprocess_uri;

MODEND nfm$preprocess_uri;

