File: fort-attio.c

package info (click to toggle)
netcdf-fortran 4.4.4%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 8,420 kB
  • ctags: 8,797
  • sloc: fortran: 51,087; f90: 20,357; sh: 11,601; ansic: 7,034; makefile: 548; pascal: 313; xml: 173
file content (150 lines) | stat: -rw-r--r-- 4,320 bytes parent folder | download | duplicates (4)
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
#include <config.h>
#include <string.h>
#include <errno.h>

#include "netcdf.h"
#include "netcdf_f.h"
#include "nfconfig.inc"
#include "ncfortran.h"


/*
 * Write an attribute from a FORTRAN CHARACTER*(*) variable.
 */
FCALLSCFUN5(NF_INT, nc_put_att_text, NF_PUT_ATT_TEXT, nf_put_att_text,
	    NCID, VARID, STRING, COUNT, CBUF)


/*
 * Read an attribute into a FORTRAN CHARACTER*(*) variable.
 */
FCALLSCFUN4(NF_INT, nc_get_att_text, NF_GET_ATT_TEXT, nf_get_att_text,
	    NCID, VARID, STRING, CBUF)


/*
 * Write an attribute from an INTEGER*1 array.
 */
#if NF_INT1_IS_C_SIGNED_CHAR
FCALLSCFUN6(NF_INT, nc_put_att_schar, NF_PUT_ATT_INT1, nf_put_att_int1,
	    NCID, VARID, STRING, TYPE, COUNT, INT1ATT)
#elif NF_INT1_IS_C_SHORT
FCALLSCFUN6(NF_INT, nc_put_att_short, NF_PUT_ATT_INT1, nf_put_att_int1,
	    NCID, VARID, STRING, TYPE, COUNT, INT1ATT)
#elif NF_INT1_IS_C_INT
FCALLSCFUN6(NF_INT, nc_put_att_int, NF_PUT_ATT_INT1, nf_put_att_int1,
	    NCID, VARID, STRING, TYPE, COUNT, INT1ATT)
#elif NF_INT1_IS_C_LONG
FCALLSCFUN6(NF_INT, nc_put_att_long, NF_PUT_ATT_INT1, nf_put_att_int1,
	    NCID, VARID, STRING, TYPE, COUNT, INT1ATT)
#endif


/*
 * Read an attribute into an INTEGER*1 array.
 */
#if NF_INT1_IS_C_SIGNED_CHAR
FCALLSCFUN4(NF_INT, nc_get_att_schar, NF_GET_ATT_INT1, nf_get_att_int1,
	    NCID, VARID, STRING, PINT1ATT)
#elif NF_INT1_IS_C_SHORT
FCALLSCFUN4(NF_INT, nc_get_att_short, NF_GET_ATT_INT1, nf_get_att_int1,
	    NCID, VARID, STRING, PINT1ATT)
#elif NF_INT1_IS_C_INT
FCALLSCFUN4(NF_INT, nc_get_att_int, NF_GET_ATT_INT1, nf_get_att_int1,
	    NCID, VARID, STRING, PINT1ATT)
#elif NF_INT1_IS_C_LONG
FCALLSCFUN4(NF_INT, nc_get_att_long, NF_GET_ATT_INT1, nf_get_att_int1,
	    NCID, VARID, STRING, PINT1ATT)
#endif


/*
 * Write an attribute from an INTEGER*2 array.
 */
#if NF_INT2_IS_C_SHORT
FCALLSCFUN6(NF_INT, nc_put_att_short, NF_PUT_ATT_INT2, nf_put_att_int2,
	    NCID, VARID, STRING, TYPE, COUNT, INT2ATT)
#elif NF_INT2_IS_C_INT
FCALLSCFUN6(NF_INT, nc_put_att_int, NF_PUT_ATT_INT2, nf_put_att_int2,
	    NCID, VARID, STRING, TYPE, COUNT, INT2ATT)
#elif NF_INT2_IS_C_LONG
FCALLSCFUN6(NF_INT, nc_put_att_long, NF_PUT_ATT_INT2, nf_put_att_int2,
	    NCID, VARID, STRING, TYPE, COUNT, INT2ATT)
#endif


/*
 * Read an attribute into an INTEGER*2 array.
 */
#if NF_INT2_IS_C_SHORT
FCALLSCFUN4(NF_INT, nc_get_att_short, NF_GET_ATT_INT2, nf_get_att_int2,
	    NCID, VARID, STRING, PINT2ATT)
#elif NF_INT2_IS_C_INT
FCALLSCFUN4(NF_INT, nc_get_att_int, NF_GET_ATT_INT2, nf_get_att_int2,
	    NCID, VARID, STRING, PINT2ATT)
#elif NF_INT2_IS_C_LONG
FCALLSCFUN4(NF_INT, nc_get_att_long, NF_GET_ATT_INT2, nf_get_att_int2,
	    NCID, VARID, STRING, PINT2ATT)
#endif


/*
 * Write an attribute from an INTEGER array.
 */
#if NF_INT_IS_C_INT
FCALLSCFUN6(NF_INT, nc_put_att_int, NF_PUT_ATT_INT, nf_put_att_int,
	    NCID, VARID, STRING, TYPE, COUNT, INTATT)
#elif NF_INT_IS_C_LONG
FCALLSCFUN6(NF_INT, nc_put_att_long, NF_PUT_ATT_INT, nf_put_att_int,
	    NCID, VARID, STRING, TYPE, COUNT, INTATT)
#endif


/*
 * Read an attribute into an INTEGER array.
 */
#if NF_INT_IS_C_INT
FCALLSCFUN4(NF_INT, nc_get_att_int, NF_GET_ATT_INT, nf_get_att_int,
	    NCID, VARID, STRING, PINTATT)
#elif NF_INT_IS_C_LONG
FCALLSCFUN4(NF_INT, nc_get_att_long, NF_GET_ATT_INT, nf_get_att_int,
	    NCID, VARID, STRING, PINTATT)
#endif


/*
 * Write an attribute from a REAL array.
 */
#if NF_REAL_IS_C_DOUBLE
FCALLSCFUN6(NF_INT, nc_put_att_double, NF_PUT_ATT_REAL, nf_put_att_real,
	    NCID, VARID, STRING, TYPE, COUNT, DOUBLEATT)
#else
FCALLSCFUN6(NF_INT, nc_put_att_float, NF_PUT_ATT_REAL, nf_put_att_real,
	    NCID, VARID, STRING, TYPE, COUNT, REALATT)
#endif


/*
 * Read an attribute into a REAL array.
 */
#if NF_REAL_IS_C_DOUBLE
FCALLSCFUN4(NF_INT, nc_get_att_double, NF_GET_ATT_REAL, nf_get_att_real,
	    NCID, VARID, STRING, PDOUBLEATT)
#else
FCALLSCFUN4(NF_INT, nc_get_att_float, NF_GET_ATT_REAL, nf_get_att_real,
	    NCID, VARID, STRING, PREALATT)
#endif


/*
 * Write an attribute from a DOUBLEPRECISION array.
 */
FCALLSCFUN6(NF_INT, nc_put_att_double, NF_PUT_ATT_DOUBLE, nf_put_att_double,
	    NCID, VARID, STRING, TYPE, COUNT, DOUBLEATT)


/*
 * Read an attribute into a DOUBLEPRECISION array.
 */
FCALLSCFUN4(NF_INT, nc_get_att_double, NF_GET_ATT_DOUBLE, nf_get_att_double,
	    NCID, VARID, STRING, PDOUBLEATT)