aboutsummaryrefslogtreecommitdiff
path: root/pkg/tbtables/fitsio/fitssppb/fsptbs.x
blob: c1c52b4060a730072162dce540f54ea3603ffdfd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
include "fitsio.h"

procedure fsptbs(iunit,frow,fchar,nchars,svalue,status)

# write a consecutive string of characters to an ascii or binary
# table. This will span multiple rows of the table if NCHARS+FCHAR is
# greater than the length of a row.

int     iunit           # i input file pointer
int     frow            # i first row
int     fchar           # i first character
int     nchars          # i number of characters
char    svalue[ARB]     # i string value
%       character fsvalu*256
int     status          # o error status
int	readfirst
int	writefirst
int	ntodo
int	itodo

begin

# since the string may be arbitrarily long, write it in pieces
readfirst=1
writefirst=fchar
ntodo=nchars
itodo=min(256,ntodo)

while (itodo > 0) {
  call f77pak(svalue[readfirst],fsvalu,itodo)
  call ftptbs(iunit,frow,writefirst,itodo,fsvalu,status)
  writefirst=writefirst+itodo
  readfirst=readfirst+itodo
  ntodo=ntodo-itodo
  itodo=min(256,ntodo)
 }

end