-
Notifications
You must be signed in to change notification settings - Fork 1
/
datccopy.c
66 lines (56 loc) · 2.12 KB
/
datccopy.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
#if HAVE_CONFIG_H
# include <config.h>
#endif
/*+DATCCOPY.C-*/
/* Include files */
#include "ems.h" /* EMS error reporting routines */
#include "hds1.h" /* Global definitions for HDS */
#include "rec.h" /* Public rec_ definitions */
#include "str.h" /* Character string import/export macros */
#include "dat1.h" /* Internal dat_ definitions */
#include "dat_err.h" /* DAT__ error code definitions */
#include "hds.h" /* HDS public C interface */
/*=====================================*/
/* DatCcopy - Copy one structure level */
/*=====================================*/
int
datCcopy(const HDSLoc *locator1,
const HDSLoc *locator2,
const char *name,
HDSLoc **locator3,
int *status )
{
/*
* This is a direct translation into C of the HDS source file dat_ccopy.f
* See that file for all comments about the function of this routine!
* C version - BKM 20020821 - NOT YET TESTED!
*/
/* Local variables */
int structure; /* Structure flag */
int state; /* State flag */
int ndim; /* Number of axes */
HDS_PTYPE dims[DAT__MXDIM]; /* Axes sizes */
char type[DAT__SZTYP+1];
/* Routine entry */
if( !_ok(*status) )
return *status;
datStruc( locator1, &structure, status );
if( !_ok(*status) )
return *status;
if( !structure ) {
datState( locator1, &state, status );
if ( state )
datCopy( locator1, locator2, name, status );
else {
datType( locator1, type, status );
datShape( locator1, DAT__MXDIM, dims, &ndim, status );
datNew( locator2, name, type, ndim, dims, status );
}
} else {
datType( locator1, type, status );
datShape( locator1, DAT__MXDIM, dims, &ndim, status );
datNew( locator2, name, type, ndim, dims, status );
}
datFind( locator2, name, locator3, status );
return *status;
}