pro rh_prtacq,fich,freq=ifreq,hdeb=ihdeb,klu=kludeb,tout=tout

;+   rh_prtacq.pro 
; 
;	-nouvelle procedure qui permet de lister la tete d'acq des donnees RH
;	-appelle read_rh_mono_brut pour lire les donnees sans decoder les points
;	a l'aide des gains
;	pour le faire tourner taper 
;		idl
;
;	pour lister des le debut:
;	rh_prtacq,'/disque3/scratch/bouteill/1i960731.01'
;
;	pour selectionner les frequences 0 et 1 (attention mettre les valeurs
;	entre crochets), et
;	pour commencer a 14h30
;  rh_prtacq,'/disque3/scratch/bouteill/1i960731.01',freq=[0,1],hdeb=([14,30])
;
;	pour commencer a l'acq 200
;	rh_prtacq,'/disque3/scratch/bouteill/1i960731.01',freq=[0],klu=200
;
;	Le programme liste par paquets de 100 acq et demande si on veut
;	continuer.
;
;	pour lister aussi les points, on met '/tout' et le programme liste 
;	acquisition par acquisition:
;	rh_prtacq,'/disque3/scratch/bouteill/1i960731.01',/tout
; MODIFICATION HISTORY:
;  22-07-1998 : nouvelles routines read_rh pour extension NS24

@rh_common.inc

if not (rh_open(fich,/mono)) then begin
	print ,'erreur ouverture',fich
	return
	end

temp=[3600000L,60000L,1000L,10L] 
n2d=entfi.nval_2d & new=entfi.nval_ew & nns=entfi.nval_ns & nns1=0
; cas de l'extension NS
if entfi.nval_ns eq 18*4*4 then nns1=18*2*4
klu=0L

npac=100L
itout=0
if keyword_set(tout) then begin 
   itout=1
   npac=1L
endif
ch=replicate('Y',entfi.nf)
if n_elements(ifreq) ne 0 then begin
   ch=replicate('N',entfi.nf) 
   ch(ifreq)='Y'
endif

if keyword_set(kludeb) then begin
   print,kludeb & klu=kludeb & end 
if keyword_set(ihdeb) then begin
   itdq=([0L,0L,0L,0L])& itdq(0:n_elements(ihdeb)-1)=ihdeb 
   itfq=([24L,0L,0L,0L])
   temp=[3600000L,60000L,1000L,10L]
   msd=(transpose(temp)#long(itdq))(0)
   msf=(transpose(temp)#long(itfq))(0)
   rh_lecdeb,msd,msf,kdeb,kfin
   klu=kdeb
endif

lrec= long(entfi.lg) ;longueur enreg.
;klumax=long((sfi.size-entfi.lgent)/lrec)-1 ; nb enreg.
klumax=entfi.klumax

print,'itg',entfi.itg
;openw,10,fich+'errors'

; lecture
nmax=1L
klu2=klu+npac-1
nbl=0L
boucle:
  if(klu gt entfi.klumax) then goto,fin 
  rh_readb, klu
  klu=klu+1l
;,c,h,ipt,ifr,ig

  if ch(bfi.nof) eq 'Y' then begin
    nbl=nbl+1
   mslu=(transpose(temp)#bfi.h)(0)
   msc=mslu+(bfi.c(0)+1)*entfi.itg
    print,klu,bfi.nof,bfi.c,bfi.h,mslu,msc,bfi.g,format= $
"(' ****',i8,' freq:',i1,' nsa:',i5,3x,2(i2.2,':'),i2.2,'.',i2.2,5x,2i12,3i4)"
    if itout eq 1 then begin
        if n2d ne 0 then begin
	print,' **********************************************************'
           print,' ** 2D ** ',n2d,' points:' 
;	   print,bfi.pt(0:n2d-1),format="(10i7)"
	   print,bfi.pt(0:9),format="(10i7)"
	endif
	if nns1 ne 0 then begin
	print,' **********************************************************'
           print,' ** NS  EXTENSION ** ',nns1,' points:' 
;	   print,bfi.pt(n2d:n2d+nns1-1),format="(10i7)"
	   print,bfi.pt(n2d:n2d+9),format="(10i7)"
	endif
	print,' **********************************************************'
        print,' ** EW ** ',new,' points:'
;        print,bfi.pt(n2d+nns1:n2d+nns1-1+new),format="(10i7)"
        print,bfi.pt(n2d+nns1:n2d+nns1+9),format="(10i7)"
	print,' **********************************************************'
        print,' ** NS ** ',nns,' points:'
;        print,bfi.pt(n2d+nns1+new:n2d+nns1-1+new+nns),format="(10i7)"
        print,bfi.pt(n2d+nns1+new:n2d+nns1+new+9),format="(10i7)"
	print,' **********************************************************'
    endif
  endif
if(nbl eq npac) then begin
   print,'continue(1)'
   read,icont
   if(icont eq 1)then begin
      nbl=0L
      goto, boucle
   endif else goto,fin
endif
goto,boucle

fin:
stop
print, 'fin ',klu,' enregistrements lus'
;close,10
return
end
