!------------------------------------------------------------------------------
!
!  Program name:
!
!    generic_mod
!
!  Purpose:
!
!    This program demonstrates how to use a module which defines a generic 
!    procedure for swapping reals, integers, logicals and points (user 
!    derived type).
!
!------------------------------------------------------------------------------

PROGRAM generic_mod

  USE swap_module		! defined in swap_module.f90
 
  IMPLICIT NONE
  REAL :: a, b
  INTEGER :: ia, ib
  LOGICAL :: la, lb
  TYPE(point) :: pa, pb

  ! swap two reals
  a = 1.0
  b = 2.0
  WRITE(*, *) a, b
  CALL swap(a, b)
  WRITE(*, *) a, b
  WRITE(*, *)

  ! swap two integers
  ia = 1
  ib = 2
  WRITE(*, *) ia, ib
  CALL swap(ia, ib)
  WRITE(*, *) ia, ib
  WRITE(*, *)

  ! swap two logicals
  la = .TRUE.
  lb = .FALSE.
  WRITE(*, *) la, lb
  CALL swap(la, lb)
  WRITE(*, *) la, lb
  WRITE(*, *)

  ! swap two points
  pa = point(1.0, 3.0)
  pb = point(2.0, 4.0)
  WRITE(*, *) pa, pb
  CALL swap(pa, pb)
  WRITE(*,*) pa, pb
  WRITE(*,*)

END PROGRAM generic_mod





