aboutsummaryrefslogtreecommitdiff
path: root/pkg/tbtables/fitsio/fitssppb/fsgrsz.x
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/tbtables/fitsio/fitssppb/fsgrsz.x')
-rw-r--r--pkg/tbtables/fitsio/fitssppb/fsgrsz.x35
1 files changed, 35 insertions, 0 deletions
diff --git a/pkg/tbtables/fitsio/fitssppb/fsgrsz.x b/pkg/tbtables/fitsio/fitssppb/fsgrsz.x
new file mode 100644
index 00000000..83dca679
--- /dev/null
+++ b/pkg/tbtables/fitsio/fitssppb/fsgrsz.x
@@ -0,0 +1,35 @@
+include <fset.h>
+include "fitsio.h"
+
+# This was added for compatibility with CFITSIO.
+
+procedure fsgrsz (iunit, maxrows, status)
+
+
+int iunit # i input file pointer
+int maxrows # o number of rows that fit in buffer
+int status # o error status
+#--
+int fd
+int bufsize
+int naxis1
+char comm[SZ_FCOMMENT]
+int fstati()
+include "../fitsspp.com" # in order to get fd from iunit
+
+begin
+ call fsgkyj (iunit, "NAXIS1", naxis1, comm, status)
+ if (status != 0)
+ return
+ naxis1 = naxis1 / 2 # convert from bytes to SPP char
+
+ fd = bufid[iunit]
+
+ bufsize = fstati (fd, F_BUFSIZE)
+ if (naxis1 > 0) {
+ maxrows = bufsize / naxis1
+ maxrows = max (1, maxrows)
+ } else {
+ maxrows = bufsize
+ }
+end