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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
define MAXLEN_STRVAL 65
define LEN_KEYWORD 8
define LEN_STRING 18
# ADDCARD_R -- Format and append a FITS header card with a real
# keyword value to the input string buffer.
procedure addcard_r (fd, keyword, value, comment, precision)
int fd # File descriptor of input string buffer
char keyword[LEN_KEYWORD] # FITS keyword
real value # Value of FITS keyword
char comment[ARB] # Comment string
int precision # Number of decimal places output
begin
call fprintf (fd, "%-8.8s= %20.*g / %-45.45s\n")
call pargstr (keyword)
call pargi (precision)
call pargr (value)
call pargstr (comment)
end
# ADDCARD_I -- Format and append a FITS header card with an integer
# keyword value to the input string buffer.
procedure addcard_i (fd, keyword, value, comment)
int fd # File descriptor of input string buffer
char keyword[LEN_KEYWORD] # FITS keyword
int value # Value of FITS keyword
char comment[ARB] # Comment string
begin
call fprintf (fd, "%-8.8s= %20d / %-45.45s\n")
call pargstr (keyword)
call pargi (value)
call pargstr (comment)
end
# ADDCARD_TIME -- Format and append a FITS header card to the input
# file descriptor. The value is input as a real number; it is output
# in HH:MM:SS.S format with %h. The procedure can be used for RA, DEC
# and ST, UT and HA.
procedure addcard_time (fd, keyword, value, comment)
int fd # File descriptor
char keyword[LEN_KEYWORD] # FITS keyword
real value # Value of FITS keyword to be encoded
char comment[ARB] # Comment string
begin
call fprintf (fd, "%-8.8s= '%-18.1h' / %-45s\n")
call pargstr (keyword)
call pargr (value)
call pargstr (comment)
end
# ADDCARD_ST -- Format and output a FITS header card to the input
# file descriptor. The value is output as a string with the given keyword.
# If the string value is longer than 18 characters, it is output without
# a comment.
procedure addcard_st (fd, keyword, value, comment, length)
int fd # File descriptor
char keyword[LEN_KEYWORD] # FITS keyword
char value[SZ_LINE] # String value of FITS keyword to be encoded
char comment[ARB] # Comment string
int length # Length of string value
begin
if (length <= LEN_STRING) {
call fprintf (fd, "%-8.8s= '%-18.18s' / %-44s\n")
call pargstr (keyword)
call pargstr (value)
call pargstr (comment)
} else {
length = min (length, MAXLEN_STRVAL)
call fprintf (fd, "%-8.8s= '%*.*s' /\n")
call pargstr (keyword)
call pargi (-length)
call pargi (length)
call pargstr (value)
}
end
# ADDCARD_B -- Format and output a FITS header card to the input file
# descriptor. The value is output as a boolean with the given keyword.
# Unlike string parameters, booleans are not enclosed in quotes.
procedure addcard_b (fd, keyword, value, comment)
int fd # File descriptor
char keyword[LEN_KEYWORD] # FITS keyword
bool value # Boolean parameter (T/F)
char comment[ARB] # Comment string
char truth
begin
if (value)
truth = 'T'
else
truth = 'F'
call fprintf (fd, "%-8.8s= %20c / %-45.45s\n")
call pargstr (keyword)
call pargc (truth)
call pargstr (comment)
end
# ADDCARD_D -- Format and append a FITS header card with a double
# keyword value to the input string buffer.
procedure addcard_d (fd, keyword, value, comment, precision)
int fd # File descriptor of input string buffer
char keyword[LEN_KEYWORD] # FITS keyword
double value # Value of FITS keyword
char comment[ARB] # Comment string
int precision # Number of decimal places output
begin
call fprintf (fd, "%-8.8s= %20.*f / %-45.45s\n")
call pargstr (keyword)
call pargi (precision)
call pargd (value)
call pargstr (comment)
end
|