-
Notifications
You must be signed in to change notification settings - Fork 1
/
datPutVC.c
112 lines (90 loc) · 3.35 KB
/
datPutVC.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
#include <stdlib.h>
#include "dat_err.h"
#include "hds1.h"
#include "hds.h"
#include "ems.h"
/*
*+
* Name:
* datPutVC
* Purpose:
* Write 1-D C string array to vectorized object
* Invocation:
* datPutVC( const HDSLoc * locator, size_t nval, const char *values[], int * status );
* DAT_PUTVC( LOCATOR, NVAL, VALUES(NVAL), STATUS )
* Description :
* Write the values into a vectorized primitive object.
* Parameters :
* locator = const HDSLoc * (Given)
* Variable containing a locator associated with a primitive
* data object. It will be vectorized before storing the data.
* nval = size_t (Given)
* Expression specifying the number of values that are to be
* written. This must match the object size.
* values = const char* [] (Given)
* Array of pointers to C nul-terminated strings. Must contain
* at least nval pointers.
* 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.
* Notes:
* The C implementation takes an array of pointers to character strings whereas
* the fortran interface takes a pointer to a single character buffer. Use the
* datPutC interface if a fortran style character array is to be stored.
* Since a C string array will have strings of differing length, they may be
* truncated on store. If that happens status will be set to DAT__TRUNC.
* Authors
* JRG: Jack Giddings (UCL)
* SLW: Sid Wright (UCL)
* BDK: Dennis Kelly (UKATC)
* AJC: Alan Chipperfield (RAL)
* TIMJ: Tim Jenness (JAC, Hawaii)
* {enter_new_authors_here}
* History :
* 3-JAN-1983 (JRG):
* Original.
* 31-Aug-1983 (SLW):
* Standardise.
* 05.11.1984 (BDK):
* Remove calls to error system
* 15-APR-1987 (AJC):
* Improved prologue layout
* 05-DEC-2005 (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
datPutVC( const HDSLoc * locator, size_t nval, const char *values[], int * status ) {
HDSLoc * vecloc = NULL;
if (*status != DAT__OK) return *status;
/* Vectorize */
datVec( locator, &vecloc, status );
/* Store the character data */
datPut1C( vecloc, nval, values, status );
/* Annul the vectorized locator */
datAnnul( &vecloc, status );
return *status;
}