
  PROCEDURE [INLINE] clp$remove_last_path_element
    (VAR evaluated_file_reference: fst$evaluated_file_reference;
     VAR status: ost$status);

?? PUSH (LISTEXT := ON) ??

    VAR
      i: fst$path_index,
      position: fst$path_index;

    status.normal := TRUE;

{ Cannot remove "only" path element from the file reference.

    IF evaluated_file_reference.number_of_path_elements = 1 THEN
      osp$set_status_abnormal ('CL', cle$up_produced_empty_file_ref, '',
            status);
    ELSE
      i := $INTEGER (evaluated_file_reference.path_structure (1)) + 2;
      WHILE i < evaluated_file_reference.path_structure_size DO
        position := i;
        i := i + $INTEGER (evaluated_file_reference.path_structure (i)) + 1;
      WHILEND;

      evaluated_file_reference.path_structure_size := position - 1;
      evaluated_file_reference.path_structure :=
            evaluated_file_reference.path_structure (1, position - 1);
      evaluated_file_reference.number_of_path_elements :=
            evaluated_file_reference.number_of_path_elements - 1;
    IFEND;

  PROCEND clp$remove_last_path_element;

*copyc cle$ecc_file_reference
*copyc fst$evaluated_file_reference
*copyc fst$path_index
*copyc ost$status
?? POP ??
*copyc osp$set_status_abnormal
