-
Notifications
You must be signed in to change notification settings - Fork 1
/
datnew0.c
164 lines (131 loc) · 4.28 KB
/
datnew0.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
#include "ems.h"
#include "hds1.h"
#include "rec.h"
#include "str.h"
#include "dat1.h"
#include "hds.h"
/*
*+
* Name:
* datNew0
* Purpose:
* Create new scalar component
* Language:
* Starlink ANSI C
* Invocation:
* datNew0( const HDSLoc* loc, const char * name, const char *type, int * status);
* CALL DAT_NEW0( LOC, NAME, TYPE, STATUS )
* Description:
* Create a scalar structure component with specified type.
* Parameters:
* loc = const HDSLoc * (Given)
* Locator associated with a structured data object.
* name = const char * (Given)
* Expression specifying the name of the component to be
* created in the structure.
* type = const char * (Given)
* Expression specifying the type of the component.
* status = int * (Given & Returned)
* Variable holding the status value. If this variable is not
* SAI__OK on input, the routine will return without action.
* If the routine fails to complete, this variable will be
* set to an appropriate error number.
* Returns:
* Returns status value on exit.
* Authors:
* SLW: Sid Wright (UCL)
* BDK: Dennis Kelly (UKATC)
* AJC: Alan Chipperfield (Starlink, RAL)
* TIMJ: Tim Jenness (JAC, Hawaii)
* {enter_new_authors_here}
* History:
* 1983-AUG-31 (SLW):
* Original.
* 1984-NOV-05 (BDK):
* Remove calls to error system.
* 1987-APR-15 (AJC):
* Improved prologue layout.
* 2005-DEC02 (TIMJ):
* Rewrite in C.
* {enter_further_changes_here}
* 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 datNew0( const HDSLoc* locator, const char * name, const char * type, int *status ) {
int ndim = 0;
hdsdim dims[] = { 0 }; /* Required */
if (*status == DAT__OK ) {
datNew( locator, name, type, ndim, dims, status );
}
return *status;
}
/* Add in the very simply datNew0x variants */
/* Could put them in a separate file if the prolog is important */
/*
DAT_NEW0D
DAT_NEW0I
DAT_NEW0K
DAT_NEW0W
DAT_NEW0UW
DAT_NEW0L
DAT_NEW0R
*/
int datNew0D( const HDSLoc * locator, const char * name, int * status ) {
datNew0( locator, name, "_DOUBLE", status );
return *status;
}
int datNew0I( const HDSLoc * locator, const char * name, int * status ) {
datNew0( locator, name, "_INTEGER", status );
return *status;
}
int datNew0K( const HDSLoc * locator, const char * name, int * status ) {
datNew0( locator, name, "_INT64", status );
return *status;
}
int datNew0W( const HDSLoc * locator, const char * name, int * status ) {
datNew0( locator, name, "_WORD", status );
return *status;
}
int datNew0UW( const HDSLoc * locator, const char * name, int * status ) {
datNew0( locator, name, "_UWORD", status );
return *status;
}
int datNew0L( const HDSLoc * locator, const char * name, int * status ) {
datNew0( locator, name, "_LOGICAL", status );
return *status;
}
int datNew0R( const HDSLoc * locator, const char * name, int * status ) {
datNew0( locator, name, "_REAL", status );
return *status;
}
int datNew0C( const HDSLoc * locator, const char * name, size_t len, int * status ) {
#undef context_name
#undef context_message
#define context_name "DAT_NEW0C_ERR"
#define context_message\
"DAT_NEW0C: Error creating a new HDS scalar character component."
char type[DAT__SZTYP+1];
if (*status != DAT__OK) return *status;
datCctyp( len, type );
_call(datNew0( locator, name, type, status ));
return *status;
}