!!
!!

  program mask

  use sep

  implicit none
  
  character*20			    :: date, tempo
  real		  		    :: theta, pi, time, rnc
  integer	  		    :: n, npe, npi
  integer	  		    :: if2, if3, k
  real		  		    :: s2,s4,t2,t4,s2t2,det
  integer                           :: i1,i2,i3,n1,n2,n3
  real                              :: o1,o2,o3,d1,d2,d3
  real				    :: emt(10),emx(10),imt(10),imx(10)
  real,dimension(:,:),allocatable :: cdp,dado,A,B,C
  real,dimension(:,:),allocatable   :: Q
  real,dimension(:),allocatable     :: m,d
!  integer,dimension(:), allocatable :: iloc
  integer			    :: iloc(2),il
  integer, external :: sreed

  call sep_init()
  call sep_begin_prog()

  call date_and_time (date,tempo)
  write(0,*) "Begin"
  write(0,*) "Date = ",date," Time = ",tempo


!! get info from history file
  call from_history("n1",n1)
  call from_history("n2",n2)
  call from_history("n3",n3)
  call from_history("d1",d1)
  call from_history("d2",d2)
  call from_history("d3",d3)
  call from_history("o1",o1)
  call from_history("o2",o2)
  call from_history("o3",o3)
  call from_history("n4",n4)
  call from_history("n5",n5)
  call from_history("o4",o4)
  call from_history("o5",o5)
  call from_history("d4",d4)
  call from_history("d5",d5)

  !! write info out to history file
  call to_history("n1",n1)
  call to_history("n2",n2)
  call to_history("n3",n3)
  call to_history("d1",d1)
  call to_history("d2",d2)
  call to_history("d3",d3)
  call to_history("o1",o1)
  call to_history("o2",o2)
  call to_history("o3",o3)
  call to_history("n4",n4)
  call to_history("n5",n5)
  call to_history("o4",o4)
  call to_history("o5",o5)
  call to_history("d4",d4)
  call to_history("d5",d5)

!!


!! allocate working space
  allocate(cdp(n1,n2))

!!
!! 
!!
do i3=1,n3
  call sreed_window("in",3,(/n1,n2,n3/),(/n1,n2,1/),(/0,0,i3-1/),(/1,1,1/),4,cdp)
  do i1=1,n1
	!!

	!!
	!!

  end do
  call srite_window("out",3,(/n1,n2,n3/),(/n1,n2,1/),(/0,0,i3-1/),(/1,1,1/),4,dado)
end do

!  call srite("out",dado,n1*n2*n3*4)

!! clean up
  deallocate(cdp,dado,Q,m,d,A,B,C)

  call sep_end_prog()
  end program LSQpr
