! Program Example from "Essential Fortran 90 & 95" by Loren P. Meissner
! Copyright 1996. Copying for sale requires permission from the author.
! Otherwise, distribution is permitted if these three lines are included.

  module G31M
    use Element_M
    implicit none
    private
    public :: Print_List
  contains
    ! Print procedure for linked list.
    subroutine Print_List( Arg_CP )  ! Print linked list, from Arg_CP to end of list.
      type (Box_Type), pointer :: Arg_CP
      type (Box_Type), pointer :: Trav_CP
  ! start subroutine Print_List
      Trav_CP => Arg_CP  ! Copy to avoid destroying dummy argument pointer value.
      write (unit = *, fmt = *) " Linked List of Chem_El_Type: "
      do
        if (.not. associated (Trav_CP)) then
          exit  ! Stop at nullified pointer.
        end if
        write (unit = *, fmt = *) Trav_CP % El % Element_Name, Trav_CP % El % Symbol, &
          Trav_CP % El % Atomic_Number, Trav_CP % El % Atomic_Mass, &
          Trav_CP % El % Principal_Isotope
        Trav_CP => Trav_CP % Next_BP
      end do
      return
    end subroutine Print_List
  end module G31M

