?? TITLE := 'NOS/VE : Basic Access Methods : Path evaluator' ??
MODULE bam$evaluate_path;
?? RIGHT := 110 ??

{ PURPOSE: Retrieve the evaluated_file_reference for a given path and the
{          path_handle_name if the path is registered.

?? NEWTITLE := 'Global Declarations Referenced By This Module', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc fsc$local
*copyc oss$job_paged_literal
?? POP ??
*copyc clp$construct_path_handle_name
*copyc fmp$evaluate_path
*copyc fsp$path_element
*copyc osp$set_status_abnormal
?? OLDTITLE ??
?? NEWTITLE := '[xdcl, #gate] BAP$EVALUATE_PATH', EJECT ??

  PROCEDURE [XDCL, #GATE] bap$evaluate_path
    (    file: fst$file_reference;
         resolve_to_catalog: boolean;
         command_file_reference_allowed: boolean;
         record_path: boolean;
     VAR evaluated_file_reference: fst$evaluated_file_reference;
     VAR temporary_file: boolean;
     VAR file_registered: boolean;
     VAR path_handle_name: fst$path_handle_name;
     VAR status: ost$status);

    TYPE
      t$resolve_to_catalog = boolean,
      t$record_path = boolean;

    VAR
      v$process_pt_work_list: [oss$job_paged_literal, READ] array [t$resolve_to_catalog] of
            array [t$record_path] of bat$process_pt_work_list := [
{ CATALOG  RECORD }
{  FALSE    FALSE } [$bat$process_pt_work_list [bac$resolve_path],
{  FALSE     TRUE  } $bat$process_pt_work_list [bac$resolve_path, bac$record_path]],
{   TRUE    FALSE } [$bat$process_pt_work_list [bac$resolve_path, bac$resolve_to_catalog],
{   TRUE     TRUE  } $bat$process_pt_work_list [bac$resolve_path, bac$resolve_to_catalog, bac$record_path]]];

    VAR
      ignore_cycle_description: ^fmt$cycle_description,
      path_handle: fmt$path_handle;

    ignore_cycle_description := NIL;
    fmp$evaluate_path (file, v$process_pt_work_list [resolve_to_catalog] [record_path],
          evaluated_file_reference, ignore_cycle_description, status);
    IF NOT status.normal THEN
      RETURN; {----->
    IFEND;

    file_registered := evaluated_file_reference.path_handle_info.path_handle_present;
    temporary_file := (fsp$path_element (^evaluated_file_reference, 1) ^ = fsc$local);
    IF file_registered THEN
      clp$construct_path_handle_name (evaluated_file_reference.path_handle_info.path_handle,
            path_handle_name);
    IFEND;

  PROCEND bap$evaluate_path;
?? OLDTITLE ??
MODEND bam$evaluate_path;

