?? RIGHT := 110 ??
?? NEWTITLE := 'NOS/VE SCL Interpreter : File Functions' ??
MODULE clm$file_functions;
?? RIGHT := 110 ??

{
{ PURPOSE:
{   This module contains functions related to files.
{

?? NEWTITLE := 'Global Declarations', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc cle$conflicting_options_spec
*copyc cle$work_area_overflow
*copyc clt$data_value
*copyc clt$parameter_list
*copyc clt$work_area
*copyc fse$path_exception_conditions
*copyc fst$goi_object_information
*copyc ost$status
?? POP ??
{experimental code
*copyc clf#make_unspecified_value
*copyc clp$convert_type_desc_to_spec
*copyc clp$make_type_spec_value
{end experimental code

*copyc bap$get_path_string
*copyc clp$build_pattern_for_wild_card
*copyc clp$check_name_for_path_handle
*copyc clp$construct_block_handle_name
*copyc clp$convert_file_ref_to_string
*copyc clp$convert_str_to_path_handle
*copyc clp$convert_string_to_file_ref
*copyc clp$determine_select_result_typ
*copyc clp$evaluate_file_reference
*copyc clp$evaluate_parameters
*copyc clp$find_caller_input_block
*copyc clp$find_command_source
*copyc clp$find_scl_options
*copyc clp$find_working_catalog
*copyc clp$get_expected_type
*copyc clp$get_file_cycles
*copyc clp$get_list_of_$local_files
*copyc clp$make_integer_value
*copyc clp$make_keyword_value
*copyc clp$make_file_value
*copyc clp$make_integer_value
*copyc clp$make_list_value
*copyc clp$make_name_value
*copyc clp$make_string_value
*copyc clp$match_string_pattern
*copyc clp$only_validate_name
*copyc clp$remove_last_path_element
*copyc clp$trimmed_string_size
*copyc clp$wild_card_file_expansion
*copyc clv$open_position_designator
*copyc clv$user_identification
*copyc fsc$local
*copyc fsp$convert_fs_structure_to_pf
*copyc fsp$path_element
*copyc mmp$create_segment
*copyc mmp$delete_segment
*copyc osp$append_status_file
*copyc osp$append_status_integer
*copyc osp$set_status_abnormal
*copyc osp$set_status_condition
*copyc osv$lower_to_upper
*copyc pfp$find_directory_array
*copyc pfp$find_next_info_record
*copyc pfp$get_multi_item_info

?? NEWTITLE := '[xdcl, #gate] CLP$$EXPECTED_RESULT_TYPE', EJECT ??

{NOTE: An experimental function. Not yet in production.

  PROCEDURE [XDCL, #GATE] clp$$expected_result_type
    (    parameter_list: clt$parameter_list;
     VAR work_area {input, output} : ^clt$work_area;
     VAR result: ^clt$data_value;
     VAR status: ost$status);

{ FUNCTION $expected_result_type

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
    recend := [
    [1,
    [104, 1, 14, 10, 20, 36, 4],
    clc$function, 0, 0, 0, 0, 0, 0, 0, '']];

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

    VAR
      block: ^clt$block,
      expected_type: ^clt$type_specification,
      in_current_task: boolean;

?? NEWTITLE := '[inline] CLP$FIND_CALLER_FUNCTION_BLOCK', EJECT ??

    PROCEDURE [INLINE] clp$find_caller_function_block
      (VAR block: ^clt$block);

      clp$find_current_block (block);

      WHILE (block <> NIL) AND (block^.kind <> clc$function_block) DO
        IF block^.kind = clc$task_block THEN
          IF NOT block^.synchronous_with_parent THEN
            IF block^.command_file = osc$null_name THEN
              block := NIL;
            IFEND;
            RETURN;
          IFEND;
        IFEND;
        block := block^.previous_block;
      WHILEND;
      IF block <> NIL THEN
        block := block^.previous_block;
      IFEND;

      WHILE block <> NIL DO
        IF block^.kind = clc$function_block THEN
          RETURN;
        IFEND;
        block := block^.previous_block;
      WHILEND;

    PROCEND clp$find_caller_function_block;
?? OLDTITLE ??
?? EJECT ??

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

      clp$find_caller_function_block (block);
      IF block = NIL THEN
        result := clf#make_unspecified_value (work_area);
      ELSE
        clp$convert_type_desc_to_spec (block^.expected_function_type, work_area, expected_type, status);
        IF NOT status.normal THEN
          RETURN; {----->
        IFEND;

        clp$make_type_spec_value (expected_type, work_area, result);
      IFEND;

    PROCEND clp$$expected_result_type;
?? OLDTITLE ??
{End experimental code
?? TITLE := 'clp$$catalog_contents', EJECT ??

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

{ FUNCTION (osm$$catc) $catalog_contents (
{   catalog: file = $working_catalog
{   options: list rest of key
{       (include_catalogs, include_catalog, ic)
{       (include_files, include_file, if)
{       (names, name, n)
{       (paths, path, p)
{     keyend = include_catalogs include_files names
{   )

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 2] of clt$pdt_parameter_name,
      parameters: array [1 .. 2] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
        default_value: string (16),
      recend,
      type2: record
        header: clt$type_specification_header,
        qualifier: clt$list_type_qualifier_v2,
        element_type_spec: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 12] of clt$keyword_specification,
        recend,
        default_value: string (36),
      recend,
    recend := [
    [1,
    [90, 4, 3, 13, 57, 6, 188],
    clc$function, 2, 2, 0, 0, 0, 0, 0, 'OSM$$CATC'], [
    ['CATALOG                        ',clc$nominal_entry, 1],
    ['OPTIONS                        ',clc$nominal_entry, 2]],
    [
{ PARAMETER 1
    [1, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 3,
  clc$optional_default_parameter, 0, 16],
{ PARAMETER 2
    [2, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 467,
  clc$optional_default_parameter, 0, 36]],
{ PARAMETER 1
    [[1, 0, clc$file_type],
    '$working_catalog'],
{ PARAMETER 2
    [[1, 0, clc$list_type], [451, 1, clc$max_list_size, 0, FALSE, TRUE],
      [[1, 0, clc$keyword_type], [12], [
      ['IC                             ', clc$abbreviation_entry, clc$normal_usage_entry, 1],
      ['IF                             ', clc$abbreviation_entry, clc$normal_usage_entry, 2],
      ['INCLUDE_CATALOG                ', clc$alias_entry, clc$normal_usage_entry, 1],
      ['INCLUDE_CATALOGS               ', clc$nominal_entry, clc$normal_usage_entry, 1],
      ['INCLUDE_FILE                   ', clc$alias_entry, clc$normal_usage_entry, 2],
      ['INCLUDE_FILES                  ', clc$nominal_entry, clc$normal_usage_entry, 2],
      ['N                              ', clc$abbreviation_entry, clc$normal_usage_entry, 3],
      ['NAME                           ', clc$alias_entry, clc$normal_usage_entry, 3],
      ['NAMES                          ', clc$nominal_entry, clc$normal_usage_entry, 3],
      ['P                              ', clc$abbreviation_entry, clc$normal_usage_entry, 4],
      ['PATH                           ', clc$alias_entry, clc$normal_usage_entry, 4],
      ['PATHS                          ', clc$nominal_entry, clc$normal_usage_entry, 4]]
      ]
    ,
    'include_catalogs include_files names']];

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

    CONST
      p$catalog = 1,
      p$options = 2;

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

    VAR
      catalog_info_selections: pft$catalog_info_selections,
      directory: pft$p_directory_array,
      display_names: boolean,
      display_paths: boolean,
      evaluated_file_reference: fst$evaluated_file_reference,
      file_info_selections: pft$file_info_selections,
      first_path_element_is_$local: boolean,
      group: pft$group,
      include_file_info: boolean,
      include_catalog_info: boolean,
      info: pft$p_info,
      info_record: pft$p_info_record,
      info_segment_pointer: mmt$segment_pointer,
      local_status: ost$status,
      options: ^clt$data_value,
      pf_path: ^pft$path;

?? NEWTITLE := 'make_catalog_contents_list', EJECT ??

    PROCEDURE [INLINE] make_catalog_contents_list;

      VAR
        index: pft$array_index,
        name_size: 0 .. osc$max_name_size,
        node: ^clt$data_value,
        size: fst$path_size,
        str: fst$path;


      IF display_paths THEN
        clp$convert_file_ref_to_string (evaluated_file_reference, FALSE, str, size, status);
        IF NOT status.normal THEN
          RETURN; {----->
        IFEND;
      IFEND;

    /make/
      BEGIN
        clp$make_list_value (work_area, result);
        IF result = NIL THEN
          EXIT /make/; {----->
        IFEND;

        node := result;
        FOR index := LOWERBOUND (directory^) TO UPPERBOUND (directory^) DO
          IF display_paths THEN
            name_size := clp$trimmed_string_size (directory^ [index].name);
            str (size + 1) := '.';
            str (size + 2, name_size) := directory^ [index].name;
            clp$make_file_value (str (1, size + name_size + 1), work_area, node^.element_value);
          ELSE
            clp$make_name_value (directory^ [index].name, work_area, node^.element_value);
          IFEND;
          IF node^.element_value = NIL THEN
            EXIT /make/; {----->
          IFEND;
          IF index < UPPERBOUND (directory^) THEN
            clp$make_list_value (work_area, node^.link);
            IF node^.link = NIL THEN
              EXIT /make/; {----->
            IFEND;
            node := node^.link;
          IFEND;
        FOREND;
        RETURN; {----->
      END /make/;

      osp$set_status_abnormal ('CL', cle$work_area_overflow, '', status);

    PROCEND make_catalog_contents_list;
?? OLDTITLE, EJECT ??

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

    clp$evaluate_file_reference (pvt [p$catalog].value^.file_value^, $clt$file_ref_parsing_options [], FALSE,
          evaluated_file_reference, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;

    IF evaluated_file_reference.cycle_reference.specification <> fsc$cycle_omitted THEN
      osp$set_status_abnormal ('CL', fse$catalogs_do_not_have_cycles, pvt [p$catalog].value^.file_value^,
            status);
      RETURN; {----->
    IFEND;

    IF evaluated_file_reference.path_handle_info.path_handle.open_position.specified THEN
      osp$set_status_abnormal ('CL', cle$file_position_not_allowed, '', status);
      RETURN; {----->
    IFEND;

    first_path_element_is_$local := fsp$path_element (^evaluated_file_reference, 1) ^ = fsc$local;

    IF first_path_element_is_$local AND (evaluated_file_reference.number_of_path_elements > 1) THEN
      osp$set_status_abnormal ('CL', cle$not_permitted_on_loc_file, pvt [p$catalog].value^.file_value^,
            status);
      RETURN; {----->
    IFEND;

    info_segment_pointer.kind := mmc$sequence_pointer;
    info_segment_pointer.seq_pointer := NIL;

    include_catalog_info := FALSE;
    include_file_info := FALSE;
    display_names := FALSE;
    display_paths := FALSE;
    options := pvt [p$options].value;

    WHILE options <> NIL DO
      IF (options^.element_value^.keyword_value (1, 9) = 'INCLUDE_C') OR
            (options^.element_value^.keyword_value = 'IC') THEN
        include_catalog_info := TRUE;
      ELSEIF options^.element_value^.keyword_value (1) = 'I' THEN
        include_file_info := TRUE;
      ELSEIF options^.element_value^.keyword_value (1) = 'N' THEN
        display_names := TRUE;
      ELSE
        display_paths := TRUE;
      IFEND;
      options := options^.link;
    WHILEND;

    IF display_names AND display_paths THEN
      osp$set_status_abnormal ('CL', cle$conflicting_options_spec, '$CATALOG_CONTENTS', status);
      RETURN; {----->
    ELSEIF (NOT display_names) AND (NOT display_paths) THEN
      display_names := TRUE;
    IFEND;
    IF (NOT include_catalog_info) AND (NOT include_file_info) THEN
      include_catalog_info := TRUE;
      include_file_info := TRUE;
    IFEND;

  /main/
    BEGIN

      mmp$create_segment (NIL, mmc$sequence_pointer, 1, info_segment_pointer, status);
      IF NOT status.normal THEN
        EXIT /main/; {----->
      IFEND;

      info := info_segment_pointer.seq_pointer;
      RESET info;

      IF first_path_element_is_$local THEN
        IF include_catalog_info AND NOT include_file_info THEN
          make_empty_list (work_area, result, status);
          EXIT /main/; {----->
        IFEND;
        clp$get_list_of_$local_files (info, status);
      ELSE
        PUSH pf_path: [1 .. evaluated_file_reference.number_of_path_elements];
        fsp$convert_fs_structure_to_pf (evaluated_file_reference, pf_path);

        group.group_type := pfc$member;
        group.member_description.family := osc$null_name;
        group.member_description.account := osc$null_name;
        group.member_description.project := osc$null_name;
        group.member_description.user := osc$null_name;

        catalog_info_selections := $pft$catalog_info_selections [];
        file_info_selections := $pft$file_info_selections [];
        IF include_catalog_info THEN
          catalog_info_selections := $pft$catalog_info_selections [pfc$catalog_directory];
        IFEND;
        IF include_file_info THEN
          file_info_selections := $pft$file_info_selections [pfc$file_directory];
        IFEND;

        pfp$get_multi_item_info (pf_path^, group, catalog_info_selections, file_info_selections, info,
              status);
        IF NOT status.normal THEN
          IF status.condition = pfe$unknown_last_subcatalog THEN
            status.normal := TRUE;
            make_empty_list (work_area, result, status);
          IFEND;
          EXIT /main/; {----->
        IFEND;
      IFEND;

      RESET info;

      pfp$find_next_info_record (info, info_record, status);
      IF NOT status.normal THEN
        EXIT /main/; {----->
      IFEND;
      pfp$find_directory_array (info_record, directory, status);
      IF NOT status.normal THEN
        EXIT /main/; {----->
      IFEND;
      IF directory = NIL THEN
        make_empty_list (work_area, result, status);
        EXIT /main/; {----->
      IFEND;

      make_catalog_contents_list;
    END /main/;

    mmp$delete_segment (info_segment_pointer, 1, local_status);
    IF status.normal AND (NOT local_status.normal) THEN
      status := local_status;
    IFEND;

  PROCEND clp$$catalog_contents;
?? TITLE := 'find_$command', EJECT ??

  PROCEDURE find_$command
    (    command_flavor: amt$local_file_name;
     VAR work_area {input, output} : ^clt$work_area;
     VAR result: ^clt$data_value;
     VAR status: ost$status);

    CONST
      command_path_element_length = 10; {:$COMMAND.}

    VAR
      block: ^clt$block,
      block_handle: clt$block_handle,
      block_handle_name: fst$path_handle_name,
      ignore_block_in_current_task: boolean,
      path: string (command_path_element_length + osc$max_name_size);


    clp$find_caller_input_block (command_flavor, block, ignore_block_in_current_task);
    IF (block <> NIL) AND (block^.input.kind = clc$file_input) THEN
      block_handle.segment_offset := #OFFSET (block);
      block_handle.assignment_counter := block^.assignment_counter;
      path := ':$COMMAND.';
      clp$construct_block_handle_name (block_handle, block_handle_name);
      path (command_path_element_length + 1, * ) := block_handle_name
            (1, clp$trimmed_string_size (block_handle_name));
    ELSE
      path := ':$LOCAL.$NULL';
    IFEND;

    clp$make_file_value (path (1, clp$trimmed_string_size (path)), work_area, result);
    IF result = NIL THEN
      osp$set_status_abnormal ('CL', cle$work_area_overflow, '', status);
    IFEND;

  PROCEND find_$command;
?? TITLE := 'find_command_source', EJECT ??

  PROCEDURE [INLINE] find_command_source
    (    command_source_flavor: amt$local_file_name;
     VAR source: fst$path;
     VAR source_size: fst$path_size;
     VAR kind: clt$data_kind;
     VAR status: ost$status);

    VAR
      block: ^clt$block,
      path_handle: clt$path_handle;


    clp$find_command_source (command_source_flavor, block);
    IF block = NIL THEN
      osp$set_status_abnormal ('CL', cle$unable_to_find_cmnd_source, '', status);
      RETURN; {----->
    IFEND;

    CASE block^.source.kind OF
    = clc$system_commands =
      source := '$SYSTEM';
      source_size := 7;
      kind := clc$name;
    = clc$sub_commands =
      source := block^.source.utility_name;
      source_size := clp$trimmed_string_size (source);
      kind := clc$name;
    = clc$catalog_commands, clc$library_commands =
      clp$check_name_for_path_handle (block^.source.local_file_name, path_handle);
      bap$get_path_string (path_handle.regular_handle, source, source_size, status);
      IF NOT status.normal THEN
        RETURN; {----->
      IFEND;
      kind := clc$file;
    CASEND;

  PROCEND find_command_source;
?? TITLE := 'clp$$command', EJECT ??

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

{ FUNCTION (osm$command) $command

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
    recend := [
    [1,
    [90, 4, 3, 13, 57, 16, 96],
    clc$function, 0, 0, 0, 0, 0, 0, 0, 'OSM$COMMAND']];

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

    VAR
      command_flavor: amt$local_file_name;


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

    command_flavor := '$COMMAND';
    find_$command (command_flavor, work_area, result, status);

  PROCEND clp$$command;
?? TITLE := 'clp$$command_of_caller', EJECT ??

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

{ FUNCTION (osm$$comoc) $command_of_caller

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
    recend := [
    [1,
    [90, 4, 3, 13, 57, 25, 59],
    clc$function, 0, 0, 0, 0, 0, 0, 0, 'OSM$$COMOC']];

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

    VAR
      command_flavor: amt$local_file_name;


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

    command_flavor := '$COMMAND_OF_CALLER';
    find_$command (command_flavor, work_area, result, status);

  PROCEND clp$$command_of_caller;
?? TITLE := 'clp$$command_source', EJECT ??

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

{ FUNCTION (osm$command_source) $command_source

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
    recend := [
    [1,
    [90, 4, 3, 13, 57, 33, 190],
    clc$function, 0, 0, 0, 0, 0, 0, 0, 'OSM$COMMAND_SOURCE']];

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

    VAR
      command_source_flavor: amt$local_file_name,
      ignore_kind: clt$data_kind,
      source: fst$path,
      source_size: fst$path_size;


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

    command_source_flavor := '$SOURCE';
    find_command_source (command_source_flavor, source, source_size, ignore_kind, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;

    clp$make_string_value (source (1, source_size), work_area, result);
    IF result = NIL THEN
      osp$set_status_abnormal ('CL', cle$work_area_overflow, '', status);
    IFEND;

  PROCEND clp$$command_source;
?? TITLE := 'clp$$family', EJECT ??

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

{ FUNCTION (osm$family) $family

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
    recend := [
    [1,
    [90, 4, 3, 13, 57, 40, 494],
    clc$function, 0, 0, 0, 0, 0, 0, 0, 'OSM$FAMILY']];

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

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

    clp$make_value (clc$file, work_area, result);
    IF result = NIL THEN
      osp$set_status_abnormal ('CL', cle$work_area_overflow, '', status);
    IFEND;
    NEXT result^.file_value: [1 + clv$user_identification.family.size] IN work_area;
    IF result^.file_value = NIL THEN
      osp$set_status_abnormal ('CL', cle$work_area_overflow, '', status);
    IFEND;

    result^.file_value^ (1) := ':';
    result^.file_value^ (2, * ) := clv$user_identification.family.
          value (1, clv$user_identification.family.size);

  PROCEND clp$$family;
?? TITLE := 'clp$$file_cycles', EJECT ??

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

{ FUNCTION (osm$$file_cycles) $file_cycles (
{   file: file = $required
{   option: key
{       (cycles, cycle, c)
{       (paths, path, p)
{     keyend = cycles
{   )

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 2] of clt$pdt_parameter_name,
      parameters: array [1 .. 2] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
      recend,
      type2: record
        header: clt$type_specification_header,
        qualifier: clt$keyword_type_qualifier,
        keyword_specs: array [1 .. 6] of clt$keyword_specification,
        default_value: string (6),
      recend,
    recend := [
    [1,
    [90, 4, 3, 13, 57, 53, 423],
    clc$function, 2, 2, 1, 0, 0, 0, 0, 'OSM$$FILE_CYCLES'], [
    ['FILE                           ',clc$nominal_entry, 1],
    ['OPTION                         ',clc$nominal_entry, 2]],
    [
{ PARAMETER 1
    [1, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 3, clc$required_parameter, 0
  , 0],
{ PARAMETER 2
    [2, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 229,
  clc$optional_default_parameter, 0, 6]],
{ PARAMETER 1
    [[1, 0, clc$file_type]],
{ PARAMETER 2
    [[1, 0, clc$keyword_type], [6], [
    ['C                              ', clc$abbreviation_entry, clc$normal_usage_entry, 1],
    ['CYCLE                          ', clc$alias_entry, clc$normal_usage_entry, 1],
    ['CYCLES                         ', clc$nominal_entry, clc$normal_usage_entry, 1],
    ['P                              ', clc$abbreviation_entry, clc$normal_usage_entry, 2],
    ['PATH                           ', clc$alias_entry, clc$normal_usage_entry, 2],
    ['PATHS                          ', clc$nominal_entry, clc$normal_usage_entry, 2]]
    ,
    'cycles']];

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

    CONST
      p$file = 1,
      p$option = 2;

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

    VAR
      cycle_array: ^array [1 .. * ] of fst$cycle_number,
      display_paths: boolean,
      evaluated_file_reference: fst$evaluated_file_reference,
      file_value: fst$path,
      ignore_path_handle_name: fst$path_handle_name;

?? NEWTITLE := 'make_file_cycles_list', EJECT ??

    PROCEDURE [INLINE] make_file_cycles_list;

      VAR
        index: fst$cycle_number,
        node: ^clt$data_value,
        size: fst$path_size,
        str: fst$path;


    /make/
      BEGIN
        clp$make_list_value (work_area, result);
        IF result = NIL THEN
          EXIT /make/; {----->
        IFEND;

        node := result;
        FOR index := 1 TO UPPERBOUND (cycle_array^) DO
          IF display_paths THEN
            evaluated_file_reference.cycle_reference.cycle_number := cycle_array^ [index];
            clp$convert_file_ref_to_string (evaluated_file_reference, FALSE, str, size, status);
            IF NOT status.normal THEN
              RETURN; {----->
            IFEND;
            clp$make_file_value (str (1, size), work_area, node^.element_value);
          ELSE
            clp$make_integer_value (cycle_array^ [index], 10, FALSE, work_area, node^.element_value);
          IFEND;
          IF node^.element_value = NIL THEN
            EXIT /make/; {----->
          IFEND;
          IF index < UPPERBOUND (cycle_array^) THEN
            clp$make_list_value (work_area, node^.link);
            IF node^.link = NIL THEN
              EXIT /make/; {----->
            IFEND;
            node := node^.link;
          IFEND;
        FOREND;
        RETURN; {----->
      END /make/;

      osp$set_status_abnormal ('CL', cle$work_area_overflow, '', status);

    PROCEND make_file_cycles_list;
?? OLDTITLE, EJECT ??

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

    IF pvt [p$file].value^.file_value^ = ':$LOCAL' THEN
      osp$set_status_abnormal ('CL', pfe$name_not_permanent_file, pvt [p$file].value^.file_value^, status);
      RETURN; {----->
    IFEND;

    file_value := pvt [p$file].value^.file_value^;

    clp$convert_str_to_path_handle (file_value, TRUE, TRUE, FALSE, ignore_path_handle_name,
          evaluated_file_reference, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;

    IF evaluated_file_reference.path_resolution = fsc$catalog_path THEN
      osp$set_status_abnormal ('CL', pfe$name_not_permanent_file, pvt [p$file].value^.file_value^, status);
      RETURN; {----->
    IFEND;

    display_paths := pvt [p$option].value^.keyword_value (1) = 'P';

    clp$get_file_cycles (file_value, work_area, cycle_array, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;
    IF cycle_array = NIL THEN
      make_empty_list (work_area, result, status);
    ELSE
      sort_cycles (cycle_array);
      make_file_cycles_list;
    IFEND;

  PROCEND clp$$file_cycles;
?? TITLE := 'sort_cycles', EJECT ??

  PROCEDURE sort_cycles
    (    cycle_array: ^array [1 .. * ] of fst$cycle_number);

    VAR
      gap: integer,
      start: integer,
      current: integer,
      swap: fst$cycle_number;

{ Use shell sort technique.

    gap := UPPERBOUND (cycle_array^);
    WHILE gap > 1 DO
      gap := 2 * (gap DIV 4) + 1;
      FOR start := 1 TO UPPERBOUND (cycle_array^) - gap DO
        current := start;
        WHILE (current > 0) AND (cycle_array^ [current] < cycle_array^ [current + gap]) DO
          swap := cycle_array^ [current];
          cycle_array^ [current] := cycle_array^ [current + gap];
          cycle_array^ [current + gap] := swap;
          current := current - gap;
        WHILEND;
      FOREND;
    WHILEND;

  PROCEND sort_cycles;
?? TITLE := 'clp$$fname', EJECT ??

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

{ FUNCTION (osm$$fname) $fname (
{   source: any of
{       string
{       list of any of
{         key
{           none, $low, $high, $next, $asis, $boi, $bop, $eoi
{         keyend
{         integer
{         name
{       anyend
{     anyend = $required
{   )

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 1] of clt$pdt_parameter_name,
      parameters: array [1 .. 1] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$string_type_qualifier,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
          qualifier: clt$list_type_qualifier_v2,
          element_type_spec: record
            header: clt$type_specification_header,
            qualifier: clt$union_type_qualifier,
            type_size_1: clt$type_specification_size,
            element_type_spec_1: record
              header: clt$type_specification_header,
              qualifier: clt$keyword_type_qualifier,
              keyword_specs: array [1 .. 8] of clt$keyword_specification,
            recend,
            type_size_2: clt$type_specification_size,
            element_type_spec_2: record
              header: clt$type_specification_header,
              qualifier: clt$integer_type_qualifier,
            recend,
            type_size_3: clt$type_specification_size,
            element_type_spec_3: record
              header: clt$type_specification_header,
              qualifier: clt$name_type_qualifier,
            recend,
          recend,
        recend,
      recend,
    recend := [
    [1,
    [90, 4, 3, 14, 57, 0, 564],
    clc$function, 1, 1, 1, 0, 0, 0, 0, 'OSM$$FNAME'], [
    ['SOURCE                         ',clc$nominal_entry, 1]],
    [
{ PARAMETER 1
    [1, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 396,
  clc$required_parameter, 0, 0]],
{ PARAMETER 1
    [[1, 0, clc$union_type], [[clc$list_type, clc$string_type],
    FALSE, 2],
    8, [[1, 0, clc$string_type], [0, clc$max_string_size, FALSE]],
    368, [[1, 0, clc$list_type], [352, 1, clc$max_list_size, 0, FALSE, FALSE],
        [[1, 0, clc$union_type], [[clc$integer_type, clc$keyword_type, clc$name_type],
        FALSE, 3],
        303, [[1, 0, clc$keyword_type], [8], [
          ['$ASIS                          ', clc$nominal_entry, clc$normal_usage_entry, 5],
          ['$BOI                           ', clc$nominal_entry, clc$normal_usage_entry, 6],
          ['$BOP                           ', clc$nominal_entry, clc$normal_usage_entry, 7],
          ['$EOI                           ', clc$nominal_entry, clc$normal_usage_entry, 8],
          ['$HIGH                          ', clc$nominal_entry, clc$normal_usage_entry, 3],
          ['$LOW                           ', clc$nominal_entry, clc$normal_usage_entry, 2],
          ['$NEXT                          ', clc$nominal_entry, clc$normal_usage_entry, 4],
          ['NONE                           ', clc$nominal_entry, clc$normal_usage_entry, 1]]
          ],
        20, [[1, 0, clc$integer_type], [clc$min_integer, clc$max_integer, 10]],
        5, [[1, 0, clc$name_type], [1, osc$max_name_size]]
        ]
      ]
    ]];

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

    CONST
      p$source = 1;

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

    VAR
      cycle_string: ^ost$string,
      element: ^string (fsc$max_path_element_size),
      element_size: clt$string_size,
      node: ^clt$data_value,
      parsed_file_reference: fst$parsed_file_reference,
      source_size: clt$string_size,
      source: ^clt$string_value;


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

    IF pvt [p$source].value^.kind = clc$string THEN
      source := pvt [p$source].value^.string_value;
    ELSE
      cycle_string := NIL;
      PUSH source: [fsc$max_path_size];
      source_size := 0;
      node := pvt [p$source].value;
      WHILE node <> NIL DO
        CASE node^.element_value^.kind OF
        = clc$keyword =
          IF node^.element_value^.keyword_value = 'NONE' THEN
            element := NIL;
            element_size := 0;
          ELSE
            element := ^node^.element_value^.keyword_value;
            element_size := clp$trimmed_string_size (element^);
          IFEND;
        = clc$integer =
          IF cycle_string = NIL THEN
            PUSH cycle_string;
          IFEND;
          clp$convert_integer_to_string (node^.element_value^.integer_value.value, 10, FALSE, cycle_string^,
                status);
          IF NOT status.normal THEN
            RETURN; {----->
          IFEND;
          element := ^cycle_string^.value;
          element_size := cycle_string^.size;
        ELSE {clc$name}
          element := ^node^.element_value^.name_value;
          element_size := clp$trimmed_string_size (element^);
        CASEND;
        IF element_size > 0 THEN
          IF (source_size + 1 + element_size) > fsc$max_path_size THEN
            osp$set_status_condition (cle$file_reference_too_long, status);
            RETURN; {----->
          IFEND;
          IF source_size = 0 THEN
            source^ (1) := ':';
          ELSE
            source^ (source_size + 1) := '.';
          IFEND;
          source^ (source_size + 2, element_size) := element^ (1, element_size);
          source_size := source_size + 1 + element_size;
        IFEND;
        node := node^.link;
      WHILEND;
      source := ^source^ (1, source_size);
    IFEND;

    clp$convert_string_to_file_ref (source^, parsed_file_reference, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;

    clp$make_file_value (parsed_file_reference.path (1, parsed_file_reference.complete_path_size), work_area,
          result);
    IF result = NIL THEN
      osp$set_status_abnormal ('CL', cle$work_area_overflow, '', status);
    IFEND;

  PROCEND clp$$fname;
?? TITLE := 'clp$$local', EJECT ??

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

{ FUNCTION (osm$local) $local

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
    recend := [
    [1,
    [90, 4, 3, 13, 59, 11, 921],
    clc$function, 0, 0, 0, 0, 0, 0, 0, 'OSM$LOCAL']];

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

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

    clp$make_file_value (':$LOCAL', work_area, result);
    IF result = NIL THEN
      osp$set_status_abnormal ('CL', cle$work_area_overflow, '', status);
    IFEND;

  PROCEND clp$$local;
?? TITLE := 'clp$$path', EJECT ??

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

{ FUNCTION (osm$$path) $path (
{   path: file = $required
{   keyword: key
{       (catalog, c)
{       (last, l)
{       count
{     keyend = $required
{   )

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 2] of clt$pdt_parameter_name,
      parameters: array [1 .. 2] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
      recend,
      type2: record
        header: clt$type_specification_header,
        qualifier: clt$keyword_type_qualifier,
        keyword_specs: array [1 .. 5] of clt$keyword_specification,
      recend,
    recend := [
    [1,
    [104, 1, 9, 11, 2, 38, 48],
    clc$function, 2, 2, 2, 0, 0, 0, 0, 'OSM$$PATH'], [
    ['KEYWORD                        ',clc$nominal_entry, 2],
    ['PATH                           ',clc$nominal_entry, 1]],
    [
{ PARAMETER 1
    [2, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 3, clc$required_parameter, 0
  , 0],
{ PARAMETER 2
    [1, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 192,
  clc$required_parameter, 0, 0]],
{ PARAMETER 1
    [[1, 0, clc$file_type]],
{ PARAMETER 2
    [[1, 0, clc$keyword_type], [5], [
    ['C                              ', clc$abbreviation_entry, clc$normal_usage_entry, 1],
    ['CATALOG                        ', clc$nominal_entry, clc$normal_usage_entry, 1],
    ['COUNT                          ', clc$nominal_entry, clc$normal_usage_entry, 3],
    ['L                              ', clc$abbreviation_entry, clc$normal_usage_entry, 2],
    ['LAST                           ', clc$nominal_entry, clc$normal_usage_entry, 2]]
    ]];

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

    CONST
      p$path = 1,
      p$keyword = 2;

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

    VAR
      parsed_file_reference: fst$parsed_file_reference;


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

    clp$convert_string_to_file_ref (pvt [p$path].value^.file_value^, parsed_file_reference, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;

    IF pvt [p$keyword].value^.keyword_value = 'CATALOG' THEN
      clp$make_string_value (parsed_file_reference.path (1, parsed_file_reference.catalog_path_size),
            work_area, result);

    ELSEIF pvt [p$keyword].value^.keyword_value = 'COUNT' THEN
        clp$make_integer_value (parsed_file_reference.number_of_path_elements, 10, FALSE, work_area, result);

    ELSE {LAST}
      clp$make_string_value (parsed_file_reference.path (parsed_file_reference.last_name.index,
            parsed_file_reference.last_name.size), work_area, result);

    IFEND;

    IF result = NIL THEN
      osp$set_status_abnormal ('CL', cle$work_area_overflow, '', status);
    IFEND;

  PROCEND clp$$path;
?? TITLE := 'clp$$path_elements', EJECT ??

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

{ FUNCTION (osm$$path_elements) $path_elements (
{   file: file = $required
{   options: list rest of key
{       (names, name, n)
{       (cycle_reference, cr)
{       (open_position, op)
{     keyend = names
{   )

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 2] of clt$pdt_parameter_name,
      parameters: array [1 .. 2] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
      recend,
      type2: record
        header: clt$type_specification_header,
        qualifier: clt$list_type_qualifier_v2,
        element_type_spec: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 7] of clt$keyword_specification,
        recend,
        default_value: string (5),
      recend,
    recend := [
    [1,
    [90, 4, 3, 14, 13, 46, 749],
    clc$function, 2, 2, 1, 0, 0, 0, 0, 'OSM$$PATH_ELEMENTS'], [
    ['FILE                           ',clc$nominal_entry, 1],
    ['OPTIONS                        ',clc$nominal_entry, 2]],
    [
{ PARAMETER 1
    [1, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 3, clc$required_parameter, 0
  , 0],
{ PARAMETER 2
    [2, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 282,
  clc$optional_default_parameter, 0, 5]],
{ PARAMETER 1
    [[1, 0, clc$file_type]],
{ PARAMETER 2
    [[1, 0, clc$list_type], [266, 1, clc$max_list_size, 0, FALSE, TRUE],
      [[1, 0, clc$keyword_type], [7], [
      ['CR                             ', clc$abbreviation_entry, clc$normal_usage_entry, 2],
      ['CYCLE_REFERENCE                ', clc$nominal_entry, clc$normal_usage_entry, 2],
      ['N                              ', clc$abbreviation_entry, clc$normal_usage_entry, 1],
      ['NAME                           ', clc$alias_entry, clc$normal_usage_entry, 1],
      ['NAMES                          ', clc$nominal_entry, clc$normal_usage_entry, 1],
      ['OP                             ', clc$abbreviation_entry, clc$normal_usage_entry, 3],
      ['OPEN_POSITION                  ', clc$nominal_entry, clc$normal_usage_entry, 3]]
      ]
    ,
    'names']];

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

    CONST
      p$file = 1,
      p$options = 2;

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

    VAR
      evaluated_file_reference: fst$evaluated_file_reference,
      i: fst$number_of_path_elements,
      include_cycle_reference: boolean,
      include_names: boolean,
      include_open_position: boolean,
      keyword: clt$keyword,
      node: ^^clt$data_value,
      option_node: ^clt$data_value;


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

    include_cycle_reference := FALSE;
    include_names := FALSE;
    include_open_position := FALSE;
    option_node := pvt [p$options].value;
    WHILE option_node <> NIL DO
      IF option_node^.element_value^.keyword_value = 'CYCLE_REFERENCE' THEN
        include_cycle_reference := TRUE;
      ELSEIF option_node^.element_value^.keyword_value = 'OPEN_POSITION' THEN
        include_open_position := TRUE;
      ELSE {NAMES}
        include_names := TRUE;
      IFEND;
      option_node := option_node^.link;
    WHILEND;

    clp$evaluate_file_reference (pvt [p$file].value^.file_value^,
          $clt$file_ref_parsing_options [clc$command_file_ref_allowed], FALSE, evaluated_file_reference,
          status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;

    node := ^result;

    IF include_names THEN
      FOR i := 1 TO evaluated_file_reference.number_of_path_elements DO
        clp$make_list_value (work_area, node^);
        clp$make_name_value (fsp$path_element (^evaluated_file_reference, i) ^, work_area,
              node^^.element_value);
        node := ^node^^.link;
      FOREND;
    IFEND;

    IF include_cycle_reference THEN
      clp$make_list_value (work_area, node^);

    /make_cycle_reference_element/
      BEGIN
        CASE evaluated_file_reference.cycle_reference.specification OF
        = fsc$cycle_number =
          clp$make_integer_value (evaluated_file_reference.cycle_reference.cycle_number, 10, FALSE, work_area,
                node^^.element_value);
          EXIT /make_cycle_reference_element/; {----->
        = fsc$low_cycle =
          keyword := '$LOW';
        = fsc$high_cycle =
          keyword := '$HIGH';
        = fsc$next_cycle =
          keyword := '$NEXT';
        ELSE {fsc$cycle_omitted}
          keyword := 'NONE';
        CASEND;
        clp$make_keyword_value (keyword, work_area, node^^.element_value);
      END /make_cycle_reference_element/;

      node := ^node^^.link;
    IFEND;

    IF include_open_position THEN
      clp$make_list_value (work_area, node^);
      IF evaluated_file_reference.path_handle_info.path_handle.open_position.specified THEN
        keyword := clv$open_position_designator [evaluated_file_reference.path_handle_info.path_handle.
              open_position.value].value;
      ELSE
        keyword := 'NONE';
      IFEND;
      clp$make_keyword_value (keyword, work_area, node^^.element_value);
    IFEND;

  PROCEND clp$$path_elements;
?? TITLE := 'clp$$select_wild_card_files', EJECT ??

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

{ FUNCTION (osm$$selwcf) $select_wild_card_files, $select_wild_card_file, $select_file, $select_files (
{   candidates: list 0..clc$max_list_size of file = $required
{   pattern: (wild_card_file) application = $required
{   )

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 2] of clt$pdt_parameter_name,
      parameters: array [1 .. 2] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
        qualifier: clt$list_type_qualifier_v2,
        element_type_spec: record
          header: clt$type_specification_header,
        recend,
      recend,
      type2: record
        header: clt$type_specification_header,
        name: string (14),
        qualifier: clt$application_type_qualifier,
      recend,
    recend := [
    [1,
    [90, 4, 3, 13, 59, 52, 260],
    clc$function, 2, 2, 2, 0, 0, 0, 0, 'OSM$$SELWCF'], [
    ['CANDIDATES                     ',clc$nominal_entry, 1],
    ['PATTERN                        ',clc$nominal_entry, 2]],
    [
{ PARAMETER 1
    [1, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 19, clc$required_parameter,
  0, 0],
{ PARAMETER 2
    [2, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 18, clc$required_parameter,
  0, 0]],
{ PARAMETER 1
    [[1, 0, clc$list_type], [3, 0, clc$max_list_size, 0, FALSE, FALSE],
      [[1, 0, clc$file_type]]
    ],
{ PARAMETER 2
    [[1, 14, clc$application_type], 'WILD_CARD_FILE', [FALSE]]];

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

    CONST
      p$candidates = 1,
      p$pattern = 2;

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

    VAR
      candidate: ^fst$file_reference,
      index: clt$list_size,
      match_info: clt$string_pattern_match_info,
      node: ^clt$data_value,
      pattern_path: fst$path,
      pattern_path_size: fst$path_size,
      result_node: ^^clt$data_value,
      return_selected_indices: boolean,
      scl_options: ^clt$scl_options,
      string_pattern: ^clt$string_pattern;


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

    IF (pvt [p$candidates].value^.element_value = NIL) AND (pvt [p$candidates].value^.link = NIL) THEN
      result := pvt [p$candidates].value;
      RETURN; {----->
    IFEND;

    clp$determine_select_result_typ (work_area, return_selected_indices, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;

    #TRANSLATE (osv$lower_to_upper, pvt [p$pattern].value^.application_value^, pattern_path);
    pattern_path_size := clp$trimmed_string_size (pattern_path);
    clp$find_scl_options (scl_options);

    clp$build_pattern_for_wild_card (scl_options^.wild_card_pattern_type,
          $clt$string_pattern_build_opts [clc$sp_match_at_right, clc$sp_ignore_matched_substring],
          pattern_path (1, pattern_path_size), work_area, string_pattern, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;

    index := 0;
    result := NIL;
    node := pvt [p$candidates].value;
    result_node := ^result;
    WHILE node <> NIL DO
      candidate := node^.element_value^.file_value;

      clp$match_string_pattern (candidate^ (1, clp$trimmed_string_size (candidate^)), string_pattern,
            clc$sp_anchored, clc$sp_quick_scan, match_info, status);
      IF NOT status.normal THEN
        RETURN; {----->
      IFEND;

      index := index + 1;
      IF match_info.result = clc$sp_success THEN
        IF return_selected_indices THEN
          clp$make_integer_value (index, 10, FALSE, work_area, node^.element_value);
        IFEND;
        result_node^ := node;
        result_node := ^node^.link;
      IFEND;
      node := node^.link;
    WHILEND;

    IF result <> NIL THEN
      result_node^ := NIL;
      result^.generated_via_list_rest := FALSE;
    ELSE
      clp$make_list_value (work_area, result);
      IF result = NIL THEN
        osp$set_status_abnormal ('CL', cle$work_area_overflow, '', status);
      IFEND;
    IFEND;

  PROCEND clp$$select_wild_card_files;
?? TITLE := 'clp$$source', EJECT ??

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

{  FUNCTION (osm$source) $source

?? PUSH (LISTEXT := ON) ??

    VAR
      pdt: [STATIC, READ, cls$declaration_section] record
        header: clt$pdt_header,
      recend := [[1, [87, 12, 9, 9, 43, 32, 948], clc$function, 0, 0, 0, 0, 0, 0, 0, 'OSM$SOURCE']];

?? POP ??

    VAR
      command_source_flavor: amt$local_file_name,
      kind: clt$data_kind,
      source: fst$path,
      source_size: fst$path_size;


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

    command_source_flavor := '$SOURCE';
    find_command_source (command_source_flavor, source, source_size, kind, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;

    CASE kind OF
    = clc$name =
      clp$make_name_value (source (1, source_size), work_area, result);
    = clc$file =
      clp$make_file_value (source (1, source_size), work_area, result);
    CASEND;
    IF result = NIL THEN
      osp$set_status_abnormal ('CL', cle$work_area_overflow, '', status);
    IFEND;

  PROCEND clp$$source;
?? TITLE := 'clp$$source_of_caller', EJECT ??

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

{  FUNCTION (osm$source_of_caller) $source_of_caller

?? PUSH (LISTEXT := ON) ??

    VAR
      pdt: [STATIC, READ, cls$declaration_section] record
        header: clt$pdt_header,
      recend := [[1, [87, 12, 9, 9, 43, 32, 948], clc$function, 0, 0, 0, 0, 0, 0, 0, 'OSM$SOURCE_OF_CALLER']];

?? POP ??

    VAR
      command_source_flavor: amt$local_file_name,
      kind: clt$data_kind,
      source: fst$path,
      source_size: fst$path_size;


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

    command_source_flavor := '$SOURCE_OF_CALLER';
    find_command_source (command_source_flavor, source, source_size, kind, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;

    CASE kind OF
    = clc$name =
      clp$make_name_value (source (1, source_size), work_area, result);
    = clc$file =
      clp$make_file_value (source (1, source_size), work_area, result);
    CASEND;
    IF result = NIL THEN
      osp$set_status_abnormal ('CL', cle$work_area_overflow, '', status);
    IFEND;

  PROCEND clp$$source_of_caller;
?? TITLE := 'clp$$substitute_path_elements', EJECT ??

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

{ FUNCTION (osm$spe) $substitute_path_elements (
{   source_path: file = $required
{   substitution_path: file = $required
{   substitute_path_element_count: integer 1..fsc$max_path_elements = $required
{   )

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 3] of clt$pdt_parameter_name,
      parameters: array [1 .. 3] 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,
      recend,
    recend := [
    [1,
    [101, 7, 4, 13, 57, 56, 53],
    clc$function, 3, 3, 3, 0, 0, 0, 0, 'OSM$SPE'], [
    ['SOURCE_PATH                    ',clc$nominal_entry, 1],
    ['SUBSTITUTE_PATH_ELEMENT_COUNT  ',clc$nominal_entry, 3],
    ['SUBSTITUTION_PATH              ',clc$nominal_entry, 2]],
    [
{ PARAMETER 1
    [1, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 3, clc$required_parameter, 0
  , 0],
{ PARAMETER 2
    [3, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 3, clc$required_parameter, 0
  , 0],
{ PARAMETER 3
    [2, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 20, clc$required_parameter,
  0, 0]],
{ PARAMETER 1
    [[1, 0, clc$file_type]],
{ PARAMETER 2
    [[1, 0, clc$file_type]],
{ PARAMETER 3
    [[1, 0, clc$integer_type], [1, fsc$max_path_elements, 10]]];

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

    CONST
      p$source_path = 1,
      p$substitution_path = 2,
      p$substitute_path_element_count = 3;

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

    VAR
      count: integer,
      i: integer,
      path: fst$path,
      path_element_p: ^fst$path_element_string,
      path_size: fst$path_size,
      source_file_reference: fst$evaluated_file_reference,
      substitute_path_element_count: integer,
      substituted_file_reference: fst$evaluated_file_reference,
      substitution_file_reference: fst$evaluated_file_reference;

?? NEWTITLE := 'append_element', EJECT ??

    PROCEDURE [INLINE] append_element
      (    size: fst$path_element_size;
           name: fst$path_element_string;
       VAR file_reference: fst$evaluated_file_reference);

      IF (file_reference.path_structure_size + 1 + size > fsc$max_path_size)
{   } OR (file_reference.number_of_path_elements + 1 > fsc$max_path_elements) THEN

        osp$set_status_condition (cle$file_reference_too_long, status);
        EXIT clp$$substitute_path_elements; {----->
      IFEND;

      file_reference.path_structure (file_reference.path_structure_size + 1) := $CHAR (size);
      file_reference.path_structure (file_reference.path_structure_size + 2, size) := name;
      file_reference.path_structure_size := file_reference.path_structure_size + 1 + size;
      file_reference.number_of_path_elements := file_reference.number_of_path_elements + 1;

    PROCEND append_element;
?? OLDTITLE ??
?? EJECT ??

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

    result := NIL;
    clp$evaluate_file_reference (pvt [p$source_path].value^.file_value^,
          $clt$file_ref_parsing_options [clc$command_file_ref_allowed], FALSE, source_file_reference, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;

    clp$evaluate_file_reference (pvt [p$substitution_path].value^.file_value^,
          $clt$file_ref_parsing_options [clc$command_file_ref_allowed], FALSE, substitution_file_reference,
          status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;

    substitute_path_element_count := pvt [p$substitute_path_element_count].value^.integer_value.value;
    IF (substitute_path_element_count > source_file_reference.number_of_path_elements) THEN
      osp$set_status_abnormal ('CL', fse$path_substitute_cnt_too_big, '', status);
      osp$append_status_integer (osc$status_parameter_delimiter, substitute_path_element_count, 10, FALSE
            {=exclude radix} , status);
      osp$append_status_integer (osc$status_parameter_delimiter,
            source_file_reference.number_of_path_elements, 10, FALSE {=exclude radix} , status);
      osp$append_status_file (osc$status_parameter_delimiter, pvt [p$source_path].value^.file_value^, status);
      RETURN; {----->
    IFEND;

    substituted_file_reference.path_structure := substitution_file_reference.path_structure;
    substituted_file_reference.path_structure_size := substitution_file_reference.path_structure_size;
    substituted_file_reference.number_of_path_elements := substitution_file_reference.number_of_path_elements;
    substituted_file_reference.multiple_reference_specified := FALSE;

    i := $INTEGER (source_file_reference.path_structure (1)) + 2;
    count := 1;
    WHILE i < source_file_reference.path_structure_size DO
      count := count + 1;
      IF count > substitute_path_element_count THEN
        path_element_p := ^source_file_reference.path_structure
              (i + 1, $INTEGER (source_file_reference.path_structure (i)));
        append_element (STRLENGTH (path_element_p^), path_element_p^, substituted_file_reference);
      IFEND;
      i := i + $INTEGER (source_file_reference.path_structure (i)) + 1;
    WHILEND;

    substituted_file_reference.cycle_reference := source_file_reference.cycle_reference;
    substituted_file_reference.path_handle_info := source_file_reference.path_handle_info;
    substituted_file_reference.path_resolution := fsc$cycle_path;

    clp$convert_file_ref_to_string (substituted_file_reference, FALSE, path, path_size, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;

    clp$make_file_value (path (1, path_size), work_area, result);
    IF result = NIL THEN
      osp$set_status_abnormal ('CL', cle$work_area_overflow, '', status);
    IFEND;

  PROCEND clp$$substitute_path_elements;
?? TITLE := 'clp$$up', EJECT ??

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

{ FUNCTION (osm$up) $up (
{   path: file = $WORKING_CATALOG
{   )

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 1] of clt$pdt_parameter_name,
      parameters: array [1 .. 1] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
        default_value: string (16),
      recend,
    recend := [
    [1,
    [90, 4, 3, 14, 0, 9, 636],
    clc$function, 1, 1, 0, 0, 0, 0, 0, 'OSM$UP'], [
    ['PATH                           ',clc$nominal_entry, 1]],
    [
{ PARAMETER 1
    [1, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 3,
  clc$optional_default_parameter, 0, 16]],
{ PARAMETER 1
    [[1, 0, clc$file_type],
    '$WORKING_CATALOG']];

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

    CONST
      p$path = 1;

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

    VAR
      evaluated_file_reference: fst$evaluated_file_reference,
      path: fst$path,
      path_size: fst$path_size;


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

    clp$evaluate_file_reference (pvt [p$path].value^.file_value^,
          $clt$file_ref_parsing_options [clc$command_file_ref_allowed], FALSE, evaluated_file_reference,
          status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;

    clp$remove_last_path_element (evaluated_file_reference, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;

    evaluated_file_reference.cycle_reference.specification := fsc$cycle_omitted;
    clp$convert_file_ref_to_string (evaluated_file_reference, FALSE, path, path_size, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;

    clp$make_file_value (path (1, path_size), work_area, result);
    IF result = NIL THEN
      osp$set_status_abnormal ('CL', cle$work_area_overflow, '', status);
    IFEND;

  PROCEND clp$$up;
?? TITLE := 'clp$$user', EJECT ??

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

{ FUNCTION (osm$user) $user

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
    recend := [
    [1,
    [90, 4, 3, 14, 0, 18, 122],
    clc$function, 0, 0, 0, 0, 0, 0, 0, 'OSM$USER']];

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

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

    clp$make_value (clc$file, work_area, result);
    IF result = NIL THEN
      osp$set_status_abnormal ('CL', cle$work_area_overflow, '', status);
    IFEND;
    NEXT result^.file_value: [2 + clv$user_identification.family.size + clv$user_identification.user.size] IN
          work_area;
    IF result^.file_value = NIL THEN
      osp$set_status_abnormal ('CL', cle$work_area_overflow, '', status);
    IFEND;

    result^.file_value^ (1) := ':';
    result^.file_value^ (2, * ) := clv$user_identification.family.
          value (1, clv$user_identification.family.size);
    result^.file_value^ (2 + clv$user_identification.family.size) := '.';
    result^.file_value^ (3 + clv$user_identification.family.size, * ) :=
          clv$user_identification.user.value (1, clv$user_identification.user.size);

  PROCEND clp$$user;
?? TITLE := 'clp$$vsn_list', EJECT ??

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

{ FUNCTION (osm$$vsnl) $vsn_list (
{   starting_vsn: any of
{       string 1..6
{       name 1..6
{     anyend = $required
{   vsn_count: integer 1..11881376 = $required
{   increment_scheme: key
{       (alphabetic, a)
{       (decimal, d)
{     keyend = decimal
{   )

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 3] of clt$pdt_parameter_name,
      parameters: array [1 .. 3] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
        qualifier: clt$union_type_qualifier,
        type_size_1: clt$type_specification_size,
        element_type_spec_1: record
          header: clt$type_specification_header,
          qualifier: clt$string_type_qualifier,
        recend,
        type_size_2: clt$type_specification_size,
        element_type_spec_2: record
          header: clt$type_specification_header,
          qualifier: clt$name_type_qualifier,
        recend,
      recend,
      type2: record
        header: clt$type_specification_header,
        qualifier: clt$integer_type_qualifier,
      recend,
      type3: record
        header: clt$type_specification_header,
        qualifier: clt$keyword_type_qualifier,
        keyword_specs: array [1 .. 4] of clt$keyword_specification,
        default_value: string (7),
      recend,
    recend := [
    [1,
    [104, 1, 13, 15, 12, 2, 677],
    clc$function, 3, 3, 2, 0, 0, 0, 0, 'OSM$$VSNL'], [
    ['INCREMENT_SCHEME               ',clc$nominal_entry, 3],
    ['STARTING_VSN                   ',clc$nominal_entry, 1],
    ['VSN_COUNT                      ',clc$nominal_entry, 2]],
    [
{ PARAMETER 1
    [2, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 33, clc$required_parameter,
  0, 0],
{ PARAMETER 2
    [3, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 20, clc$required_parameter,
  0, 0],
{ PARAMETER 3
    [1, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 155,
  clc$optional_default_parameter, 0, 7]],
{ PARAMETER 1
    [[1, 0, clc$union_type], [[clc$name_type, clc$string_type],
    TRUE, 2],
    8, [[1, 0, clc$string_type], [1, 6, FALSE]],
    5, [[1, 0, clc$name_type], [1, 6]]
    ],
{ PARAMETER 2
    [[1, 0, clc$integer_type], [1, 11881376, 10]],
{ PARAMETER 3
    [[1, 0, clc$keyword_type], [4], [
    ['A                              ', clc$abbreviation_entry, clc$normal_usage_entry, 1],
    ['ALPHABETIC                     ', clc$nominal_entry, clc$normal_usage_entry, 1],
    ['D                              ', clc$abbreviation_entry, clc$normal_usage_entry, 2],
    ['DECIMAL                        ', clc$nominal_entry, clc$normal_usage_entry, 2]]
    ,
    'decimal']];

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

    CONST
      p$starting_vsn = 1,
      p$vsn_count = 2,
      p$increment_scheme = 3;

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

    CONST
      max_vsn_size = 6;

    VAR
      element_header_p: ^clt$type_specification_header,
      element_type_specification: ^clt$type_specification,
      expected_type_specification: ^clt$type_specification,
      list_type_qualifier_p: ^clt$list_type_qualifier_v2,
      local_work_area: ^clt$work_area,
      max_char: char,
      min_char: char,
      node: ^clt$data_value,
      result_type_name: boolean,
      type_header_p: ^clt$type_specification_header,
      vsn_count: integer,
      vsn_index: integer,
      vsn_size: 0 .. max_vsn_size,
      work_char_location: 0 .. max_vsn_size,
      work_vsn: string (max_vsn_size);

?? NEWTITLE := 'f$valid_name', EJECT ??

    FUNCTION f$valid_name
      (    name: string ( * <= max_vsn_size)): boolean;

      VAR
        valid: boolean;

      clp$only_validate_name (name, valid);
      f$valid_name := valid;

    FUNCEND f$valid_name;
?? OLDTITLE ??
?? EJECT ??

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

    local_work_area := work_area;
    clp$get_expected_type (local_work_area, expected_type_specification, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;

{Determine if we should output a list of name instead of a list of string
    result_type_name := FALSE;
    IF expected_type_specification <> NIL THEN
      RESET expected_type_specification;
      NEXT type_header_p IN expected_type_specification;
      IF (type_header_p <> NIL) AND (type_header_p^.kind = clc$list_type) THEN
        NEXT list_type_qualifier_p IN expected_type_specification;
        NEXT element_type_specification: [[REP list_type_qualifier_p^.element_type_specification_size OF
              cell]] IN expected_type_specification;

        IF element_type_specification <> NIL THEN
          RESET element_type_specification;
          NEXT element_header_p IN element_type_specification;

          result_type_name := (element_header_p <> NIL) AND (element_header_p^.kind = clc$name_type);
        IFEND;
      IFEND;
    IFEND;
    work_area := local_work_area;

    IF pvt [p$increment_scheme].value^.keyword_value (1) = 'D' THEN
      min_char := '0';
      max_char := '9';
    ELSE
      min_char := 'A';
      max_char := 'Z';
    IFEND;

    IF pvt [p$starting_vsn].value^.kind = clc$name THEN
      work_vsn := pvt [p$starting_vsn].value^.name_value;
    ELSE
      #TRANSLATE (osv$lower_to_upper, pvt [p$starting_vsn].value^.string_value^, work_vsn);
    IFEND;

    vsn_size := clp$trimmed_string_size (work_vsn);
    vsn_count := pvt [p$vsn_count].value^.integer_value.value;
    work_char_location := vsn_size;

    clp$make_list_value (work_area, result);
    IF result = NIL THEN
      osp$set_status_abnormal ('CL', cle$work_area_overflow, '', status);
      RETURN; {----->
    IFEND;
    node := result;

    IF (work_vsn (work_char_location) < min_char) OR (work_vsn (work_char_location) > max_char) THEN

{ Return empty list.

      RETURN; {----->
    IFEND;

  /make_vsn_list/
    FOR vsn_index := 1 TO vsn_count DO
      IF NOT result_type_name THEN
        clp$make_string_value (work_vsn (1, vsn_size), work_area, node^.element_value);

      ELSEIF f$valid_name (work_vsn (1, vsn_size)) THEN
        clp$make_name_value (work_vsn (1, vsn_size), work_area, node^.element_value);

      ELSE
        clp$make_string_value (work_vsn (1, vsn_size), work_area, node^.element_value);
      IFEND;

      IF node^.element_value = NIL THEN
        osp$set_status_abnormal ('CL', cle$work_area_overflow, '', status);
        EXIT /make_vsn_list/; {----->
      IFEND;

      WHILE work_vsn (work_char_location) = max_char DO
        work_vsn (work_char_location) := min_char;
        work_char_location := work_char_location - 1;
        IF (work_char_location <= 0) OR (work_vsn (work_char_location) < min_char) OR
              (work_vsn (work_char_location) > max_char) THEN
          EXIT /make_vsn_list/; {----->
        IFEND;
      WHILEND;

      work_vsn (work_char_location) := $CHAR ($INTEGER (work_vsn (work_char_location)) + 1);
      work_char_location := vsn_size;

      IF vsn_index < vsn_count THEN
        clp$make_list_value (work_area, node^.link);
        IF node^.link = NIL THEN
          osp$set_status_abnormal ('CL', cle$work_area_overflow, '', status);
          EXIT /make_vsn_list/; {----->
        IFEND;
        node := node^.link;
      IFEND;
    FOREND /make_vsn_list/;

  PROCEND clp$$vsn_list;
?? TITLE := 'clp$$wild_card_files', EJECT ??

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

{ FUNCTION (osm$$wcf) $wild_card_files, $wild_card_file, $wcf (
{   files: (wild_card_file) application = $required
{   options: list rest of key
{       (include_catalogs, ic)
{       (include_files, if)
{     keyend = include_catalogs include_files
{   )

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 2] of clt$pdt_parameter_name,
      parameters: array [1 .. 2] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
        name: string (14),
        qualifier: clt$application_type_qualifier,
      recend,
      type2: record
        header: clt$type_specification_header,
        qualifier: clt$list_type_qualifier_v2,
        element_type_spec: record
          header: clt$type_specification_header,
          qualifier: clt$keyword_type_qualifier,
          keyword_specs: array [1 .. 4] of clt$keyword_specification,
        recend,
        default_value: string (30),
      recend,
    recend := [
    [1,
    [90, 4, 3, 14, 0, 47, 751],
    clc$function, 2, 2, 1, 0, 0, 0, 0, 'OSM$$WCF'], [
    ['FILES                          ',clc$nominal_entry, 1],
    ['OPTIONS                        ',clc$nominal_entry, 2]],
    [
{ PARAMETER 1
    [1, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 18, clc$required_parameter,
  0, 0],
{ PARAMETER 2
    [2, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation, clc$standard_parameter_checking, 171,
  clc$optional_default_parameter, 0, 30]],
{ PARAMETER 1
    [[1, 14, clc$application_type], 'WILD_CARD_FILE', [FALSE]],
{ PARAMETER 2
    [[1, 0, clc$list_type], [155, 1, clc$max_list_size, 0, FALSE, TRUE],
      [[1, 0, clc$keyword_type], [4], [
      ['IC                             ', clc$abbreviation_entry, clc$normal_usage_entry, 1],
      ['IF                             ', clc$abbreviation_entry, clc$normal_usage_entry, 2],
      ['INCLUDE_CATALOGS               ', clc$nominal_entry, clc$normal_usage_entry, 1],
      ['INCLUDE_FILES                  ', clc$nominal_entry, clc$normal_usage_entry, 2]]
      ]
    ,
    'include_catalogs include_files']];

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

    CONST
      p$files = 1,
      p$options = 2;

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

    VAR
      evaluated_file_reference: fst$evaluated_file_reference,
      expansion_option: clt$wc_file_expansion_option,
      include_catalogs: boolean,
      include_files: boolean,
      ignore_tail: ^clt$data_value,
      option_node: ^clt$data_value;


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

    clp$evaluate_file_reference (pvt [p$files].value^.application_value^,
          $clt$file_ref_parsing_options [clc$multiple_reference_allowed], FALSE, evaluated_file_reference,
          status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;

    include_catalogs := FALSE;
    include_files := FALSE;
    option_node := pvt [p$options].value;
    WHILE option_node <> NIL DO
      IF option_node^.element_value^.keyword_value = 'INCLUDE_CATALOGS' THEN
        include_catalogs := TRUE;
      ELSE { INCLUDE_FILES }
        include_files := TRUE;
      IFEND;
      option_node := option_node^.link;
    WHILEND;

    IF include_catalogs THEN
      IF include_files THEN
        expansion_option := clc$wcfe_files_and_catalogs;
      ELSE
        expansion_option := clc$wcfe_only_catalogs;
      IFEND;
    ELSE
      expansion_option := clc$wcfe_only_files;
    IFEND;

    clp$wild_card_file_expansion (evaluated_file_reference, expansion_option, work_area, result, ignore_tail,
          status);
    IF NOT status.normal AND (status.condition = cle$no_match_for_wild_card_file) THEN
      status.normal := TRUE;
      clp$make_list_value (work_area, result);
      IF result = NIL THEN
        osp$set_status_abnormal ('CL', cle$work_area_overflow, '', status);
      IFEND;
    IFEND;

  PROCEND clp$$wild_card_files;
?? TITLE := 'clp$$working_catalog', EJECT ??

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

{ FUNCTION (osm$$wc) $working_catalog, $catalog, $wc

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

  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
    recend := [
    [1,
    [90, 4, 3, 14, 1, 1, 673],
    clc$function, 0, 0, 0, 0, 0, 0, 0, 'OSM$$WC']];

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

    VAR
      path: fst$path,
      path_size: fst$path_size,
      working_catalog: ^^clt$working_catalog;

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

    clp$find_working_catalog (working_catalog);
    bap$get_path_string (working_catalog^^.evaluated_file_reference.path_handle_info.path_handle, path,
          path_size, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;

    clp$make_file_value (path (1, path_size), work_area, result);
    IF result = NIL THEN
      osp$set_status_abnormal ('CL', cle$work_area_overflow, '', status);
    IFEND;

  PROCEND clp$$working_catalog;
?? TITLE := 'make_empty_list', EJECT ??

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

    clp$make_list_value (work_area, result);
    IF result = NIL THEN
      osp$set_status_abnormal ('CL', cle$work_area_overflow, '', status);
    IFEND;

  PROCEND make_empty_list;

MODEND clm$file_functions;

