module gwcs_interfaces_private
  interface
    subroutine gwcs_message(mkind,procname,message)
      use gbl_message
      !---------------------------------------------------------------------
      ! @ private
      ! Messaging facility for the current library. Calls the low-level
      ! (internal) messaging routine with its own identifier.
      !---------------------------------------------------------------------
      integer,          intent(in) :: mkind     ! Message kind
      character(len=*), intent(in) :: procname  ! Name of calling procedure
      character(len=*), intent(in) :: message   ! Message string
    end subroutine gwcs_message
  end interface
  !
  interface
    subroutine chgref(matrix, oldref, newref)
      !---------------------------------------------------------------------
      ! @ private
      ! Computes the coordinates of the reference direction in the new system
      !---------------------------------------------------------------------
      real(kind=8), intent(in)  :: matrix(3,3)  ! Rotation matrix
      real(kind=8), intent(in)  :: oldref(2)    ! Old coordinates (radians)
      real(kind=8), intent(out) :: newref(2)    ! New coordinates (radians)
    end subroutine chgref
  end interface
  !
  interface
    subroutine chgoff(matrix,oldref,oldoff,newref,newoff)
      !---------------------------------------------------------------------
      ! @ private
      ! Compute offsets in the new system
      !------------------------------------------------------------------------
      real(kind=8), intent(in)  :: matrix(3,3)  ! Rotation matrix
      real(kind=8), intent(in)  :: oldref(2)    ! Old coordinates (radians)
      real(kind=4), intent(in)  :: oldoff(2)    ! Old offsets (radians)
      real(kind=8), intent(in)  :: newref(2)    ! New coordinates (radians)
      real(kind=4), intent(out) :: newoff(2)    ! New offsets (radians)
    end subroutine chgoff
  end interface
  !
  interface
    subroutine full_b1950_to_j2000(obs_epoch,lambda,beta,mu_alph,mu_delt,  &
      parallax,radvel)
      !---------------------------------------------------------------------
      ! @ private
      ! Convert Besselian coordinates to J2000.
      ! Implementation of the general formulas given in Aoki et al AA 128,
      ! 263 (1983), modified (not totally sure the modification is totally
      ! consistent, but the potentially remaining inconsistencies should be
      ! small for practical cases) to handle the case of a non-B1950 observing
      ! epoch.
      !
      ! NOT YET FINISHED, STILL RESTRICTED TO NO PM, NO PARALLAX, NO RV,
      ! BUT WORKS AS BEFORE IN THIS RESTRICTED CASE
      !---------------------------------------------------------------------
      real(kind=8), intent(in)    :: obs_epoch  !
      real(kind=8), intent(inout) :: lambda     !
      real(kind=8), intent(inout) :: beta       !
      real(kind=8), intent(in)    :: mu_alph    !
      real(kind=8), intent(in)    :: mu_delt    !
      real(kind=8), intent(in)    :: parallax   !
      real(kind=8), intent(in)    :: radvel     !
    end subroutine full_b1950_to_j2000
  end interface
  !
  interface
    function arcsin (x)
      use phys_const
      !---------------------------------------------------------------------
      ! @ private
      !---------------------------------------------------------------------
      real(kind=8) :: arcsin         !
      real(kind=8), intent(in) :: x  !
    end function arcsin
  end interface
  !
  interface
    function arccos (x)
      use phys_const
      !---------------------------------------------------------------------
      ! @ private
      !---------------------------------------------------------------------
      real(kind=8) :: arccos         !
      real(kind=8), intent(in) :: x  !
    end function arccos
  end interface
  !
end module gwcs_interfaces_private
