-
Notifications
You must be signed in to change notification settings - Fork 1
/
datput0x.c
190 lines (140 loc) · 4.43 KB
/
datput0x.c
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <string.h>
#include "hds1.h"
#include "rec.h"
#include "dat1.h"
#include "hds_types.h"
#include "dat_err.h"
#include "hds.h"
/*
*+
* Name:
* datPut0X
* Purpose:
* Put a scalar value into an HDS component
* Invocation:
* status = datPut0X( HDSLoc * loc, <type> value, int * status );
* Description:
* This routine writes a value into a scalar primitive object.
* There is a routine for each access type,
*
* datPut0D DOUBLE PRECISION
* datPut0R REAL / FLOAT
* datPut0I INTEGER
* datPut0K INT64
* datPut0W WORD / SHORT
* datPut0UW UWORD / unsigned short
* datPut0L LOGICAL
* datPut0C CHARACTER[*n]
*
* If the object data type differs from the access type, then
* conversion is performed.
*
* Note that a Vector (1-D) object containing a single value is
* different from a Scalar (0-D).
* Arguments
* HDSLoc * loc = Given
* HDS locator associated with a primitive data object.
* <type> value = Given
* Value to be stored in the primitive data object
* int * status = Given & Returned
* Global inherited status.
* Authors:
* Jack Giddings (UCL::JRG)
* Sid Wright (UCL::SLW)
* Dennis Kelly (REVAD::BDK)
* Alan Chipperfield (RAL::AJC)
* Tim Jenness (JAC, Hawaii)
* History:
* 3-JAN-1983 (UCL::JRG):
* Original.
* 31-AUG-1983 (UCL::SLW):
* Standardise.
* 05-NOV-1984: (REVAD::BDK)
* Remove calls to error system
* 15-APR-1987 (RAL::AJC):
* Improved prologue layout
* 21-NOV-2005 (TIMJ):
* Rewrite in C
* Notes:
* For datPut0C the supplied string must be nul-terminated.
* Copyright:
* Copyright (C) 2005 Particle Physics and Astronomy Research Council.
* All Rights Reserved.
* Licence:
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA
* Bugs:
* {note_any_bugs_here}
*-
*/
int datPut0C ( const HDSLoc * loc, const char * value, int * status ) {
int ndims = 0;
hdsdim dim[] = { 0 };
if ( *status != DAT__OK ) return *status;
datPutC( loc, ndims, dim, value, strlen(value), status );
return *status;
}
int datPut0D ( const HDSLoc * loc, double value, int * status ) {
int ndims = 0;
hdsdim dim[] = { 0 };
if ( *status != DAT__OK ) return *status;
datPutD( loc, ndims, dim, &value, status );
return *status;
}
int datPut0R ( const HDSLoc * loc, float value, int * status ) {
int ndims = 0;
hdsdim dim[] = { 0 };
if ( *status != DAT__OK ) return *status;
datPutR( loc, ndims, dim, &value, status );
return *status;
}
int datPut0I ( const HDSLoc * loc, int value, int * status ) {
int ndims = 0;
hdsdim dim[] = { 0 };
if ( *status != DAT__OK ) return *status;
datPutI( loc, ndims, dim, &value, status );
return *status;
}
int datPut0K ( const HDSLoc * loc, int64_t value, int * status ) {
int ndims = 0;
hdsdim dim[] = { 0 };
if ( *status != DAT__OK ) return *status;
datPutK( loc, ndims, dim, &value, status );
return *status;
}
int datPut0W ( const HDSLoc * loc, short value, int * status ) {
int ndims = 0;
hdsdim dim[] = { 0 };
if ( *status != DAT__OK ) return *status;
datPutW( loc, ndims, dim, &value, status );
return *status;
}
int datPut0UW ( const HDSLoc * loc, unsigned short value, int * status ) {
int ndims = 0;
hdsdim dim[] = { 0 };
if ( *status != DAT__OK ) return *status;
datPutUW( loc, ndims, dim, &value, status );
return *status;
}
int datPut0L ( const HDSLoc * loc, int value, int * status ) {
int ndims = 0;
hdsdim dim[] = { 0 };
if ( *status != DAT__OK ) return *status;
datPutL( loc, ndims, dim, &value, status );
return *status;
}