! 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.

! Example 6.32. Make linked list and search for New_Name.
  program G32
    use Element_M
    use G31M
    use G32M
    implicit none
    integer, parameter :: S_LEN = 20, LIMIT = 3
    type (Box_Type), pointer :: Root_BP, Temp_BP
    integer :: Loop
    character (len = S_LEN) :: New_Name
! start program G32_F90
    nullify( Root_BP )
    do Loop = 1, LIMIT
      allocate( Temp_BP )
      Temp_BP % El = Chem_El_Type_2( "X", "...", 0, 0.0, Isotope_Type( 0, 0.0 ) )
      read (unit = *, fmt = *) Temp_BP % El % Element_Name   ! Read to Name component of new structure.
      Temp_BP % Next_BP => Root_BP   ! Copy Root_BP to pointer component.
      Root_BP => Temp_BP   ! Copy new pointer to Root_BP
    end do
    read (unit = *, fmt = *) New_Name
    call Look_Up( Root_BP, New_Name )
    call Print_List( Root_BP )
    stop
  end program G32
