
  PROCEDURE [INLINE] rap$locate_element
    (    path_p: ^pft$path;
         path_index: integer;
     VAR subproduct_info_seq_p: ^rat$subproduct_info_sequence;
     VAR element_p: ^rat$element;
     VAR element_found: boolean);

?? PUSH (LISTEXT := ON) ??

    VAR
      path_found_at_current_level: boolean,
      next_path_index: integer;

    path_found_at_current_level := FALSE;
    element_found := FALSE;
    next_path_index := path_index;

  /find_element/
    WHILE NOT element_found DO
      path_found_at_current_level := (element_p^.name = path_p^ [next_path_index]);
      WHILE NOT path_found_at_current_level DO
        element_p := #PTR (element_p^.next_element_across_p, subproduct_info_seq_p^);
        IF element_p = NIL THEN
          EXIT /find_element/;
        IFEND;
        path_found_at_current_level := (element_p^.name = path_p^ [next_path_index]);
      WHILEND;

      IF next_path_index = UPPERBOUND (path_p^) THEN
        element_found := TRUE;
      ELSE { next level down }
        next_path_index := next_path_index + 1;

        IF element_p^.element_type = rac$catalog THEN
          element_p := #PTR (element_p^.first_element_down_p, subproduct_info_seq_p^);
          IF element_p = NIL THEN
            EXIT /find_element/;
          IFEND;
        ELSE
          EXIT /find_element/;
        IFEND;
      IFEND;
    WHILEND /find_element/;

  PROCEND rap$locate_element;

{ PURPOSE:
{   This procedure locates a specific element in the element list.
{
{ DESIGN:
{   An element can be either a catalog or a file within the installation
{   catalog.  An element is identified by its name and its relationship
{   to the other elements in the list.  That is its element path.
{   The relationship between elements is established using pointers.
{   An element of type catalog has a 'DOWN' pointer to the first element
{   (catalog or file) in it.  Each element in a catalog has a 'ACROSS'
{   pointer to the next element in the catalog, with the exception of
{   the last element, which has a NIL pointer if it is a file or an
{   empty catalog.
{
{ NOTES:
{
{

*copyc pft$path
*copyc rat$subproduct_info_types
?? POP ??

