aboutsummaryrefslogtreecommitdiff
path: root/pkg/tbtables/fitsio/ftghtb.f
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /pkg/tbtables/fitsio/ftghtb.f
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'pkg/tbtables/fitsio/ftghtb.f')
-rw-r--r--pkg/tbtables/fitsio/ftghtb.f70
1 files changed, 70 insertions, 0 deletions
diff --git a/pkg/tbtables/fitsio/ftghtb.f b/pkg/tbtables/fitsio/ftghtb.f
new file mode 100644
index 00000000..7f3aea90
--- /dev/null
+++ b/pkg/tbtables/fitsio/ftghtb.f
@@ -0,0 +1,70 @@
+C----------------------------------------------------------------------
+ subroutine ftghtb(iunit,maxfld,ncols,nrows,nfield,ttype,
+ & tbcol,tform,tunit,extnam,status)
+
+C read required standard header keywords from an ASCII table extension
+C
+C iunit i Fortran i/o unit number
+C maxfld i maximum no. of fields to read; dimension of ttype
+C OUTPUT PARAMETERS:
+C ncols i number of columns in the table
+C nrows i number of rows in the table
+C nfield i number of fields in the table
+C ttype c name of each field (array)
+C tbcol i beginning column of each field (array)
+C tform c Fortran-77 format of each field (array)
+C tunit c units of each field (array)
+C extnam c name of table (optional)
+C status i returned error status (0=ok)
+C
+C written by Wm Pence, HEASARC/GSFC, June 1991
+
+ integer iunit,maxfld,ncols,nrows,nfield,status,tbcol(*)
+ integer i,nfind,maxf,tstat
+ character*(*) ttype(*),tform(*),tunit(*),extnam
+ character comm*72
+
+ call ftgttb(iunit,ncols,nrows,nfield,status)
+ if (status .gt. 0)return
+
+ if (maxfld .le. 0)then
+ maxf=nfield
+ else
+ maxf=min(maxfld,nfield)
+ end if
+
+C initialize optional keywords
+ do 10 i=1,maxf
+ ttype(i)=' '
+ tunit(i)=' '
+10 continue
+
+ call ftgkns(iunit,'TTYPE',1,maxf,ttype,nfind,status)
+ call ftgkns(iunit,'TUNIT',1,maxf,tunit,nfind,status)
+
+ if (status .gt. 0)return
+
+ call ftgknj(iunit,'TBCOL',1,maxf,tbcol,nfind,status)
+ if (status .gt. 0 .or. nfind .ne. maxf)then
+C couldn't find the required TBCOL keywords
+ status=231
+ call ftpmsg('Required TBCOL keyword(s) not found in ASCII'//
+ & ' table header (FTGHTB).')
+ return
+ end if
+
+ call ftgkns(iunit,'TFORM',1,maxf,tform,nfind,status)
+ if (status .gt. 0 .or. nfind .ne. maxf)then
+C couldn't find the required TFORM keywords
+ status=232
+ call ftpmsg('Required TFORM keyword(s) not found in ASCII'//
+ & ' table header (FTGHTB).')
+ return
+ end if
+
+ extnam=' '
+ tstat=status
+ call ftgkys(iunit,'EXTNAME',extnam,comm,status)
+C this keyword is not required, so ignore 'keyword not found' status
+ if (status .eq. 202)status=tstat
+ end