?? RIGHT := 110 ??
?? NEWTITLE := 'NOS/VE SCL Parameter Description Table and Type Specification Generator' ??
MODULE clm$generate_pdt;

{
{ PURPOSE:
{   This module contains the program that generates the CYBIL declarations
{   for a Parameter Description Table for a command (PROCEDURE) or FUNCTION
{   processor, or a TYPE specification.  It can also handle "old" (pre- SCL
{   New Types) Parameter Descriptor Table (PDT) specifications.
{

?? NEWTITLE := 'Global Declarations', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc clc$lexical_units_size_pad
*copyc amt$page_format
*copyc amt$page_length
*copyc amt$page_width
*copyc clc$max_integer
*copyc clc$max_keyword_values
*copyc clc$max_proc_names
*copyc clc$min_integer
*copyc clc$proc_pdt_parameter_limits
*copyc cle$ecc_lexical
*copyc cle$ecc_line_length
*copyc cle$ecc_parsing
*copyc clt$command_line
*copyc clt$command_line_index
*copyc clt$command_line_size
*copyc clt$parameter_description_table
*copyc clt$parameter_descriptor_table
*copyc clt$parameter_list
*copyc clt$parameter_list_text_size
*copyc clt$symbolic_subrange_qualifier
*copyc clt$type_specification
*IF NOT $true(osv$unix)
*copyc oss$job_paged_literal
*ELSE
*copyc clc$declaration_version
*copyc clp$type_kinds_v2
*copyc clt$type_name
*copyc clt$type_kinds_v2
*IFEND
*copyc ost$name_reference
*copyc ost$status
*IF NOT $true(osv$unix)
*copyc pmt$program_name
*IFEND
?? POP ??
*IF NOT $true(osv$unix)
*copyc amv$nil_file_identifier
*IFEND
*copyc clp$append_status_parse_state
*copyc clp$convert_integer_to_string
*copyc clp$evaluate_parameters
*copyc clp$get_work_area
*copyc clp$identify_lexical_units
*copyc clp$initialize_parse_state
*IF NOT $true(osv$unix)
*copyc clp$internal_generate_old_pdt
*IFEND
*copyc clp$internal_generate_pdt
*IF NOT $true(osv$unix)
*copyc clp$internal_gen_type_spec
*IFEND
*copyc clp$scan_non_space_lexical_unit
*copyc clp$trimmed_string_size
*IF NOT $true(osv$unix)
*copyc fsp$close_file
*copyc fsp$open_file
*copyc mmp$create_scratch_segment
*copyc mmp$delete_scratch_segment
*IFEND
*copyc osp$append_status_parameter
*IF NOT $true(osv$unix)
*copyc osp$disestablish_cond_handler
*copyc osp$establish_block_exit_hndlr
*IFEND
*copyc osp$set_status_abnormal
*copyc osv$lower_to_upper
*copyc osv$upper_to_lower
*IF NOT $true(osv$unix)
*copyc pmp$get_compact_date_time
*IFEND

  CONST
    indent_increment = 2,
    initial_indent = 5,
    max_indent = 41;

  VAR
    current_indent: amt$page_width,
    max_indent_exceeded_count: 0 .. amc$max_page_width := 0,
    max_indent_exceeded_cnt: 0 .. amc$max_page_width;

  VAR
    ignore_status: ost$status;

  VAR
*IF NOT $true(osv$unix)
    type_kind_names: [STATIC, READ, oss$job_paged_literal] array [clt$type_kind] of
          clt$type_name := ['clc$application_type', 'clc$array_type', 'clc$boolean_type',
          'clc$cobol_name_type', 'clc$command_reference_type', 'clc$data_name_type', 'clc$date_time_type',
          'clc$entry_point_reference_type', 'clc$file_type', 'clc$integer_type', 'clc$keyword_type',
          'clc$list_type', 'clc$lock_type', 'clc$name_type', 'clc$network_title_type',
          'clc$program_name_type', 'clc$range_type', 'clc$real_type', 'clc$record_type',
          'clc$scu_line_identifier_type', 'clc$statistic_code_type', 'clc$status_type',
          'clc$status_code_type', 'clc$string_type', 'clc$string_pattern_type', 'clc$time_increment_type',
          'clc$time_zone_type', 'clc$type_specification_type', 'clc$union_type'];
*ELSE
    type_kind_names: [STATIC, READ] array [clc$application_type .. clc$unix_file_type]
          of clt$type_name := ['clc$application_type', 'clc$array_type', 'clc$boolean_type',
          'clc$cobol_name_type', 'clc$command_reference_type', 'clc$data_name_type', 'clc$date_time_type',
          'clc$entry_point_reference_type', 'clc$nos_ve_file_type', 'clc$integer_type', 'clc$keyword_type',
          'clc$list_type', 'clc$lock_type', 'clc$name_type', 'clc$network_title_type',
          'clc$program_name_type', 'clc$range_type', 'clc$real_type', 'clc$record_type',
          'clc$scu_line_identifier_type', 'clc$statistic_code_type', 'clc$status_type',
          'clc$status_code_type', 'clc$string_type', 'clc$string_pattern_type', 'clc$time_increment_type',
          'clc$time_zone_type', 'clc$type_specification_type', 'clc$union_type', 'clc$unix_file_type'];
*IFEND

*IF $true(osv$unix)
  VAR
    file_type_kind_name: [STATIC, READ] clt$type_name := 'clc$file_type';
*IFEND

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

*IF NOT $true(osv$unix)
  PROGRAM clp$_generate_pdt
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{ PROCEDURE (osm$genpdt) generate_pdt, genpdt (
{   input, i: file = $required
{   output, o: file = $required
{   page_width, pw: integer 79..110 = 79
{   status)

?? PUSH (LISTEXT := ON) ??

    VAR
      pdt: [STATIC, READ, cls$declaration_section] record
        header: clt$pdt_header,
        names: array [1 .. 7] of clt$pdt_parameter_name,
        parameters: array [1 .. 4] of clt$pdt_parameter,
        type1: record
          header: clt$type_specification_header,
        recend,
        type2: record
          header: clt$type_specification_header,
        recend,
        type3: record
          header: clt$type_specification_header,
          qualifier: clt$integer_type_qualifier,
          default_value: string (2),
        recend,
        type4: record
          header: clt$type_specification_header,
        recend,
      recend := [[1, [88, 10, 28, 11, 50, 47, 320], clc$command, 7, 4, 2, 0, 0, 0, 4, 'OSM$GENPDT'],
            [['I                              ', clc$abbreviation_entry, 1],
            ['INPUT                          ', clc$nominal_entry, 1],
            ['O                              ', clc$abbreviation_entry, 2],
            ['OUTPUT                         ', clc$nominal_entry, 2],
            ['PAGE_WIDTH                     ', clc$nominal_entry, 3],
            ['PW                             ', clc$abbreviation_entry, 3],
            ['STATUS                         ', clc$nominal_entry, 4]], [

{ 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$required_parameter, 0, 0],

{ PARAMETER 2

      [4, 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

      [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, 20, clc$optional_default_parameter, 0, 2],

{ 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$file_type]],

{ PARAMETER 2

      [[1, 0, clc$file_type]],

{ PARAMETER 3

      [[1, 0, clc$integer_type], [79, 110, 10], '79'],

{ PARAMETER 4

      [[1, 0, clc$status_type]]];

?? POP ??

    CONST
      p$input = 1,
      p$output = 2,
      p$page_width = 3,
      p$status = 4;

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

?? 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);


      clean_up;

    PROCEND abort_handler;
?? TITLE := 'clean_up', EJECT ??

    PROCEDURE clean_up;


      IF input_file_id <> amv$nil_file_identifier THEN
        fsp$close_file (input_file_id, ignore_status);
        input_file_id := amv$nil_file_identifier;
      IFEND;
      IF output_file_id <> amv$nil_file_identifier THEN
        fsp$close_file (output_file_id, ignore_status);
        output_file_id := amv$nil_file_identifier;
      IFEND;
      IF symbolic_work_area_segment.sequence_pointer <> NIL THEN
        mmp$delete_scratch_segment (symbolic_work_area_segment, ignore_status);
        symbolic_work_area_segment.sequence_pointer := NIL;
      IFEND;

    PROCEND clean_up;
*ELSE
  PROGRAM clp_generate_pdt;

*IFEND
?? TITLE := 'get_out', EJECT ??

    PROCEDURE get_out
      (    exit_status: ost$status);


      status := exit_status;
*IF NOT $true(osv$unix)
      EXIT clp$_generate_pdt;
*ELSE
      EXIT clp_generate_pdt;
*IFEND

    PROCEND get_out;
?? OLDTITLE, EJECT ??
*IF NOT $true(osv$unix)

    VAR
      attachment_options: array [1 .. 3] of fst$attachment_option,
      command_or_function: clt$command_or_function,
      default_creation_attributes: array [1 .. 2] of fst$file_cycle_attribute,
      end_of_input: boolean,
      input_file_id: amt$file_identifier,
      input_file_position: amt$file_position,
      name: ost$name,
      output_file_attributes: array [1 .. 1] of amt$fetch_item,
      output_file_id: amt$file_identifier,
      page_width: amt$page_width,
      parse: clt$parse_state,
      symbolic_work_area_segment: amt$segment_pointer,
      validation_attributes: array [1 .. 6] of fst$file_cycle_attribute,
      work_area: ^^clt$work_area;


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

    page_width := pvt [p$page_width].value^.integer_value.value;

    validation_attributes [1].selector := fsc$file_contents_and_processor;
    validation_attributes [1].file_contents := fsc$legible_scl_procedure;
    validation_attributes [1].file_processor := osc$null_name;
    validation_attributes [2].selector := fsc$file_contents_and_processor;
    validation_attributes [2].file_contents := fsc$legible_scl_include;
    validation_attributes [2].file_processor := osc$null_name;
    validation_attributes [3].selector := fsc$file_contents_and_processor;
    validation_attributes [3].file_contents := fsc$legible_data;
    validation_attributes [3].file_processor := osc$null_name;
    validation_attributes [4].selector := fsc$file_contents_and_processor;
    validation_attributes [4].file_contents := amc$legible;
    validation_attributes [4].file_processor := osc$null_name;
    validation_attributes [5].selector := fsc$file_contents_and_processor;
    validation_attributes [5].file_contents := fsc$data;
    validation_attributes [5].file_processor := osc$null_name;
    validation_attributes [6].selector := fsc$file_contents_and_processor;
    validation_attributes [6].file_contents := fsc$unknown_contents;
    validation_attributes [6].file_processor := osc$null_name;

    input_file_id := amv$nil_file_identifier;
    output_file_id := amv$nil_file_identifier;
    symbolic_work_area_segment.kind := amc$sequence_pointer;
    symbolic_work_area_segment.sequence_pointer := NIL;
    #SPOIL (input_file_id, output_file_id, symbolic_work_area_segment);

    osp$establish_block_exit_hndlr (^abort_handler);

    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$specific_share_modes;
    attachment_options [1].share_modes.value := $fst$file_access_options [fsc$read, fsc$execute];
    attachment_options [2].selector := fsc$open_share_modes;
    attachment_options [2].open_share_modes := $fst$file_access_options [fsc$read, fsc$execute];
    attachment_options [3].selector := fsc$create_file;
    attachment_options [3].create_file := FALSE;
    fsp$open_file (pvt [p$input].value^.file_value^, amc$record, ^attachment_options, NIL, NIL,
          ^validation_attributes, NIL, input_file_id, status);
    IF NOT status.normal THEN
      clean_up;
      osp$disestablish_cond_handler;
      RETURN;
    IFEND;

    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$append, fsc$shorten];
    attachment_options [1].share_modes.selector := fsc$specific_share_modes;
    attachment_options [1].share_modes.value := $fst$file_access_options [];
    attachment_options [2].selector := fsc$access_and_share_modes;
    attachment_options [2].access_modes.selector := fsc$specific_access_modes;
    attachment_options [2].access_modes.value := $fst$file_access_options [fsc$append];
    attachment_options [2].share_modes.selector := fsc$specific_share_modes;
    attachment_options [2].share_modes.value := $fst$file_access_options [];
    attachment_options [3].selector := fsc$open_share_modes;
    attachment_options [3].open_share_modes := -$fst$file_access_options [];
    validation_attributes [1].selector := fsc$null_attribute;
    validation_attributes [2].selector := fsc$null_attribute;
    default_creation_attributes [1].selector := fsc$file_contents_and_processor;
    default_creation_attributes [1].file_contents := fsc$legible_data;
    default_creation_attributes [1].file_processor := osc$null_name;
    default_creation_attributes [2].selector := fsc$page_format;
    default_creation_attributes [2].page_format := amc$untitled_form;
    fsp$open_file (pvt [p$output].value^.file_value^, amc$record, ^attachment_options,
          ^default_creation_attributes, NIL, ^validation_attributes, NIL, output_file_id, status);
    IF NOT status.normal THEN
      clean_up;
      osp$disestablish_cond_handler;
      RETURN;
    IFEND;
*ELSE
    VAR
      command_or_function: clt$command_or_function,
      end_of_input: boolean,
      name: ost$name,
      parse: clt$parse_state,
      status: ost$status,
      symbolic_work_area_segment: ^clt$work_area,
      work_area: ^^clt$work_area;
*IFEND

*IF NOT $true(osv$unix)
    clp$get_work_area (#RING (^work_area), work_area, status);
*ELSE
    clp$get_work_area (osc$user_ring, work_area, status);
*IFEND
    IF NOT status.normal THEN
*IF NOT $true(osv$unix)
      clean_up;
      osp$disestablish_cond_handler;
*IFEND
      RETURN;
    IFEND;

*IF NOT $true(osv$unix)
    clp$ip_initialize (pvt [p$input].value^.file_value^, input_file_id, ^input_file_position, NIL,
          ^clp$op_echo, work_area^, status);
*ELSE
    clp$ip_initialize ('pdt_in', NIL,
          ^clp$op_echo, work_area^, status);
*IFEND
    IF NOT status.normal THEN
*IF NOT $true(osv$unix)
      clean_up;
      osp$disestablish_cond_handler;
*IFEND
      RETURN;
    IFEND;

*IF NOT $true(osv$unix)
    clp$op_initialize (output_file_id, page_width, ^get_out);
*ELSE
    clp$op_initialize (80, ^get_out);
*IFEND

    current_indent := initial_indent;

    REPEAT
      clp$input_procedure (parse, end_of_input, status);
      IF (NOT status.normal) OR end_of_input THEN
*IF NOT $true(osv$unix)
        clean_up;
*IFEND
        RETURN;
      IFEND;
      clp$scan_non_space_lexical_unit (parse);
    UNTIL parse.unit.kind <> clc$lex_end_of_line;

    IF parse.unit.kind = clc$lex_name THEN
      #TRANSLATE (osv$lower_to_upper, parse.text^ (parse.unit_index, parse.unit.size), name);
*IF NOT $true(osv$unix)
      IF name = 'PDT' THEN
        generate_old_pdt (work_area^, parse, status);
      ELSEIF name = 'TYPE' THEN
        generate_type (symbolic_work_area_segment, work_area^, parse, status);
      ELSE
*IFEND
        IF name = 'PROCEDURE' THEN
          command_or_function := clc$command;
        ELSEIF name = 'FUNCTION' THEN
          command_or_function := clc$function;
        ELSE
          osp$set_status_abnormal ('CL', cle$expecting_proc_func_or_type, name, status);
          RETURN;
        IFEND;
        generate_pdt (command_or_function, symbolic_work_area_segment, work_area^, parse, status);
*IF NOT $true(osv$unix)
      IFEND;
*IFEND
    ELSE
      osp$set_status_abnormal ('CL', cle$expecting_proc_func_or_type, '', status);
      clp$append_status_parse_state (osc$status_parameter_delimiter, parse, status);
      RETURN;
    IFEND;

*IF NOT $true(osv$unix)
    clean_up;

  PROCEND clp$_generate_pdt;
*ELSE
  PROCEND clp_generate_pdt;
*IFEND
?? TITLE := 'generate_pdt', EJECT ??

  PROCEDURE generate_pdt
    (    command_or_function: clt$command_or_function;
*IF NOT $true(osv$unix)
     VAR symbolic_work_area_segment {input, output} : amt$segment_pointer;
*ELSE
     VAR symbolic_work_area_segment {input, output} : ^clt$work_area;
*IFEND
     VAR work_area {input, output} : ^clt$work_area;
     VAR parse: clt$parse_state;
     VAR status: ost$status);

?? NEWTITLE := 'put_extra_stuff', EJECT ??

    PROCEDURE put_extra_stuff;

      CONST
        prefix = 'p$',
        prefix_size = 2;

      VAR
        adjusted_name_size: ost$name_size,
        ch: char,
        char_index: ost$name_size,
        name: clt$parameter_name,
        name_changed: boolean,
        name_index: clt$parameter_name_index,
        name_size: ost$name_size,
        parameter_index: clt$parameter_number;


      clp$op_put_line ('');
      clp$op_put_line ('    CONST');
      FOR parameter_index := 1 TO UPPERBOUND (parameters^) DO

        name_index := parameters^ [parameter_index].name_index;
        name_size := clp$trimmed_string_size (parameter_names^ [name_index].name);
        IF name_size <= (osc$max_name_size - prefix_size) THEN
          adjusted_name_size := name_size;
          name_changed := FALSE;
        ELSE
          adjusted_name_size := osc$max_name_size - prefix_size;
          name_changed := TRUE;
        IFEND;
        FOR char_index := 1 TO adjusted_name_size DO
          ch := parameter_names^ [name_index].name (char_index);
          CASE ch OF
          = 'a' .. 'z', '0' .. '9', '_', '$', '#', '@' =
            name (char_index) := ch;
          = 'A' .. 'Z' =
            name (char_index) := $CHAR ($INTEGER (ch) - $INTEGER ('A') + $INTEGER ('a'));
          ELSE
            name (char_index) := '_';
            name_changed := TRUE;
          CASEND;
        FOREND;

        clp$op_add_to_line ('      ' CAT prefix);
        clp$op_add_to_line (name (1, adjusted_name_size));
        clp$op_add_to_line (' = ');
        clp$op_add_integer_to_line (parameter_index);
        IF name_changed THEN
          clp$op_add_to_line (' {');
          clp$op_add_to_line (parameter_names^ [name_index].name (1, name_size));
          clp$op_add_to_line ('} ');
        IFEND;
        IF parameter_index < UPPERBOUND (parameters^) THEN
          clp$op_add_to_line (',');
        ELSE
          clp$op_add_to_line (';');
        IFEND;
        clp$op_flush_line;
      FOREND;

      clp$op_put_line ('');
      clp$op_put_line ('    VAR');
      clp$op_add_to_line ('      pvt: array [1 .. ');
      clp$op_add_integer_to_line (pdt_header^.number_of_parameters);
      clp$op_add_to_line ('] of clt$parameter_value;');
      clp$op_flush_line;

    PROCEND put_extra_stuff;
?? TITLE := 'put_parameter_array_values', EJECT ??

    PROCEDURE put_parameter_array_values;

      VAR
        index: clt$parameter_count;


      clp$op_tab_line (current_indent);
      clp$op_add_to_line ('['); {for parameter array
      clp$op_flush_line;

      FOR index := 1 TO UPPERBOUND (parameters^) DO
        clp$op_add_to_line ('{ PARAMETER ');
        clp$op_add_integer_to_line (index);
        clp$op_flush_line;
        clp$op_tab_line (current_indent);
        clp$op_add_to_line ('['); {for parameter entry in array
        clp$op_add_integer_to_line (parameters^ [index].name_index);
        clp$op_add_to_line (', ');
        CASE parameters^ [index].availability OF
        = clc$normal_usage_entry =
          clp$op_add_to_line ('clc$normal_usage_entry, ');
        = clc$advanced_usage_entry =
          clp$op_add_to_line ('clc$advanced_usage_entry, ');
        = clc$hidden_entry =
          clp$op_add_to_line ('clc$hidden_entry, ');
        CASEND;
        IF parameters^ [index].security = clc$non_secure_parameter THEN
          clp$op_add_to_line ('clc$non_secure_parameter,');
        ELSE
          clp$op_add_to_line ('clc$secure_parameter,');
        IFEND;
        clp$op_flush_line;

        clp$op_tab_line (current_indent);
        clp$op_add_to_line ('$clt$parameter_spec_methods[');
        IF clc$specify_by_name IN parameters^ [index].specification_methods THEN
          clp$op_add_to_line ('clc$specify_by_name');
          IF clc$specify_positionally IN parameters^ [index].specification_methods THEN
            clp$op_add_to_line (', ');
          IFEND;
        IFEND;
        IF clc$specify_positionally IN parameters^ [index].specification_methods THEN
          clp$op_add_to_line ('clc$specify_positionally');
        IFEND;
        clp$op_add_to_line ('],');
        clp$op_flush_line;

        clp$op_tab_line (current_indent);
        IF parameters^ [index].passing_method = clc$pass_by_value THEN
          clp$op_add_to_line ('clc$pass_by_value, ');
        ELSE
          clp$op_add_to_line ('clc$pass_by_reference, ');
        IFEND;
        IF parameters^ [index].evaluation_method = clc$immediate_evaluation THEN
          clp$op_add_to_line ('clc$immediate_evaluation, ');
        ELSE
          clp$op_add_to_line ('clc$deferred_evaluation, ');
        IFEND;
        IF parameters^ [index].checking_level = clc$standard_parameter_checking THEN
          clp$op_add_to_line ('clc$standard_parameter_checking, ');
        ELSE
          clp$op_add_to_line ('clc$extended_parameter_checking, ');
        IFEND;
        clp$op_add_integer_to_line (parameters^ [index].type_specification_size);
        clp$op_add_to_line (', ');

        CASE parameters^ [index].requirement OF
        = clc$required_parameter =
          clp$op_add_to_line ('clc$required_parameter, ');
        = clc$optional_parameter =
          clp$op_add_to_line ('clc$optional_parameter, ');
        = clc$optional_default_parameter =
          clp$op_add_to_line ('clc$optional_default_parameter, ');
        = clc$confirm_default_parameter =
          clp$op_add_to_line ('clc$confirm_default_parameter, ');
        CASEND;

        clp$op_add_integer_to_line (parameters^ [index].default_name_size);
        clp$op_add_to_line (', ');
        clp$op_add_integer_to_line (parameters^ [index].default_value_size);
        IF index < UPPERBOUND (parameters^) THEN
          clp$op_add_to_line ('],');
        ELSE
          clp$op_add_to_line (']],');
        IFEND;
        clp$op_flush_line;
      FOREND;

    PROCEND put_parameter_array_values;
?? TITLE := 'put_parameter_names', EJECT ??

    PROCEDURE put_parameter_names;

      VAR
        index: clt$parameter_name_count,
        name_size: ost$name_size;


      clp$op_add_to_line ('[');
      clp$op_flush_line;
      clp$op_tab_line (current_indent);

      FOR index := 1 TO UPPERBOUND (parameter_names^) DO
        clp$op_add_to_line ('[''');
        clp$op_add_to_line (parameter_names^ [index].name);
        clp$op_add_to_line (''',');

        CASE parameter_names^ [index].class OF
        = clc$nominal_entry =
          clp$op_add_to_line ('clc$nominal_entry, ');
        = clc$alias_entry =
          clp$op_add_to_line ('clc$alias_entry, ');
        = clc$abbreviation_entry =
          clp$op_add_to_line ('clc$abbreviation_entry, ');
        CASEND;

        clp$op_add_integer_to_line (parameter_names^ [index].position);
        IF index < UPPERBOUND (parameter_names^) THEN
          clp$op_add_to_line ('],');
          clp$op_flush_line;
          clp$op_tab_line (current_indent);
        ELSE
          clp$op_add_to_line (']');
        IFEND;
      FOREND;
      clp$op_add_to_line ('],');
      clp$op_flush_line;
      clp$op_tab_line (current_indent);

    PROCEND put_parameter_names;
?? TITLE := 'put_parameter_specs', EJECT ??

    PROCEDURE put_parameter_specs;

      VAR
        default: ^clt$expression_text,
        i: 1 .. clc$max_parameters,
        parameter_name_index: 1 .. clc$max_parameter_names + 1;


      FOR i := 1 TO UPPERBOUND (parameters^) DO
        clp$op_tab_line (current_indent);
        clp$op_add_to_line ('type');
        clp$op_add_integer_to_line (i);
        clp$op_add_to_line (': record');
        clp$op_flush_line;
        increment_indent;

        put_type_spec (pdt);

        IF parameters^ [i].default_name_size > 0 THEN
          NEXT default: [parameters^ [i].default_name_size] IN pdt;
          clp$op_tab_line (current_indent);
*IF $true(osv$unix)
          clp$op_add_to_line ('default_name: ALIGNED [0 MOD 4] string (');
*ELSEIF ($variable(osv$64_bit_word, declared) = 'LOCAL') AND osv$64_bit_word
          clp$op_add_to_line ('default_name: ALIGNED [0 MOD 8] string (');
*ELSE
          clp$op_add_to_line ('default_name: string (');
*IFEND
          clp$op_add_integer_to_line (parameters^ [i].default_name_size);
          clp$op_add_to_line ('),');
          clp$op_flush_line;
        IFEND;
        IF parameters^ [i].default_value_size > 0 THEN
          NEXT default: [parameters^ [i].default_value_size] IN pdt;
          clp$op_tab_line (current_indent);
*IF $true(osv$unix)
          clp$op_add_to_line ('default_value: ALIGNED [0 MOD 4] string (');
*ELSEIF ($variable(osv$64_bit_word, declared) = 'LOCAL') AND osv$64_bit_word
          clp$op_add_to_line ('default_value: ALIGNED [0 MOD 8] string (');
*ELSE
          clp$op_add_to_line ('default_value: string (');
*IFEND
          clp$op_add_integer_to_line (parameters^ [i].default_value_size);
          clp$op_add_to_line ('),');
          clp$op_flush_line;
        IFEND;
        decrement_indent;
        clp$op_tab_line (current_indent);
        clp$op_add_to_line ('recend,');
        clp$op_flush_line;
      FOREND;

    PROCEND put_parameter_specs;
?? TITLE := 'put_pdt_header_spec', EJECT ??

    PROCEDURE put_pdt_header_spec;


      clp$op_put_line ('');
      clp$op_put_line ('?? PUSH (LISTEXT := ON) ??');
      clp$op_put_line ('?? FMT (FORMAT := OFF) ??');
      clp$op_put_line ('');
      clp$op_put_line ('  VAR');
      current_indent := initial_indent;
      clp$op_put_line ('    pdt: [STATIC, READ, cls$declaration_section] record');
      increment_indent;
      clp$op_tab_line (current_indent);
      clp$op_add_to_line ('header: clt$pdt_header,');
      clp$op_flush_line;

      IF parameter_names <> NIL THEN
        clp$op_tab_line (current_indent);
        clp$op_add_to_line ('names: array [1 .. ');
        clp$op_add_integer_to_line (pdt_header^.number_of_parameter_names);
        clp$op_add_to_line ('] of clt$pdt_parameter_name,');
        clp$op_flush_line;

        clp$op_tab_line (current_indent);
        clp$op_add_to_line ('parameters: array [1 .. ');
        clp$op_add_integer_to_line (pdt_header^.number_of_parameters);
        clp$op_add_to_line ('] of clt$pdt_parameter,');
        clp$op_flush_line;
      IFEND;

    PROCEND put_pdt_header_spec;
?? TITLE := 'put_type_values', EJECT ??

    PROCEDURE put_type_values;

      VAR
        default: ^string ( * ),
        i: 1 .. clc$max_parameters,
        parameter_name_index: 1 .. clc$max_parameter_names + 1,
        string_index: ost$string_index;


      FOR i := 1 TO UPPERBOUND (parameters^) DO
        clp$op_flush_line;
        clp$op_add_to_line ('{ PARAMETER ');
        clp$op_add_integer_to_line (i);
        clp$op_flush_line;
        clp$op_tab_line (current_indent);
        clp$op_add_to_line ('[');

*IF NOT $true(osv$unix)
        put_type_value (pdt, symbolic_work_area_segment.sequence_pointer);
*ELSE
        put_type_value (pdt, symbolic_work_area_segment);
*IFEND

        IF parameters^ [i].default_name_size > 0 THEN
          NEXT default: [parameters^ [i].default_name_size] IN pdt;
          clp$op_add_to_line (',');
          clp$op_flush_line;
          clp$op_tab_line (current_indent);
          clp$op_add_to_line ('''');
          clp$op_add_to_line (default^);
          clp$op_add_to_line ('''');
        IFEND;

        IF parameters^ [i].default_value_size > 0 THEN
          NEXT default: [parameters^ [i].default_value_size] IN pdt;
          clp$op_add_to_line (',');
          clp$op_flush_line;
          clp$op_tab_line (current_indent);
          clp$op_add_to_line ('''');
          FOR string_index := 1 TO STRLENGTH (default^) DO
            IF (clv$op.line_size = clv$op.page_width - 1) OR ((default^ (string_index) = '''') AND
                  (clv$op.line_size + 3 > clv$op.page_width)) THEN
              clp$op_add_to_line ('''');
              clp$op_flush_line;
              clp$op_tab_line (current_indent);
              clp$op_start_line ('CAT ''');
            IFEND;

            clp$op_add_to_line (default^ (string_index));
            IF default^ (string_index) = '''' THEN
              clp$op_add_to_line ('''');
            IFEND;
          FOREND;

          IF clv$op.line_size >= clv$op.page_width THEN
            clp$op_flush_line;
            clp$op_tab_line (current_indent);
            clp$op_add_to_line ('CAT ''''''');
          IFEND;
          clp$op_add_to_line ('''');
        IFEND;
        IF i < UPPERBOUND (parameters^) THEN
          clp$op_add_to_line ('], ');
        ELSE
          clp$op_add_to_line (']');
        IFEND;
      FOREND;

    PROCEND put_type_values;
?? OLDTITLE, EJECT ??

    VAR
      aliases: ^array [1 .. * ] of pmt$program_name,
      availability: clt$named_entry_availability,
      command_or_function_name: pmt$program_name,
      command_log_option: clt$command_log_option,
      command_or_function_scope: clt$command_or_function_scope,
      parameter_names: ^clt$pdt_parameter_names,
      parameters: ^clt$pdt_parameters,
      pdt: ^clt$parameter_description_table,
      pdt_header: ^clt$pdt_header;


*IF NOT $true(osv$unix)
    mmp$create_scratch_segment (amc$sequence_pointer, mmc$as_sequential, symbolic_work_area_segment, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;
    RESET symbolic_work_area_segment.sequence_pointer;

*ELSE
    ALLOCATE symbolic_work_area_segment :[[REP 5ffff(16) OF cell]];
    RESET symbolic_work_area_segment;
*IFEND

    clp$scan_non_space_lexical_unit (parse);

    clp$internal_generate_pdt (command_or_function, ^clp$input_procedure,
*IF NOT $true(osv$unix)
          symbolic_work_area_segment.sequence_pointer, work_area, parse, command_or_function_name, aliases,
*ELSE
          symbolic_work_area_segment, work_area, parse, command_or_function_name, aliases,
*IFEND
          availability, command_or_function_scope, command_log_option, pdt, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    RESET pdt;
    NEXT pdt_header IN pdt;
    IF pdt_header^.number_of_parameters > 0 THEN
      NEXT parameter_names: [1 .. pdt_header^.number_of_parameter_names] IN pdt;
      NEXT parameters: [1 .. pdt_header^.number_of_parameters] IN pdt;
    ELSE
      parameter_names := NIL;
      parameters := NIL;
    IFEND;
    put_pdt_header_spec;
    IF parameters <> NIL THEN
      put_parameter_specs;
    IFEND;

    current_indent := initial_indent;
    clp$op_tab_line (current_indent);
    clp$op_add_to_line ('recend := [');
    clp$op_flush_line;

    RESET pdt;
    NEXT pdt_header IN pdt;
    IF pdt_header^.number_of_parameters > 0 THEN
      NEXT parameter_names: [1 .. pdt_header^.number_of_parameter_names] IN pdt;
      NEXT parameters: [1 .. pdt_header^.number_of_parameters] IN pdt;
    IFEND;

    clp$op_tab_line (current_indent);
    clp$op_add_to_line ('[');
*IF NOT $true(osv$unix)
    clp$op_add_integer_to_line (pdt_header^.version);
*ELSE
    clp$op_add_integer_to_line (clc$declaration_version);
*IFEND
    clp$op_add_to_line (',');
    clp$op_flush_line;
    clp$op_tab_line (current_indent);
    clp$op_add_to_line ('[');
    clp$op_add_integer_to_line (pdt_header^.generation_date_time.year);
    clp$op_add_to_line (', ');
    clp$op_add_integer_to_line (pdt_header^.generation_date_time.month);
    clp$op_add_to_line (', ');
    clp$op_add_integer_to_line (pdt_header^.generation_date_time.day);
    clp$op_add_to_line (', ');
    clp$op_add_integer_to_line (pdt_header^.generation_date_time.hour);
    clp$op_add_to_line (', ');
    clp$op_add_integer_to_line (pdt_header^.generation_date_time.minute);
    clp$op_add_to_line (', ');
    clp$op_add_integer_to_line (pdt_header^.generation_date_time.second);
    clp$op_add_to_line (', ');
    clp$op_add_integer_to_line (pdt_header^.generation_date_time.millisecond);
    clp$op_add_to_line ('],');
    clp$op_flush_line;
    clp$op_tab_line (current_indent);
    IF pdt_header^.command_or_function = clc$command THEN
      clp$op_add_to_line ('clc$command, ');
    ELSE
      clp$op_add_to_line ('clc$function, ');
    IFEND;
    clp$op_add_integer_to_line (pdt_header^.number_of_parameter_names);
    clp$op_add_to_line (', ');
    clp$op_add_integer_to_line (pdt_header^.number_of_parameters);
    clp$op_add_to_line (', ');
    clp$op_add_integer_to_line (pdt_header^.number_of_required_parameters);
    clp$op_add_to_line (', ');
    clp$op_add_integer_to_line (pdt_header^.number_of_advanced_parameters);
    clp$op_add_to_line (', ');
    clp$op_add_integer_to_line (pdt_header^.number_of_hidden_parameters);
    clp$op_add_to_line (', ');
    clp$op_add_integer_to_line (pdt_header^.number_of_var_parameters);
    clp$op_add_to_line (', ');
    clp$op_add_integer_to_line (pdt_header^.status_parameter_number);
    clp$op_add_to_line (', ''');
    clp$op_add_to_line (pdt_header^.help_module_name (1, clp$trimmed_string_size
          (pdt_header^.help_module_name)));
    clp$op_add_to_line (''']');

    IF pdt_header^.number_of_parameters > 0 THEN
      clp$op_add_to_line (', ');
      put_parameter_names;
      put_parameter_array_values;
      put_type_values;
    IFEND;

    clp$op_add_to_line ('];');
    clp$op_flush_line;

    clp$op_put_line ('');
    clp$op_put_line ('?? FMT (FORMAT := ON) ??');
    clp$op_put_line ('?? POP ??');

    IF pdt_header^.number_of_parameters > 0 THEN
      put_extra_stuff;
    IFEND;

  PROCEND generate_pdt;
?? TITLE := 'generate_old_pdt', EJECT ??

*IF NOT $true(osv$unix)
  PROCEDURE generate_old_pdt
    (VAR work_area {input, output} : ^clt$work_area;
     VAR parse {input, output} : clt$parse_state;
     VAR status: ost$status);

?? NEWTITLE := 'put_pdt_header', EJECT ??

    PROCEDURE put_pdt_header
      (    pdt_name: ost$name_reference;
           parameter_count: clt$parameter_count);

      VAR
        size: integer,
        str: string (100);


      clp$op_put_line ('');
      clp$op_put_line ('?? PUSH (LISTEXT := ON) ??');
      clp$op_put_line ('?? FMT (FORMAT := OFF) ??');
      clp$op_put_line ('');
      clp$op_put_line ('  VAR');
      clp$op_start_line ('    ');
      clp$op_add_to_line (pdt_name);
      clp$op_add_to_line (': [STATIC, READ, cls$pdt] ');
      clp$op_add_to_line ('clt$parameter_descriptor_table ');
      clp$op_add_to_line (':= [');
      IF parameter_count = 0 THEN
        clp$op_add_to_line ('NIL, NIL];');
      ELSE
        STRINGREP (str, size, '^', pdt_name, '_names');
        IF size > (osc$max_name_size + 1) THEN
          osp$set_status_abnormal ('CL', cle$name_too_long, str (1, size), status);
          EXIT generate_old_pdt;
        IFEND;
        clp$op_add_to_line (str (1, size));
        clp$op_add_to_line (', ');
        STRINGREP (str, size, '^', pdt_name, '_params');
        IF size > (osc$max_name_size + 1) THEN
          osp$set_status_abnormal ('CL', cle$name_too_long, str (1, size), status);
          EXIT generate_old_pdt;
        IFEND;
        clp$op_add_to_line (str (1, size));
        clp$op_add_to_line ('];');
      IFEND;
      clp$op_flush_line;

    PROCEND put_pdt_header;
?? TITLE := 'put_pdt_names', EJECT ??

    PROCEDURE put_pdt_names
      (    pdt_name: ost$name_reference;
       VAR parameter_names: {READ} array [1 .. * ] of clt$parameter_name_descriptor);

      VAR
        i: 1 .. clc$max_parameter_names,
        size: integer,
        str: string (100);


      clp$op_put_line ('');
      clp$op_put_line ('  VAR');
      clp$op_start_line ('    ');
      STRINGREP (str, size, pdt_name, '_names');
      clp$op_add_to_line (str (1, size));
      clp$op_add_to_line (': [STATIC, READ, ');
      clp$op_add_to_line ('cls$pdt_names_and_defaults] ');
      clp$op_add_to_line ('array [1 .. ');
      clp$op_add_integer_to_line (UPPERBOUND (parameter_names));
      clp$op_add_to_line ('] ');
      clp$op_add_to_line ('of ');
      clp$op_add_to_line ('clt$parameter_name_descriptor ');
      clp$op_add_to_line (':= ');
      clp$op_add_to_line ('[');
      FOR i := 1 TO UPPERBOUND (parameter_names) DO
        clp$op_add_to_line ('[');
        STRINGREP (str, size, '''', parameter_names [i].name
              (1, clp$trimmed_string_size (parameter_names [i].name)), '''');
        clp$op_add_to_line (str (1, size));
        clp$op_add_to_line (', ');
        clp$op_add_integer_to_line (parameter_names [i].number);
        clp$op_add_to_line (']');
        IF i = UPPERBOUND (parameter_names) THEN
          clp$op_add_to_line ('];');
        ELSE
          clp$op_add_to_line (', ');
        IFEND;
      FOREND;
      clp$op_flush_line;

    PROCEND put_pdt_names;
?? TITLE := 'put_pdt_parameters', EJECT ??

    PROCEDURE put_pdt_parameters
      (    pdt_name: ost$name_reference;
           parameter_names: array [1 .. * ] of clt$parameter_name_descriptor;
           parameters: array [1 .. * ] of clt$parameter_descriptor;
           symbolic_parameters: clt$symbolic_parameters);

      VAR
        i: 1 .. clc$max_parameters,
        ignore_status: ost$status,
        int_str: ost$string,
        size: integer,
        parameter_name_index: 1 .. clc$max_parameter_names + 1,
        scanner_name: ost$name,
        str: string (100);


      clp$op_put_line ('');
      clp$op_put_line ('  VAR');
      clp$op_start_line ('    ');
      STRINGREP (str, size, pdt_name, '_params');
      clp$op_add_to_line (str (1, size));
      clp$op_add_to_line (': [STATIC, READ, ');
      clp$op_add_to_line ('cls$pdt_parameters');
      clp$op_add_to_line ('] ');
      clp$op_add_to_line ('array [');
      clp$op_add_to_line ('1 .. ');
      clp$op_add_integer_to_line (UPPERBOUND (parameters));
      clp$op_add_to_line ('] ');
      clp$op_add_to_line ('of ');
      clp$op_add_to_line ('clt$parameter_descriptor ');
      clp$op_add_to_line (':= [');
      clp$op_flush_line;

      parameter_name_index := 1;
      FOR i := 1 TO UPPERBOUND (parameters) DO
        clp$op_put_line ('');
        clp$op_start_line ('{');
        REPEAT
          clp$op_add_to_line (' ');
          clp$op_add_to_line (parameter_names [parameter_name_index].
                name (1, clp$trimmed_string_size (parameter_names [parameter_name_index].name)));
          parameter_name_index := parameter_name_index + 1;
        UNTIL NOT ((parameter_name_index <= UPPERBOUND (parameter_names)) AND
              (parameter_names [parameter_name_index].number = i));
        clp$op_add_to_line (' }');
        clp$op_flush_line;

        clp$op_start_line ('    [[clc$');
        CASE parameters [i].required_or_optional.selector OF
        = clc$required =
          clp$op_add_to_line ('required], ');
        = clc$optional =
          clp$op_add_to_line ('optional], ');
        = clc$optional_with_default =
          clp$op_add_to_line ('optional_with_default, ^');
          clp$convert_integer_to_string (i, 10, FALSE, int_str, ignore_status);
          STRINGREP (str, size, pdt_name, '_dv', int_str.value (1, int_str.size));
          IF size > osc$max_name_size THEN
            osp$set_status_abnormal ('CL', cle$name_too_long, str (1, size), status);
            EXIT generate_old_pdt;
          IFEND;
          clp$op_add_to_line (str (1, size));
          clp$op_add_to_line ('], ');
        CASEND;

        IF symbolic_parameters [i].min_value_sets = NIL THEN
          clp$op_add_to_line ('1, ');
        ELSE
          clp$op_add_to_line (symbolic_parameters [i].min_value_sets^);
          clp$op_add_to_line (', ');
        IFEND;
        IF symbolic_parameters [i].max_value_sets = NIL THEN
          IF parameters [i].max_value_sets = clc$max_value_sets THEN
            clp$op_add_to_line ('clc$max_value_sets,');
          ELSE
            clp$op_add_to_line ('1, ');
          IFEND;
        ELSE
          clp$op_add_to_line (symbolic_parameters [i].max_value_sets^);
          clp$op_add_to_line (', ');
        IFEND;

        IF symbolic_parameters [i].min_values_per_set = NIL THEN
          clp$op_add_to_line ('1, ');
        ELSE
          clp$op_add_to_line (symbolic_parameters [i].min_values_per_set^);
          clp$op_add_to_line (', ');
        IFEND;
        IF symbolic_parameters [i].max_values_per_set = NIL THEN
          clp$op_add_to_line ('1, ');
        ELSE
          clp$op_add_to_line (symbolic_parameters [i].max_values_per_set^);
          clp$op_add_to_line (', ');
        IFEND;

        IF parameters [i].value_range_allowed = clc$value_range_not_allowed THEN
          clp$op_add_to_line ('clc$value_range_not_allowed, ');
        ELSE
          clp$op_add_to_line ('clc$value_range_allowed, ');
        IFEND;

        IF parameters [i].value_kind_specifier.keyword_values = NIL THEN
          clp$op_add_to_line ('[NIL, ');
        ELSE
          clp$op_add_to_line ('[^');
          clp$convert_integer_to_string (i, 10, FALSE, int_str, ignore_status);
          STRINGREP (str, size, pdt_name, '_kv', int_str.value (1, int_str.size));
          IF size > osc$max_name_size THEN
            osp$set_status_abnormal ('CL', cle$name_too_long, str (1, size), status);
            EXIT generate_old_pdt;
          IFEND;
          clp$op_add_to_line (str (1, size));
          clp$op_add_to_line (', ');
        IFEND;

        CASE parameters [i].value_kind_specifier.kind OF
        = clc$keyword_value =
          clp$op_add_to_line ('clc$keyword_value');
        = clc$any_value =
          clp$op_add_to_line ('clc$any_value');
        = clc$variable_reference =
          clp$op_add_to_line ('clc$variable_reference, ');
          IF parameters [i].value_kind_specifier.array_allowed = clc$array_not_allowed THEN
            clp$op_add_to_line ('clc$array_not_allowed, ');
          ELSE
            clp$op_add_to_line ('clc$array_allowed, ');
          IFEND;
          CASE parameters [i].value_kind_specifier.variable_kind OF
          = clc$string_value =
            clp$op_add_to_line ('clc$string_value');
          = clc$real_value =
            clp$op_add_to_line ('clc$real_value');
          = clc$integer_value =
            clp$op_add_to_line ('clc$integer_value');
          = clc$boolean_value =
            clp$op_add_to_line ('clc$boolean_value');
          = clc$status_value =
            clp$op_add_to_line ('clc$status_value');
          = clc$any_value =
            clp$op_add_to_line ('clc$any_value');
          CASEND;
        = clc$application_value =
          clp$op_add_to_line ('clc$application_value, ');
          STRINGREP (str, size, '''', parameters [i].value_kind_specifier.
                value_name (1, clp$trimmed_string_size (parameters [i].value_kind_specifier.value_name)),
                '''');
          clp$op_add_to_line (str (1, size));
          clp$op_add_to_line (',  [');
          IF parameters [i].value_kind_specifier.scanner.kind = clc$unlinked_av_scanner THEN
            clp$op_add_to_line ('clc$linked_av_scanner, ');
            #TRANSLATE (osv$upper_to_lower, parameters [i].value_kind_specifier.scanner.name, scanner_name);
            STRINGREP (str, size, '^', scanner_name (1, clp$trimmed_string_size (scanner_name)));
            clp$op_add_to_line (str (1, size));
          ELSE
            clp$op_add_to_line ('clc$unspecified_av_scanner');
          IFEND;
          clp$op_add_to_line (']');
        = clc$file_value =
          clp$op_add_to_line ('clc$file_value');
        = clc$name_value =
          clp$op_add_to_line ('clc$name_value, ');
          IF symbolic_parameters [i].value_kind_qualifier_low = NIL THEN
            clp$op_add_to_line ('1, ');
          ELSE
            clp$op_add_to_line (symbolic_parameters [i].value_kind_qualifier_low^);
            clp$op_add_to_line (', ');
          IFEND;
          IF symbolic_parameters [i].value_kind_qualifier_high = NIL THEN
            clp$op_add_to_line ('osc$max_name_size');
          ELSE
            clp$op_add_to_line (symbolic_parameters [i].value_kind_qualifier_high^);
          IFEND;
        = clc$string_value =
          clp$op_add_to_line ('clc$string_value, ');
          IF symbolic_parameters [i].value_kind_qualifier_low = NIL THEN
            clp$op_add_to_line ('0, ');
          ELSE
            clp$op_add_to_line (symbolic_parameters [i].value_kind_qualifier_low^);
            clp$op_add_to_line (', ');
          IFEND;
          IF symbolic_parameters [i].value_kind_qualifier_high = NIL THEN
            clp$op_add_to_line ('osc$max_string_size');
          ELSE
            clp$op_add_to_line (symbolic_parameters [i].value_kind_qualifier_high^);
          IFEND;
        = clc$integer_value =
          clp$op_add_to_line ('clc$integer_value, ');
          IF symbolic_parameters [i].value_kind_qualifier_low = NIL THEN
            clp$op_add_to_line ('clc$min_integer');
          ELSE
            clp$op_add_to_line (symbolic_parameters [i].value_kind_qualifier_low^);
          IFEND;
          clp$op_add_to_line (', ');
          IF symbolic_parameters [i].value_kind_qualifier_high = NIL THEN
            clp$op_add_to_line ('clc$max_integer');
          ELSE
            clp$op_add_to_line (symbolic_parameters [i].value_kind_qualifier_high^);
          IFEND;
        = clc$real_value =
          clp$op_add_to_line ('clc$real_value');
        = clc$boolean_value =
          clp$op_add_to_line ('clc$boolean_value');
        = clc$status_value =
          clp$op_add_to_line ('clc$status_value');
        CASEND;
        IF i = UPPERBOUND (parameters) THEN
          clp$op_add_to_line (']]];');
        ELSE
          clp$op_add_to_line (']],');
        IFEND;
        clp$op_flush_line;
      FOREND;

    PROCEND put_pdt_parameters;
?? TITLE := 'put_pdt_keyword_values', EJECT ??

    PROCEDURE put_pdt_keyword_values
      (    pdt_name: ost$name_reference;
           parameters: array [1 .. * ] of clt$parameter_descriptor);

      VAR
        i: 1 .. clc$max_parameters,
        ignore_status: ost$status,
        int_str: ost$string,
        size: integer,
        k: 1 .. clc$max_keyword_values,
        kv: ^array [1 .. * ] of ost$name,
        str: string (100);


      FOR i := 1 TO UPPERBOUND (parameters) DO
        kv := parameters [i].value_kind_specifier.keyword_values;
        IF kv <> NIL THEN
          clp$op_put_line ('');
          clp$op_put_line ('  VAR');
          clp$op_start_line ('    ');
          clp$convert_integer_to_string (i, 10, FALSE, int_str, ignore_status);
          STRINGREP (str, size, pdt_name, '_kv', int_str.value (1, int_str.size));
          IF size > osc$max_name_size THEN
            osp$set_status_abnormal ('CL', cle$name_too_long, str (1, size), status);
            EXIT generate_old_pdt;
          IFEND;
          clp$op_add_to_line (str (1, size));
          clp$op_add_to_line (': [STATIC, READ, ');
          clp$op_add_to_line ('cls$pdt_names_and_defaults');
          clp$op_add_to_line ('] ');
          clp$op_add_to_line ('array ');
          clp$op_add_to_line ('[1 .. ');
          clp$op_add_integer_to_line (UPPERBOUND (kv^));
          clp$op_add_to_line ('] of ost$name := [');
          FOR k := 1 TO UPPERBOUND (kv^) DO
            STRINGREP (str, size, '''', kv^ [k] (1, clp$trimmed_string_size (kv^ [k])), '''');
            clp$op_add_to_line (str (1, size));
            IF k = UPPERBOUND (kv^) THEN
              clp$op_add_to_line ('];');
            ELSE
              clp$op_add_to_line (',');
            IFEND;
          FOREND;
          clp$op_flush_line;
        IFEND;
      FOREND;

    PROCEND put_pdt_keyword_values;
?? TITLE := 'put_pdt_default_values', EJECT ??

    PROCEDURE put_pdt_default_values
      (    pdt_name: ost$name_reference;
           parameters: array [1 .. * ] of clt$parameter_descriptor);

      VAR
        dv: ^clt$expression_text,
        i: 1 .. clc$max_parameters,
        ignore_status: ost$status,
        int_str: ost$string,
        size: integer,
        string_index: ost$string_index,
        str: string (osc$max_string_size);


      FOR i := 1 TO UPPERBOUND (parameters) DO
        IF parameters [i].required_or_optional.selector = clc$optional_with_default THEN
          dv := parameters [i].required_or_optional.default;
          clp$op_put_line ('');
          clp$op_put_line ('  VAR');
          clp$op_start_line ('    ');
          clp$convert_integer_to_string (i, 10, FALSE, int_str, ignore_status);
          STRINGREP (str, size, pdt_name, '_dv', int_str.value (1, int_str.size));
          IF size > osc$max_name_size THEN
            osp$set_status_abnormal ('CL', cle$name_too_long, str (1, size), status);
            EXIT generate_old_pdt;
          IFEND;
          clp$op_add_to_line (str (1, size));
          clp$op_add_to_line (': [STATIC, READ, ');
          clp$op_add_to_line ('cls$pdt_names_and_defaults');
          clp$op_add_to_line ('] string (');
          clp$op_add_integer_to_line (STRLENGTH (dv^));
          clp$op_add_to_line (') := ');
          IF (clv$op.line_size + 4) > clv$op.page_width THEN
            clp$op_flush_line;
            clp$op_start_line ('      ');
          IFEND;
          clp$op_add_to_line ('''');

          FOR string_index := 1 TO STRLENGTH (dv^) DO
            IF (clv$op.line_size = clv$op.page_width - 1) OR ((dv^ (string_index) = '''') AND
                  (clv$op.line_size + 3 > clv$op.page_width)) THEN
              clp$op_add_to_line ('''');
              clp$op_flush_line;
              clp$op_start_line ('      CAT ''');
            IFEND;

            clp$op_add_to_line (dv^ (string_index));
            IF dv^ (string_index) = '''' THEN
              clp$op_add_to_line ('''');
            IFEND;
          FOREND;

          IF clv$op.line_size >= clv$op.page_width THEN
            clp$op_flush_line;
            clp$op_start_line ('      CAT ''''''');
          IFEND;

          clp$op_add_to_line ('''');
          clp$op_add_to_line (';');
          clp$op_flush_line;
        IFEND;
      FOREND;

    PROCEND put_pdt_default_values;
?? OLDTITLE, EJECT ??

    VAR
      extra_info_area: ^SEQ (REP clc$proc_pdt_info_area_size of cell),
      ignore_status: ost$status,
      message: ost$string,
      parameter_area: ^SEQ (REP clc$max_proc_pdt_parameters of clt$parameter_descriptor),
      parameter_name_area: ^SEQ (REP clc$max_proc_pdt_param_names of clt$parameter_name_descriptor),
      pdt: clt$parameter_descriptor_table,
      pdt_name: ^ost$name_reference,
      proc_name_area: ^SEQ (REP clc$max_proc_names of ost$name),
      proc_names: ^clt$proc_names,
      symbolic_parameter_area: ^SEQ (REP clc$max_proc_pdt_parameters of clt$symbolic_parameter),
      symbolic_parameters: ^clt$symbolic_parameters;


    NEXT proc_name_area IN work_area;
    NEXT parameter_name_area IN work_area;
    NEXT parameter_area IN work_area;
    NEXT symbolic_parameter_area IN work_area;
    NEXT extra_info_area IN work_area;

    clp$internal_generate_old_pdt ('PDT', ^clp$input_procedure, work_area, parse, proc_name_area^,
          parameter_name_area^, parameter_area^, symbolic_parameter_area^, extra_info_area^, proc_names, pdt,
          symbolic_parameters, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;
    PUSH pdt_name: [clp$trimmed_string_size (proc_names^ [1])];
    #TRANSLATE (osv$upper_to_lower, proc_names^ [1], pdt_name^);
    IF pdt.parameters = NIL THEN
      put_pdt_header (pdt_name^, 0);
    ELSE
      put_pdt_header (pdt_name^, UPPERBOUND (pdt.parameters^));
      put_pdt_names (pdt_name^, pdt.names^);
      put_pdt_parameters (pdt_name^, pdt.names^, pdt.parameters^, symbolic_parameters^);
      put_pdt_keyword_values (pdt_name^, pdt.parameters^);
      put_pdt_default_values (pdt_name^, pdt.parameters^);
    IFEND;
    clp$op_put_line ('');
    clp$op_put_line ('?? FMT (FORMAT := ON) ??');
    clp$op_put_line ('?? POP ??');

  PROCEND generate_old_pdt;
?? TITLE := 'generate_type', EJECT ??

  PROCEDURE generate_type
    (VAR symbolic_work_area_segment {input, output} : amt$segment_pointer;
     VAR work_area {input, output} : ^clt$work_area;
     VAR parse {input, output} : clt$parse_state;
     VAR status: ost$status);

    VAR
      end_of_input: boolean,
      name: ost$name,
      type_name: clt$type_name,
      type_specification: ^clt$type_specification;


    clp$scan_non_space_lexical_unit (parse);
    WHILE parse.unit.kind = clc$lex_end_of_line DO
      clp$input_procedure (parse, end_of_input, status);
      IF NOT status.normal THEN
        RETURN;
      IFEND;
      IF end_of_input THEN
        osp$set_status_abnormal ('CL', cle$expecting_type_name, 'end of input', status);
        RETURN;
      IFEND;
      clp$scan_non_space_lexical_unit (parse);
    WHILEND;

    IF parse.unit.kind <> clc$lex_name THEN
      osp$set_status_abnormal ('CL', cle$expecting_type_name, '', status);
      clp$append_status_parse_state (osc$status_parameter_delimiter, parse, status);
      RETURN;
    IFEND;
    #TRANSLATE (osv$lower_to_upper, parse.text^ (parse.unit_index, parse.unit.size), type_name);
    clp$scan_non_space_lexical_unit (parse);
    WHILE parse.unit.kind = clc$lex_end_of_line DO
      clp$input_procedure (parse, end_of_input, status);
      IF NOT status.normal THEN
        RETURN;
      IFEND;
      IF end_of_input THEN
        osp$set_status_abnormal ('CL', cle$expecting_after_type_name, 'end of input', status);
        RETURN;
      IFEND;
      clp$scan_non_space_lexical_unit (parse);
    WHILEND;

    IF (parse.unit.kind <> clc$lex_colon) AND (parse.unit.kind <> clc$lex_equal) THEN
      osp$set_status_abnormal ('CL', cle$expecting_after_type_name, '', status);
      clp$append_status_parse_state (osc$status_parameter_delimiter, parse, status);
      RETURN;
    IFEND;

    clp$scan_non_space_lexical_unit (parse);

    mmp$create_scratch_segment (amc$sequence_pointer, mmc$as_sequential, symbolic_work_area_segment, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;
    RESET symbolic_work_area_segment.sequence_pointer;

    clp$internal_gen_type_spec (type_name, FALSE, ^clp$input_procedure,
          symbolic_work_area_segment.sequence_pointer, work_area, parse, type_specification, status);
    IF NOT status.normal THEN
      RETURN;
    IFEND;

    IF (parse.unit.kind = clc$lex_space) OR (parse.unit.kind = clc$lex_semicolon) THEN
      clp$scan_non_space_lexical_unit (parse);
    IFEND;
    IF parse.unit.kind = clc$lex_end_of_line THEN
      clp$input_procedure (parse, end_of_input, status);
      IF NOT status.normal THEN
        RETURN;
      IFEND;
      IF NOT end_of_input THEN
        clp$scan_non_space_lexical_unit (parse);
      IFEND;
    IFEND;
    IF parse.unit.kind = clc$lex_name THEN
      #TRANSLATE (osv$lower_to_upper, parse.text^ (parse.unit_index, parse.unit.size), name);
    ELSE
      name := '';
    IFEND;
    IF name <> 'TYPEND' THEN
      osp$set_status_abnormal ('CL', cle$expecting_typend, '', status);
      clp$append_status_parse_state (osc$status_parameter_delimiter, parse, status);
      RETURN;
    IFEND;

    clp$op_put_line ('');
    clp$op_put_line ('?? PUSH (LISTEXT := ON) ??');
    clp$op_put_line ('?? FMT (FORMAT := OFF) ??');
    clp$op_put_line ('');
    clp$op_put_line ('  VAR');
    current_indent := initial_indent;
    clp$op_tab_line (current_indent);
    clp$op_add_to_line ('type_specification : [STATIC, READ, cls$declaration_section] record');
    clp$op_flush_line;
    increment_indent;
    RESET type_specification;
    put_type_spec (type_specification);
    current_indent := initial_indent;
    clp$op_tab_line (current_indent);
    clp$op_add_to_line ('recend := [');
    clp$op_flush_line;
    increment_indent;
    clp$op_tab_line (current_indent);
    RESET type_specification;
    put_type_value (type_specification, symbolic_work_area_segment.sequence_pointer);
    clp$op_add_to_line ('];');
    clp$op_flush_line;
    clp$op_put_line ('');
    clp$op_put_line ('?? FMT (FORMAT := ON) ??');
    clp$op_put_line ('?? POP ??');

  PROCEND generate_type;
*IFEND
*copyc cli$input_procedures
*copyc cli$output_procedures
?? TITLE := 'decrement_indent', EJECT ??

  PROCEDURE [INLINE] decrement_indent;


    IF max_indent_exceeded_cnt = 0 THEN
      IF current_indent >= indent_increment + 1 THEN
        current_indent := current_indent - indent_increment;
      IFEND;
    ELSE
      max_indent_exceeded_cnt := max_indent_exceeded_cnt - 1;
    IFEND;

  PROCEND decrement_indent;
?? TITLE := 'increment_indent', EJECT ??

  PROCEDURE [INLINE] increment_indent;


    IF current_indent < max_indent THEN
      current_indent := current_indent + indent_increment;
    ELSE
      max_indent_exceeded_cnt := max_indent_exceeded_cnt + 1;
    IFEND;

  PROCEND increment_indent;
?? TITLE := 'put_integer', EJECT ??

  PROCEDURE [INLINE] put_integer
    (    int: integer);


    IF int = clc$min_integer THEN
      clp$op_add_to_line ('clc$min_integer');
    ELSEIF int = clc$max_integer THEN
      clp$op_add_to_line ('clc$max_integer');
    ELSE
      clp$op_add_integer_to_line (int);
    IFEND;

  PROCEND put_integer;
?? TITLE := 'put_type_spec', EJECT ??

  PROCEDURE put_type_spec
    (VAR type_specification: ^clt$type_specification);

?? NEWTITLE := 'put_application_spec', EJECT ??

    PROCEDURE put_application_spec;

      VAR
        application_qualifier: ^clt$application_type_qualifier;


      NEXT application_qualifier IN type_specification;
      clp$op_tab_line (current_indent);
      clp$op_add_to_line ('qualifier: clt$application_type_qualifier,');
      clp$op_flush_line;

    PROCEND put_application_spec;
?? TITLE := 'put_array_spec', EJECT ??

    PROCEDURE put_array_spec;

      VAR
        array_qualifier: ^clt$array_type_qualifier;


      NEXT array_qualifier IN type_specification;

      clp$op_tab_line (current_indent);
      clp$op_add_to_line ('qualifier: clt$array_type_qualifier,');
      clp$op_flush_line;

      IF array_qualifier^.element_type_specification_size > 0 THEN
        clp$op_tab_line (current_indent);
        clp$op_add_to_line ('element_type_spec: record');
        clp$op_flush_line;
        increment_indent;
        put_type_spec (type_specification);
        decrement_indent;
        clp$op_tab_line (current_indent);
        clp$op_add_to_line ('recend,');
        clp$op_flush_line;
      IFEND;

    PROCEND put_array_spec;
?? TITLE := 'put_date_time_spec', EJECT ??

    PROCEDURE put_date_time_spec;

      VAR
        date_time_qualifier: ^clt$date_time_type_qualifier;


      NEXT date_time_qualifier IN type_specification;

      clp$op_tab_line (current_indent);
      clp$op_add_to_line ('qualifier: clt$date_time_type_qualifier,');
      clp$op_flush_line;

    PROCEND put_date_time_spec;
?? TITLE := 'put_integer_spec', EJECT ??

    PROCEDURE put_integer_spec;

      VAR
        integer_qualifier: ^clt$integer_type_qualifier;


      NEXT integer_qualifier IN type_specification;

      clp$op_tab_line (current_indent);
      clp$op_add_to_line ('qualifier: clt$integer_type_qualifier,');
      clp$op_flush_line;

    PROCEND put_integer_spec;
?? TITLE := 'put_keyword_spec', EJECT ??

    PROCEDURE put_keyword_spec;

      VAR
        index: 1 .. clc$max_keywords,
        keyword_qualifier: ^clt$keyword_type_qualifier,
        keyword_array: ^array [1 .. * ] of clt$keyword_specification,
        number_of_keywords: 1 .. clc$max_keywords;


      NEXT keyword_qualifier IN type_specification;
      number_of_keywords := keyword_qualifier^.number_of_keywords;
      NEXT keyword_array: [1 .. number_of_keywords] IN type_specification;

      clp$op_tab_line (current_indent);
      clp$op_add_to_line ('qualifier: clt$keyword_type_qualifier,');
      clp$op_flush_line;
      clp$op_tab_line (current_indent);
      clp$op_add_to_line ('keyword_specs: array [1 .. ');
      clp$op_add_integer_to_line (number_of_keywords);
      clp$op_add_to_line ('] of clt$keyword_specification,');
      clp$op_flush_line;

    PROCEND put_keyword_spec;
?? TITLE := 'put_list_spec', EJECT ??

    PROCEDURE put_list_spec;

      VAR
        list_qualifier: ^clt$list_type_qualifier_v2;


      NEXT list_qualifier IN type_specification;

      clp$op_tab_line (current_indent);
      clp$op_add_to_line ('qualifier: clt$list_type_qualifier_v2,');
      clp$op_flush_line;

      IF list_qualifier^.element_type_specification_size > 0 THEN
        clp$op_tab_line (current_indent);
        clp$op_add_to_line ('element_type_spec: record');
        clp$op_flush_line;
        increment_indent;
        put_type_spec (type_specification);
        decrement_indent;
        clp$op_tab_line (current_indent);
        clp$op_add_to_line ('recend,');
        clp$op_flush_line;
      IFEND;

    PROCEND put_list_spec;
?? TITLE := 'put_name_spec', EJECT ??

    PROCEDURE put_name_spec;

      VAR
        name_qualifier: ^clt$name_type_qualifier;


      NEXT name_qualifier IN type_specification;

      clp$op_tab_line (current_indent);
      clp$op_add_to_line ('qualifier: clt$name_type_qualifier,');
      clp$op_flush_line;

    PROCEND put_name_spec;
?? TITLE := 'put_range_spec', EJECT ??

    PROCEDURE put_range_spec;

      VAR
        range_qualifier: ^clt$range_type_qualifier;


      NEXT range_qualifier IN type_specification;
      clp$op_tab_line (current_indent);
      clp$op_add_to_line ('qualifier: clt$range_type_qualifier,');
      clp$op_flush_line;

      IF range_qualifier^.element_type_specification_size > 0 THEN
        clp$op_tab_line (current_indent);
        clp$op_add_to_line ('element_type_spec: record');
        clp$op_flush_line;
        increment_indent;
        put_type_spec (type_specification);
        decrement_indent;
        clp$op_tab_line (current_indent);
        clp$op_add_to_line ('recend,');
        clp$op_flush_line;
      IFEND;

    PROCEND put_range_spec;
?? TITLE := 'put_real_spec', EJECT ??

    PROCEDURE put_real_spec;

      VAR
        real_qualifier: ^clt$real_type_qualifier;


      NEXT real_qualifier IN type_specification;

      clp$op_tab_line (current_indent);
      clp$op_add_to_line ('qualifier: clt$real_type_qualifier,');
      clp$op_flush_line;

    PROCEND put_real_spec;
?? TITLE := 'put_record_spec', EJECT ??

    PROCEDURE put_record_spec;

      VAR
        field_spec: ^clt$field_specification,
        index: clt$field_number,
        int_string: ost$string,
        record_qualifier: ^clt$record_type_qualifier,
        type_size: clt$type_specification_size;


      NEXT record_qualifier IN type_specification;
      clp$op_tab_line (current_indent);
      clp$op_add_to_line ('qualifier: clt$record_type_qualifier,');
      clp$op_flush_line;

      FOR index := 1 TO record_qualifier^.number_of_fields DO
        clp$convert_integer_to_string (index, 10, FALSE, int_string, ignore_status);
        NEXT field_spec IN type_specification;
        clp$op_tab_line (current_indent);
        clp$op_add_to_line ('field_spec_');
        clp$op_add_to_line (int_string.value (1, int_string.size));
        clp$op_add_to_line (': clt$field_specification,');
        clp$op_flush_line;
        type_size := field_spec^.type_specification_size;
        clp$op_tab_line (current_indent);
        clp$op_add_to_line ('element_type_spec_');
        clp$op_add_to_line (int_string.value (1, int_string.size));
        clp$op_add_to_line (': record');
        clp$op_flush_line;
        increment_indent;
        put_type_spec (type_specification);
        decrement_indent;
        clp$op_tab_line (current_indent);
        clp$op_add_to_line ('recend,');
        clp$op_flush_line;
      FOREND;

    PROCEND put_record_spec;
?? TITLE := 'put_string_spec', EJECT ??

    PROCEDURE put_string_spec;

      VAR
        string_qualifier: ^clt$string_type_qualifier;


      NEXT string_qualifier IN type_specification;

      clp$op_tab_line (current_indent);
      clp$op_add_to_line ('qualifier: clt$string_type_qualifier,');
      clp$op_flush_line;

    PROCEND put_string_spec;
?? TITLE := 'put_union_spec', EJECT ??

    PROCEDURE put_union_spec;

      VAR
        index: clt$union_member_number,
        int_string: ost$string,
*IF NOT $true(osv$unix)
        union_qualifier: ^clt$union_type_qualifier,
*ELSE
        union_qualifier: ^clt$union_type_qualifier_v2,
*IFEND
        number_of_members: clt$union_member_number,
        type_size: ^clt$type_specification_size;


      NEXT union_qualifier IN type_specification;
      number_of_members := union_qualifier^.number_of_members;
      clp$op_tab_line (current_indent);
*IF NOT $true(osv$unix)
      clp$op_add_to_line ('qualifier: clt$union_type_qualifier,');
*ELSE
      clp$op_add_to_line ('qualifier: clt$union_type_qualifier_v2,');
*IFEND
      clp$op_flush_line;

      FOR index := 1 TO number_of_members DO
        clp$convert_integer_to_string (index, 10, FALSE, int_string, ignore_status);
        NEXT type_size IN type_specification;
        clp$op_tab_line (current_indent);
        clp$op_add_to_line ('type_size_');
        clp$op_add_to_line (int_string.value (1, int_string.size));
        clp$op_add_to_line (': clt$type_specification_size,');
        clp$op_flush_line;
        clp$op_tab_line (current_indent);
        clp$op_add_to_line ('element_type_spec_');
        clp$op_add_to_line (int_string.value (1, int_string.size));
        clp$op_add_to_line (': record');
        clp$op_flush_line;
        increment_indent;
        put_type_spec (type_specification);
        decrement_indent;
        clp$op_tab_line (current_indent);
        clp$op_add_to_line ('recend,');
        clp$op_flush_line;
      FOREND;

    PROCEND put_union_spec;
?? OLDTITLE, EJECT ??

    VAR
      type_header: ^clt$type_specification_header,
      type_name: ^clt$type_name_reference;


    NEXT type_header IN type_specification;

    clp$op_tab_line (current_indent);
    clp$op_add_to_line ('header: clt$type_specification_header,');
    clp$op_flush_line;

    IF type_header^.name_size > 0 THEN
      NEXT type_name: [type_header^.name_size] IN type_specification;
      clp$op_tab_line (current_indent);
      clp$op_add_to_line ('name: string (');
      clp$op_add_integer_to_line (type_header^.name_size);
      clp$op_add_to_line ('),');
      clp$op_flush_line;
    IFEND;

    CASE type_header^.kind OF

    = clc$application_type =
      put_application_spec;

    = clc$array_type =
      put_array_spec;

    = clc$boolean_type =
      ;

    = clc$cobol_name_type =
      ;

    = clc$command_reference_type =
      ;

    = clc$data_name_type =
      ;

    = clc$date_time_type =
      put_date_time_spec;

    = clc$entry_point_reference_type =
      ;

*IF NOT $true(osv$unix)
    = clc$file_type =
*ELSE
    = {clc$file_type} clc$nos_ve_file_type, clc$unix_file_type =
*IFEND
      ;

    = clc$integer_type =
      put_integer_spec;

    = clc$keyword_type =
      put_keyword_spec;

    = clc$list_type =
      put_list_spec;

    = clc$lock_type =
      ;

    = clc$name_type =
      put_name_spec;

    = clc$network_title_type =
      ;

    = clc$program_name_type =
      ;

    = clc$range_type =
      put_range_spec;

    = clc$real_type =
      put_real_spec;

    = clc$record_type =
      put_record_spec;

    = clc$scu_line_identifier_type =
      ;

    = clc$statistic_code_type =
      ;

    = clc$status_type =
      ;

    = clc$status_code_type =
      ;

    = clc$string_type =
      put_string_spec;

    = clc$string_pattern_type =
      ;

    = clc$time_increment_type =
      ;

    = clc$time_zone_type =
      ;

    = clc$type_specification_type =
      ;

    = clc$union_type =
      put_union_spec;

    ELSE
      ;
    CASEND;

  PROCEND put_type_spec;
?? TITLE := 'put_type_value', EJECT ??

  PROCEDURE put_type_value
    (VAR type_specification: ^clt$type_specification;
     VAR symbolic_work_area: ^clt$work_area);

?? NEWTITLE := 'put_application_value', EJECT ??

    PROCEDURE put_application_value;

      VAR
        application_qualifier: ^clt$application_type_qualifier;


      NEXT application_qualifier IN type_specification;
      IF application_qualifier^.balance_brackets THEN
        clp$op_add_to_line (', [TRUE]');
      ELSE
        clp$op_add_to_line (', [FALSE]');
      IFEND;

    PROCEND put_application_value;
?? TITLE := 'put_array_value', EJECT ??

    PROCEDURE put_array_value;

      VAR
        array_qualifier: ^clt$array_type_qualifier,
        lowerbound_text: ^clt$expression_text,
        symbolic_subrange_qualifier: ^clt$symbolic_subrange_qualifier,
        upperbound_text: ^clt$expression_text;


      NEXT array_qualifier IN type_specification;
      NEXT symbolic_subrange_qualifier IN symbolic_work_area;
      NEXT lowerbound_text: [symbolic_subrange_qualifier^.low_text_size] IN symbolic_work_area;
      IF symbolic_subrange_qualifier^.high_text_size = 0 THEN
        upperbound_text := lowerbound_text;
      ELSE
        NEXT upperbound_text: [symbolic_subrange_qualifier^.high_text_size] IN symbolic_work_area;
      IFEND;

      clp$op_add_to_line (', [');
      clp$op_add_integer_to_line (array_qualifier^.element_type_specification_size);
      clp$op_add_to_line (', ');
      IF array_qualifier^.array_bounds_defined THEN
        clp$op_add_to_line ('TRUE, [');
        IF STRLENGTH (lowerbound_text^) > 0 THEN
          clp$op_add_to_line (lowerbound_text^);
        ELSEIF array_qualifier^.bounds.lower = clc$min_array_bound THEN
          clp$op_add_to_line ('clc$min_array_bound');
        ELSEIF array_qualifier^.bounds.lower = clc$max_array_bound THEN
          clp$op_add_to_line ('clc$max_array_bound');
        ELSE
          clp$op_add_integer_to_line (array_qualifier^.bounds.lower);
        IFEND;
        clp$op_add_to_line (', ');
        IF STRLENGTH (upperbound_text^) > 0 THEN
          clp$op_add_to_line (upperbound_text^);
        ELSEIF array_qualifier^.bounds.upper = clc$min_array_bound THEN
          clp$op_add_to_line ('clc$min_array_bound');
        ELSEIF array_qualifier^.bounds.upper = clc$max_array_bound THEN
          clp$op_add_to_line ('clc$max_array_bound');
        ELSE
          clp$op_add_integer_to_line (array_qualifier^.bounds.upper);
        IFEND;
        clp$op_add_to_line (']');
      ELSE
        clp$op_add_to_line ('FALSE');
      IFEND;
      clp$op_add_to_line (']');

      IF array_qualifier^.element_type_specification_size > 0 THEN
        clp$op_add_to_line (',');
        clp$op_flush_line;
        increment_indent;
        clp$op_tab_line (current_indent);
        clp$op_add_to_line ('[');
        put_type_value (type_specification, symbolic_work_area);
        clp$op_add_to_line (']');
        clp$op_flush_line;
        decrement_indent;
        clp$op_tab_line (current_indent);
      IFEND;

    PROCEND put_array_value;
?? TITLE := 'put_clt$longreal', EJECT ??

    PROCEDURE put_clt$longreal
      (    clt_longreal: clt$longreal);

      VAR
*IF $true(osv$unix)
        line: string (osc$max_string_size),
        size: integer,
*IFEND
        str: ost$string;


      clp$convert_real_to_string (clt_longreal.long_real, clc$max_real_number_digits, str, ignore_status);
      clp$op_tab_line (current_indent);
      clp$op_add_to_line ('[{');
      clp$op_add_to_line (str.value (1, str.size));
*IF NOT $true(osv$unix)
      clp$op_add_to_line ('} 3, [[');
      clp$convert_integer_to_string (clt_longreal.breakdown.first.exponent, 16, TRUE, str, ignore_status);
      clp$op_add_to_line (str.value (1, str.size));
      clp$op_add_to_line (', ');
      clp$convert_integer_to_string (clt_longreal.breakdown.first.mantissa, 16, TRUE, str, ignore_status);
      clp$op_add_to_line (str.value (1, str.size));
      clp$op_add_to_line ('], [');
      clp$convert_integer_to_string (clt_longreal.breakdown.second.exponent, 16, TRUE, str, ignore_status);
      clp$op_add_to_line (str.value (1, str.size));
      clp$op_add_to_line (', ');
      clp$convert_integer_to_string (clt_longreal.breakdown.second.mantissa, 16, TRUE, str, ignore_status);
      clp$op_add_to_line (str.value (1, str.size));
      clp$op_add_to_line (']]]');
*ELSE
      clp$op_add_to_line ('} 3, [');
      STRINGREP (line, size, $CHAR ($INTEGER ('0') + clt_longreal.breakdown.sign));
{     clp$op_add_to_line ($CHAR ($INTEGER ('0') + clt_longreal.breakdown.sign));
      clp$op_add_to_line (line (1, size));
      clp$op_add_to_line (', ');
      clp$convert_integer_to_string (clt_longreal.breakdown.exponent, 16, TRUE, str, ignore_status);
      clp$op_add_to_line (str.value (1, str.size));
      clp$op_add_to_line (', ');
      clp$convert_integer_to_string (clt_longreal.breakdown.fraction_1, 16, TRUE, str, ignore_status);
      clp$op_add_to_line (str.value (1, str.size));
      clp$op_add_to_line (', ');
      clp$convert_integer_to_string (clt_longreal.breakdown.fraction_2, 16, TRUE, str, ignore_status);
      clp$op_add_to_line (str.value (1, str.size));
      clp$op_add_to_line (']]');
*IFEND

    PROCEND put_clt$longreal;
?? TITLE := 'put_date_time_value', EJECT ??

    PROCEDURE put_date_time_value;

      VAR
        date_time_qualifier: ^clt$date_time_type_qualifier,
        id_specified: boolean;


      NEXT date_time_qualifier IN type_specification;
      clp$op_add_to_line (', [$clt$date_and_or_time [');
      id_specified := FALSE;

      IF clc$date IN date_time_qualifier^.date_and_or_time THEN
        clp$op_add_to_line ('clc$date');
        id_specified := TRUE;
      IFEND;
      IF clc$time IN date_time_qualifier^.date_and_or_time THEN
        IF id_specified THEN
          clp$op_add_to_line (', ');
        IFEND;
        clp$op_add_to_line ('clc$time');
      IFEND;

      clp$op_add_to_line ('], $clt$date_time_tenses [');

      id_specified := FALSE;
      IF clc$past IN date_time_qualifier^.tenses THEN
        clp$op_add_to_line ('clc$past');
        id_specified := TRUE;
      IFEND;
      IF clc$present IN date_time_qualifier^.tenses THEN
        IF id_specified THEN
          clp$op_add_to_line (', ');
        IFEND;
        id_specified := TRUE;
        clp$op_add_to_line ('clc$present');
      IFEND;
      IF clc$future IN date_time_qualifier^.tenses THEN
        IF id_specified THEN
          clp$op_add_to_line (', ');
        IFEND;
        clp$op_add_to_line ('clc$future');
      IFEND;
      clp$op_add_to_line (']]');

    PROCEND put_date_time_value;
?? TITLE := 'put_integer_value', EJECT ??

    PROCEDURE put_integer_value;

      VAR
        integer_qualifier: ^clt$integer_type_qualifier,
        max_integer_text: ^clt$expression_text,
        min_integer_text: ^clt$expression_text,
        symbolic_subrange_qualifier: ^clt$symbolic_subrange_qualifier;


      NEXT integer_qualifier IN type_specification;
      NEXT symbolic_subrange_qualifier IN symbolic_work_area;
      NEXT min_integer_text: [symbolic_subrange_qualifier^.low_text_size] IN symbolic_work_area;
      IF symbolic_subrange_qualifier^.high_text_size = 0 THEN
        max_integer_text := min_integer_text;
      ELSE
        NEXT max_integer_text: [symbolic_subrange_qualifier^.high_text_size] IN symbolic_work_area;
      IFEND;

      clp$op_add_to_line (', [');
      IF STRLENGTH (min_integer_text^) > 0 THEN
        clp$op_add_to_line (min_integer_text^);
      ELSE
        put_integer (integer_qualifier^.min_integer_value);
      IFEND;
      clp$op_add_to_line (', ');
      IF STRLENGTH (max_integer_text^) > 0 THEN
        clp$op_add_to_line (max_integer_text^);
      ELSE
        put_integer (integer_qualifier^.max_integer_value);
      IFEND;
      clp$op_add_to_line (', ');
      clp$op_add_integer_to_line (integer_qualifier^.default_radix);
      clp$op_add_to_line (']');

    PROCEND put_integer_value;
?? TITLE := 'put_keyword_value', EJECT ??

    PROCEDURE put_keyword_value;

      VAR
        index: 1 .. clc$max_keywords,
        keyword_qualifier: ^clt$keyword_type_qualifier,
        keyword_array: ^array [1 .. * ] of clt$keyword_specification,
        name: ost$name,
        name_size: ost$name_size,
        number_of_keywords: 1 .. clc$max_keywords;


      NEXT keyword_qualifier IN type_specification;
      number_of_keywords := keyword_qualifier^.number_of_keywords;
      clp$op_add_to_line (', [');
      clp$op_add_integer_to_line (number_of_keywords);
      clp$op_add_to_line ('], [');
      clp$op_flush_line;
      clp$op_tab_line (current_indent);

      NEXT keyword_array: [1 .. number_of_keywords] IN type_specification;

      FOR index := 1 TO number_of_keywords DO
        clp$op_add_to_line ('[');
        name := keyword_array^ [index].keyword;
        clp$op_add_to_line ('''');
        clp$op_add_to_line (name);
        clp$op_add_to_line ('''');
        CASE keyword_array^ [index].class OF
        = clc$nominal_entry =
          clp$op_add_to_line (', clc$nominal_entry, ');

        = clc$alias_entry =
          clp$op_add_to_line (', clc$alias_entry, ');

        = clc$abbreviation_entry =
          clp$op_add_to_line (', clc$abbreviation_entry, ');

        CASEND;
        CASE keyword_array^ [index].availability OF
        = clc$normal_usage_entry =
          clp$op_add_to_line ('clc$normal_usage_entry, ');
        = clc$advanced_usage_entry =
          clp$op_add_to_line ('clc$advanced_usage_entry, ');
        = clc$hidden_entry =
          clp$op_add_to_line ('clc$hidden_entry, ');
        CASEND;
        clp$op_add_integer_to_line (keyword_array^ [index].ordinal);
        IF index < number_of_keywords THEN
          clp$op_add_to_line ('],');
          clp$op_flush_line;
          clp$op_tab_line (current_indent);
        ELSE
          clp$op_add_to_line (']]');
        IFEND;

      FOREND;
      clp$op_flush_line;
      clp$op_tab_line (current_indent);

    PROCEND put_keyword_value;
?? TITLE := 'put_list_value', EJECT ??

    PROCEDURE put_list_value;

      VAR
        list_qualifier: ^clt$list_type_qualifier_v2,
        max_list_text: ^clt$expression_text,
        min_list_text: ^clt$expression_text,
        symbolic_subrange_qualifier: ^clt$symbolic_subrange_qualifier;


      NEXT list_qualifier IN type_specification;
      NEXT symbolic_subrange_qualifier IN symbolic_work_area;
      NEXT min_list_text: [symbolic_subrange_qualifier^.low_text_size] IN symbolic_work_area;
      IF symbolic_subrange_qualifier^.high_text_size = 0 THEN
        max_list_text := min_list_text;
      ELSE
        NEXT max_list_text: [symbolic_subrange_qualifier^.high_text_size] IN symbolic_work_area;
      IFEND;

      clp$op_add_to_line (', [');
      clp$op_add_integer_to_line (list_qualifier^.element_type_specification_size);
      clp$op_add_to_line (', ');
      IF STRLENGTH (min_list_text^) > 0 THEN
        clp$op_add_to_line (min_list_text^);
      ELSEIF list_qualifier^.min_list_size = clc$max_list_size THEN
        clp$op_add_to_line ('clc$max_list_size');
      ELSE
        clp$op_add_integer_to_line (list_qualifier^.min_list_size);
      IFEND;
      clp$op_add_to_line (', ');
      IF STRLENGTH (max_list_text^) > 0 THEN
        IF (STRLENGTH (max_list_text^) = 9) AND (max_list_text^ (1, 9) = '$max_list') THEN
          clp$op_add_to_line ('clc$max_list_size');
        ELSE
          clp$op_add_to_line (max_list_text^);
        IFEND;
      ELSEIF list_qualifier^.max_list_size = clc$max_list_size THEN
        clp$op_add_to_line ('clc$max_list_size');
      ELSE
        clp$op_add_integer_to_line (list_qualifier^.max_list_size);
      IFEND;
      clp$op_add_to_line (', ');
      clp$op_add_integer_to_line (list_qualifier^.reserved);
      IF list_qualifier^.defer_expansion THEN
        clp$op_add_to_line (', TRUE');
      ELSE
        clp$op_add_to_line (', FALSE');
      IFEND;
      IF list_qualifier^.list_rest THEN
        clp$op_add_to_line (', TRUE');
      ELSE
        clp$op_add_to_line (', FALSE');
      IFEND;

      clp$op_add_to_line (']');
      IF list_qualifier^.element_type_specification_size > 0 THEN
        clp$op_add_to_line (',');
        clp$op_flush_line;
        increment_indent;
        clp$op_tab_line (current_indent);
        clp$op_add_to_line ('[');
        put_type_value (type_specification, symbolic_work_area);
        clp$op_add_to_line (']');
        clp$op_flush_line;
        decrement_indent;
        clp$op_tab_line (current_indent);
      IFEND;

    PROCEND put_list_value;
?? TITLE := 'put_name_value', EJECT ??

    PROCEDURE put_name_value;

      VAR
        name_qualifier: ^clt$name_type_qualifier,
        max_name_text: ^clt$expression_text,
        min_name_text: ^clt$expression_text,
        symbolic_subrange_qualifier: ^clt$symbolic_subrange_qualifier;


      NEXT name_qualifier IN type_specification;
      NEXT symbolic_subrange_qualifier IN symbolic_work_area;
      NEXT min_name_text: [symbolic_subrange_qualifier^.low_text_size] IN symbolic_work_area;
      IF symbolic_subrange_qualifier^.high_text_size = 0 THEN
        max_name_text := min_name_text;
      ELSE
        NEXT max_name_text: [symbolic_subrange_qualifier^.high_text_size] IN symbolic_work_area;
      IFEND;

      clp$op_add_to_line (', [');
      IF STRLENGTH (min_name_text^) > 0 THEN
        clp$op_add_to_line (min_name_text^);
      ELSEIF name_qualifier^.min_name_size = osc$max_name_size THEN
        clp$op_add_to_line ('osc$max_name_size');
      ELSE
        clp$op_add_integer_to_line (name_qualifier^.min_name_size);
      IFEND;
      clp$op_add_to_line (', ');
      IF STRLENGTH (max_name_text^) > 0 THEN
        clp$op_add_to_line (max_name_text^);
      ELSEIF name_qualifier^.max_name_size = osc$max_name_size THEN
        clp$op_add_to_line ('osc$max_name_size');
      ELSE
        clp$op_add_integer_to_line (name_qualifier^.max_name_size);
      IFEND;
      clp$op_add_to_line (']');

    PROCEND put_name_value;
?? TITLE := 'put_range_value', EJECT ??

    PROCEDURE put_range_value;

      VAR
        range_qualifier: ^clt$range_type_qualifier;


      NEXT range_qualifier IN type_specification;
      clp$op_add_to_line (', [');
      clp$op_add_integer_to_line (range_qualifier^.element_type_specification_size);
      clp$op_add_to_line (']');
      IF range_qualifier^.element_type_specification_size > 0 THEN
        clp$op_add_to_line (',');
        clp$op_flush_line;
        increment_indent;
        clp$op_tab_line (current_indent);
        clp$op_add_to_line ('[');
        put_type_value (type_specification, symbolic_work_area);
        clp$op_add_to_line (']');
        clp$op_flush_line;
        decrement_indent;
        clp$op_tab_line (current_indent);
      IFEND;

    PROCEND put_range_value;
?? TITLE := 'put_real_value', EJECT ??

    PROCEDURE put_real_value;

      VAR
        real_qualifier: ^clt$real_type_qualifier;


      NEXT real_qualifier IN type_specification;
      clp$op_add_to_line (',');
      clp$op_flush_line;
      clp$op_tab_line (current_indent);
      clp$op_add_to_line ('[');
      put_clt$longreal (real_qualifier^.min_real_value);
      clp$op_add_to_line (',');
      clp$op_flush_line;
      clp$op_tab_line (current_indent);
      put_clt$longreal (real_qualifier^.max_real_value);
      clp$op_add_to_line (']');
      clp$op_flush_line;
      clp$op_tab_line (current_indent);

    PROCEND put_real_value;
?? TITLE := 'put_record_value', EJECT ??

    PROCEDURE put_record_value;

      VAR
        field_spec: ^clt$field_specification,
        index: clt$field_number,
        record_qualifier: ^clt$record_type_qualifier;


      NEXT record_qualifier IN type_specification;
      clp$op_add_to_line (', [');
      clp$op_add_integer_to_line (record_qualifier^.number_of_fields);
      clp$op_add_to_line ('],');
      clp$op_flush_line;

      FOR index := 1 TO record_qualifier^.number_of_fields DO
        NEXT field_spec IN type_specification;
        clp$op_tab_line (current_indent);
        clp$op_add_to_line ('[''');
        clp$op_add_to_line (field_spec^.name);

        IF field_spec^.requirement = clc$required_field THEN
          clp$op_add_to_line (''', clc$required_field, ');
        ELSE
          clp$op_add_to_line (''', clc$optional_field, ');
        IFEND;

        clp$op_add_integer_to_line (field_spec^.type_specification_size);
        clp$op_add_to_line ('], [');

        increment_indent;
        put_type_value (type_specification, symbolic_work_area);
        decrement_indent;
        IF index < record_qualifier^.number_of_fields THEN
          clp$op_add_to_line ('],');
        ELSE
          clp$op_add_to_line (']');
        IFEND;
        clp$op_flush_line;
        clp$op_tab_line (current_indent);
      FOREND;

    PROCEND put_record_value;
?? TITLE := 'put_string_value', EJECT ??

    PROCEDURE put_string_value;

      VAR
        string_qualifier: ^clt$string_type_qualifier,
        max_string_text: ^clt$expression_text,
        min_string_text: ^clt$expression_text,
        symbolic_subrange_qualifier: ^clt$symbolic_subrange_qualifier;


      NEXT string_qualifier IN type_specification;
      NEXT symbolic_subrange_qualifier IN symbolic_work_area;
      NEXT min_string_text: [symbolic_subrange_qualifier^.low_text_size] IN symbolic_work_area;
      IF symbolic_subrange_qualifier^.high_text_size = 0 THEN
        max_string_text := min_string_text;
      ELSE
        NEXT max_string_text: [symbolic_subrange_qualifier^.high_text_size] IN symbolic_work_area;
      IFEND;

      clp$op_add_to_line (', [');
      IF STRLENGTH (min_string_text^) > 0 THEN
        clp$op_add_to_line (min_string_text^);
      ELSEIF string_qualifier^.min_string_size = clc$max_string_size THEN
        clp$op_add_to_line ('clc$max_string_size');
      ELSE
        clp$op_add_integer_to_line (string_qualifier^.min_string_size);
      IFEND;
      clp$op_add_to_line (', ');
      IF STRLENGTH (max_string_text^) > 0 THEN
        clp$op_add_to_line (max_string_text^);
      ELSEIF string_qualifier^.max_string_size = clc$max_string_size THEN
        clp$op_add_to_line ('clc$max_string_size');
      ELSE
        clp$op_add_integer_to_line (string_qualifier^.max_string_size);
      IFEND;
      IF string_qualifier^.literal THEN
        clp$op_add_to_line (', TRUE]');
      ELSE
        clp$op_add_to_line (', FALSE]');
      IFEND;

    PROCEND put_string_value;
?? TITLE := 'put_type_kind', EJECT ??

    PROCEDURE [INLINE] put_type_kind
      (    type_kind: clt$type_kind);


*IF NOT $true(osv$unix)
      clp$op_add_to_line (type_kind_names [type_kind] (1, clp$trimmed_string_size
            (type_kind_names [type_kind])));
*ELSE
      VAR
        type_kind_name: ^clt$type_name;


      IF type_kind = clc$file_type THEN
        type_kind_name := ^file_type_kind_name;
      ELSE
        type_kind_name := ^type_kind_names [type_kind];
      IFEND;
      clp$op_add_to_line (type_kind_name^ (1, clp$trimmed_string_size (type_kind_name^)));
*IFEND

    PROCEND put_type_kind;
?? TITLE := 'put_union_value', EJECT ??

    PROCEDURE put_union_value;

      VAR
        i: clt$union_member_number,
*IF NOT $true(osv$unix)
        kinds: clt$type_kinds,
*ELSE
        kinds: clt$type_kinds_v2,
*IFEND
        t: clt$type_kind,
        type_size: ^clt$type_specification_size,
*IF NOT $true(osv$unix)
        union_qualifier: ^clt$union_type_qualifier;
*ELSE
        union_qualifier: ^clt$union_type_qualifier_v2,
        union_qualifier_v1: ^clt$union_type_qualifier;
*IFEND


      NEXT union_qualifier IN type_specification;
      clp$op_add_to_line (', [');
      IF union_qualifier^.number_of_members = 0 THEN
*IF NOT $true(osv$unix)
        clp$op_add_to_line ('-$clt$type_kinds [],');
*ELSE
        clp$op_add_to_line ('-$clt$type_kinds_v2 [],');
*IFEND
      ELSE
        clp$op_add_to_line ('[');
*IF NOT $true(osv$unix)
        kinds := union_qualifier^.kinds;
*ELSE
        IF type_header^.version = 1 THEN
          union_qualifier_v1 := #LOC (union_qualifier^);
          clp$type_kinds_v2 (union_qualifier_v1^.kinds, kinds);
        ELSE
          kinds := union_qualifier^.kinds;
        IFEND;
*IFEND

      /put_kinds/
        FOR t := LOWERVALUE (clt$type_kind) TO UPPERVALUE (clt$type_kind) DO
          IF t IN kinds THEN
            IF (clv$op.line_size + osc$max_name_size + 2) > clv$op.page_width THEN
              clp$op_flush_line;
              clp$op_tab_line (current_indent);
            IFEND;
            put_type_kind (t);
*IF NOT $true(osv$unix)
            kinds := kinds - $clt$type_kinds [t];
            IF kinds = $clt$type_kinds [] THEN
*ELSE
            kinds := kinds - $clt$type_kinds_v2 [t];
            IF kinds = $clt$type_kinds_v2 [] THEN
*IFEND
              clp$op_add_to_line ('],');
              EXIT /put_kinds/;
            IFEND;
            clp$op_add_to_line (', ');
          IFEND;
        FOREND /put_kinds/;
      IFEND;

      clp$op_flush_line;
      clp$op_tab_line (current_indent);
      IF union_qualifier^.only_standard_types_in_union THEN
        clp$op_add_to_line ('TRUE, ');
      ELSE
        clp$op_add_to_line ('FALSE, ');
      IFEND;
      clp$op_add_integer_to_line (union_qualifier^.number_of_members);
      clp$op_add_to_line (']');

      IF union_qualifier^.number_of_members > 0 THEN
        clp$op_add_to_line (',');
        clp$op_flush_line;
        FOR i := 1 TO union_qualifier^.number_of_members DO
          NEXT type_size IN type_specification;
          clp$op_tab_line (current_indent);
          clp$op_add_integer_to_line (type_size^);
          clp$op_add_to_line (', [');
          increment_indent;
          put_type_value (type_specification, symbolic_work_area);
          decrement_indent;
          IF i < union_qualifier^.number_of_members THEN
            clp$op_add_to_line ('],');
          ELSE
            clp$op_add_to_line (']');
          IFEND;
          clp$op_flush_line;
          clp$op_tab_line (current_indent);
        FOREND;
      IFEND;

    PROCEND put_union_value;
?? OLDTITLE, EJECT ??

    VAR
      type_header: ^clt$type_specification_header,
      type_name: ^clt$type_name_reference;


    NEXT type_header IN type_specification;

    clp$op_add_to_line ('[');
*IF NOT $true(osv$unix)
    clp$op_add_integer_to_line (type_header^.version);
*ELSE
    clp$op_add_integer_to_line (clc$declaration_version);
*IFEND
    clp$op_add_to_line (', ');
    clp$op_add_integer_to_line (type_header^.name_size);
    clp$op_add_to_line (', ');
    put_type_kind (type_header^.kind);
    clp$op_add_to_line (']');

    IF type_header^.name_size > 0 THEN
      NEXT type_name: [type_header^.name_size] IN type_specification;
      clp$op_add_to_line (', ''');
      clp$op_add_to_line (type_name^);
      clp$op_add_to_line ('''');
    IFEND;

    CASE type_header^.kind OF
    = clc$application_type =
      put_application_value;

    = clc$array_type =
      put_array_value;

    = clc$boolean_type =
      ;

    = clc$cobol_name_type =
      ;

    = clc$command_reference_type =
      ;

    = clc$data_name_type =
      ;

    = clc$date_time_type =
      put_date_time_value;

    = clc$entry_point_reference_type =
      ;

*IF NOT $true(osv$unix)
    = clc$file_type =
*ELSE
    = {clc$file_type} clc$nos_ve_file_type, clc$unix_file_type =
*IFEND
      ;

    = clc$integer_type =
      put_integer_value;

    = clc$keyword_type =
      put_keyword_value;

    = clc$list_type =
      put_list_value;

    = clc$lock_type =
      ;

    = clc$name_type =
      put_name_value;

    = clc$network_title_type =
      ;

    = clc$program_name_type =
      ;

    = clc$range_type =
      put_range_value;

    = clc$real_type =
      put_real_value;

    = clc$record_type =
      put_record_value;

    = clc$scu_line_identifier_type =
      ;

    = clc$statistic_code_type =
      ;

    = clc$status_type =
      ;

    = clc$status_code_type =
      ;

    = clc$string_type =
      put_string_value;

    = clc$string_pattern_type =
      ;

    = clc$time_increment_type =
      ;

    = clc$time_zone_type =
      ;

    = clc$type_specification_type =
      ;

    = clc$union_type =
      put_union_value;

    ELSE
      clp$op_add_to_line (' UNKNOWN SPECIFICATION TYPE');
    CASEND;

  PROCEND put_type_value;

MODEND clm$generate_pdt;
