?? TITLE := 'NOS/VE : BASIC ACCESS METHOD' ??
MODULE amm$return;
?? RIGHT := 110 ??

?? NEWTITLE := 'Global Declarations Referenced By This Module', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc ame$condition_codes
*copyc ame$lfn_program_actions
*copyc amt$local_file_name
*copyc fst$file_reference
*copyc ost$status
?? POP ??
*copyc bap$delete_art_entry
*copyc bap$return
*copyc clp$evaluate_file_reference
*copyc clp$trimmed_string_size
*copyc clp$validate_local_file_name
*copyc osp$enforce_exception_policies
*copyc osp$file_access_condition
*copyc fsv$evaluated_file_reference
*copyc osv$initial_exception_context
?? OLDTITLE ??
?? NEWTITLE := '  [XDCL] AMP$RETURN', EJECT ??

*copyc amh$return

  PROCEDURE [XDCL, #GATE] amp$return
    (    file: fst$file_reference;
     VAR status: ost$status);

    VAR
      context: ^ost$ecp_exception_context,
      evaluated_file_reference: fst$evaluated_file_reference,
      ignore_status: ost$status,
      local_file_name: amt$local_file_name,
      name_is_path_handle: boolean,
      name_is_valid: boolean,
      path_handle: fmt$path_handle;

    status.normal := TRUE;
    context := NIL;

    clp$validate_local_file_name (file, local_file_name, path_handle, name_is_path_handle, name_is_valid);
    IF name_is_path_handle THEN

{       The call to clp$validate_local_file_name and this path_handle check is
{       here because clp$evaluate_file_reference returns the full path for an
{       alias path handle.

      evaluated_file_reference := fsv$evaluated_file_reference;
      evaluated_file_reference.path_handle_info.path_handle_present := TRUE;
      evaluated_file_reference.path_handle_info.path_handle := path_handle;
    ELSE
      clp$evaluate_file_reference (file, $clt$file_ref_parsing_options [clc$use_$local_as_working_cat],
            {resolve_cycle_number=} FALSE, evaluated_file_reference, status);
      IF NOT status.normal THEN
        RETURN; {----->
      IFEND;
    IFEND;

    REPEAT
      bap$return (evaluated_file_reference, {detachment_options} NIL, status);
      IF NOT status.normal THEN
        IF context = NIL THEN
          PUSH context;
          context^ := osv$initial_exception_context;
          context^.file.selector := osc$ecp_evaluated_file_ref;
          context^.file.evaluated_file_reference := evaluated_file_reference;
        IFEND;
        context^.condition_status := status;
        osp$enforce_exception_policies (context^);
        status := context^.condition_status;
      IFEND;
    UNTIL status.normal OR (NOT osp$file_access_condition (status)) OR (NOT context^.wait);

    IF (status.normal OR (status.condition = ame$file_not_known)) AND name_is_valid THEN
      bap$delete_art_entry (local_file_name, ignore_status);
    IFEND;

  PROCEND amp$return;
?? OLDTITLE ??
MODEND amm$return;

