Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
7a6f6fe3
Commit
7a6f6fe3
authored
Nov 01, 2016
by
Uwe Schulzweida
Browse files
Replaced UNDEFID by CDI_UNDEFID.
parent
5f01cbca
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
src/basetime.c
View file @
7a6f6fe3
...
...
@@ -9,18 +9,16 @@
#include
"cdi.h"
#include
"basetime.h"
#undef UNDEFID
#define UNDEFID CDI_UNDEFID
void
basetimeInit
(
basetime_t
*
basetime
)
{
if
(
basetime
==
NULL
)
Error
(
"Internal problem! Basetime not allocated."
);
basetime
->
ncvarid
=
UNDEFID
;
basetime
->
ncdimid
=
UNDEFID
;
basetime
->
ncvarboundsid
=
UNDEFID
;
basetime
->
leadtimeid
=
UNDEFID
;
basetime
->
ncvarid
=
CDI_
UNDEFID
;
basetime
->
ncdimid
=
CDI_
UNDEFID
;
basetime
->
ncvarboundsid
=
CDI_
UNDEFID
;
basetime
->
leadtimeid
=
CDI_
UNDEFID
;
basetime
->
lwrf
=
false
;
basetime
->
timevar_cache
=
NULL
;
}
...
...
src/cdf_read.c
View file @
7a6f6fe3
...
...
@@ -16,10 +16,6 @@
#include
"vlist.h"
#undef UNDEFID
#define UNDEFID CDI_UNDEFID
static
void
cdfReadGridTraj
(
stream_t
*
streamptr
,
int
gridID
)
{
...
...
@@ -53,7 +49,7 @@ void cdfGetSlapDescription(stream_t *streamptr, int varID, size_t (*start)[4], s
if
(
CDI_Debug
)
Message
(
"tsID = %d"
,
tsID
);
int
xid
=
UNDEFID
,
yid
=
UNDEFID
;
int
xid
=
CDI_
UNDEFID
,
yid
=
CDI_
UNDEFID
;
if
(
gridInqType
(
gridID
)
==
GRID_TRAJECTORY
)
{
cdfReadGridTraj
(
streamptr
,
gridID
);
...
...
@@ -74,9 +70,9 @@ void cdfGetSlapDescription(stream_t *streamptr, int varID, size_t (*start)[4], s
ndims++; \
} while(0)
if
(
tsteptype
!=
TSTEP_CONSTANT
)
addDimension
((
size_t
)
tsID
,
1
);
if
(
zid
!=
UNDEFID
)
addDimension
(
0
,
(
size_t
)
zaxisInqSize
(
zaxisID
));
if
(
yid
!=
UNDEFID
)
addDimension
(
0
,
(
size_t
)
gridInqYsize
(
gridID
));
if
(
xid
!=
UNDEFID
)
addDimension
(
0
,
(
size_t
)
gridInqXsize
(
gridID
));
if
(
zid
!=
CDI_
UNDEFID
)
addDimension
(
0
,
(
size_t
)
zaxisInqSize
(
zaxisID
));
if
(
yid
!=
CDI_
UNDEFID
)
addDimension
(
0
,
(
size_t
)
gridInqYsize
(
gridID
));
if
(
xid
!=
CDI_
UNDEFID
)
addDimension
(
0
,
(
size_t
)
gridInqXsize
(
gridID
));
#undef addDimension
assert
(
ndims
<=
(
int
)(
sizeof
(
*
start
)
/
sizeof
(
**
start
)));
...
...
@@ -365,7 +361,7 @@ void cdfInqDimIds(stream_t *streamptr, int varId, int (*outDimIds)[3])
int
gridId
=
vlistInqVarGrid
(
streamptr
->
vlistID
,
varId
);
int
gridindex
=
vlistGridIndex
(
streamptr
->
vlistID
,
gridId
);
(
*
outDimIds
)[
0
]
=
(
*
outDimIds
)[
1
]
=
(
*
outDimIds
)[
2
]
=
UNDEFID
;
(
*
outDimIds
)[
0
]
=
(
*
outDimIds
)[
1
]
=
(
*
outDimIds
)[
2
]
=
CDI_
UNDEFID
;
switch
(
gridInqType
(
gridId
)
)
{
case
GRID_TRAJECTORY
:
...
...
@@ -390,8 +386,8 @@ void cdfInqDimIds(stream_t *streamptr, int varId, int (*outDimIds)[3])
static
int
cdfGetSkipDim
(
int
fileId
,
int
ncvarid
,
int
(
*
dimIds
)[
3
])
{
if
((
*
dimIds
)[
0
]
!=
UNDEFID
)
return
0
;
if
((
*
dimIds
)[
1
]
!=
UNDEFID
)
return
0
;
if
((
*
dimIds
)[
0
]
!=
CDI_
UNDEFID
)
return
0
;
if
((
*
dimIds
)[
1
]
!=
CDI_
UNDEFID
)
return
0
;
int
nvdims
;
cdf_inq_varndims
(
fileId
,
ncvarid
,
&
nvdims
);
if
(
nvdims
!=
3
)
return
0
;
...
...
@@ -436,7 +432,7 @@ void cdfGetSliceSlapDescription(stream_t *streamptr, int varId, int levelId, boo
int
dimorder
[
3
];
vlistInqVarDimorder
(
vlistId
,
varId
,
&
dimorder
);
*
outSwapXY
=
(
dimorder
[
2
]
==
2
||
dimorder
[
0
]
==
1
)
&&
dimIds
[
0
]
!=
UNDEFID
&&
dimIds
[
1
]
!=
UNDEFID
;
*
outSwapXY
=
(
dimorder
[
2
]
==
2
||
dimorder
[
0
]
==
1
)
&&
dimIds
[
0
]
!=
CDI_
UNDEFID
&&
dimIds
[
1
]
!=
CDI_
UNDEFID
;
int
ndims
=
0
;
...
...
@@ -453,7 +449,7 @@ void cdfGetSliceSlapDescription(stream_t *streamptr, int varId, int levelId, boo
{
size_t
size
;
int
curDimId
=
dimIds
[
dimorder
[
id
]
-
1
];
if
(
curDimId
==
UNDEFID
)
continue
;
if
(
curDimId
==
CDI_
UNDEFID
)
continue
;
switch
(
dimorder
[
id
]
)
{
Error
(
"Internal errror: Malformed dimension order encountered. Please report this bug.
\n
"
);
...
...
src/cdf_write.c
View file @
7a6f6fe3
...
...
@@ -13,10 +13,6 @@
#include
"vlist.h"
#undef UNDEFID
#define UNDEFID CDI_UNDEFID
void
cdfDefVarDeflate
(
int
ncid
,
int
ncvarid
,
int
deflate_level
)
{
#if defined(HAVE_NETCDF4)
...
...
@@ -113,7 +109,7 @@ void cdfDefInstitut(stream_t *streamptr)
int
fileID
=
streamptr
->
fileID
;
int
instID
=
vlistInqInstitut
(
vlistID
);
if
(
instID
!=
UNDEFID
)
if
(
instID
!=
CDI_
UNDEFID
)
{
const
char
*
longname
=
institutInqLongnamePtr
(
instID
);
if
(
longname
)
...
...
@@ -136,7 +132,7 @@ void cdfDefSource(stream_t *streamptr)
int
fileID
=
streamptr
->
fileID
;
int
modelID
=
vlistInqModel
(
vlistID
);
if
(
modelID
!=
UNDEFID
)
if
(
modelID
!=
CDI_
UNDEFID
)
{
const
char
*
longname
=
modelInqNamePtr
(
modelID
);
if
(
longname
)
...
...
@@ -257,7 +253,7 @@ void cdfDefLocalAtts(stream_t *streamptr)
int
fileID
=
streamptr
->
fileID
;
if
(
streamptr
->
localatts
)
return
;
if
(
vlistInqInstitut
(
vlistID
)
!=
UNDEFID
)
return
;
if
(
vlistInqInstitut
(
vlistID
)
!=
CDI_
UNDEFID
)
return
;
streamptr
->
localatts
=
1
;
...
...
@@ -266,7 +262,7 @@ void cdfDefLocalAtts(stream_t *streamptr)
for
(
int
varID
=
0
;
varID
<
streamptr
->
nvars
;
varID
++
)
{
int
instID
=
vlistInqVarInstitut
(
vlistID
,
varID
);
if
(
instID
!=
UNDEFID
)
if
(
instID
!=
CDI_
UNDEFID
)
{
int
ncvarid
=
streamptr
->
vars
[
varID
].
ncvarid
;
const
char
*
name
=
institutInqNamePtr
(
instID
);
...
...
@@ -320,7 +316,7 @@ static
int
cdfDefVar
(
stream_t
*
streamptr
,
int
varID
)
{
int
ncvarid
=
-
1
;
int
xid
=
UNDEFID
,
yid
=
UNDEFID
;
int
xid
=
CDI_
UNDEFID
,
yid
=
CDI_
UNDEFID
;
size_t
xsize
=
0
,
ysize
=
0
;
char
varname
[
CDI_MAX_NAME
];
int
dims
[
4
];
...
...
@@ -338,7 +334,7 @@ int cdfDefVar(stream_t *streamptr, int varID)
if
(
CDI_Debug
)
Message
(
"streamID = %d, fileID = %d, varID = %d"
,
streamptr
->
self
,
fileID
,
varID
);
if
(
streamptr
->
vars
[
varID
].
ncvarid
!=
UNDEFID
)
if
(
streamptr
->
vars
[
varID
].
ncvarid
!=
CDI_
UNDEFID
)
return
streamptr
->
vars
[
varID
].
ncvarid
;
int
vlistID
=
streamptr
->
vlistID
;
...
...
@@ -362,18 +358,18 @@ int cdfDefVar(stream_t *streamptr, int varID)
{
xid
=
streamptr
->
ncgrid
[
gridindex
].
xdimID
;
yid
=
streamptr
->
ncgrid
[
gridindex
].
ydimID
;
if
(
xid
!=
UNDEFID
)
cdf_inq_dimlen
(
fileID
,
xid
,
&
xsize
);
if
(
yid
!=
UNDEFID
)
cdf_inq_dimlen
(
fileID
,
yid
,
&
ysize
);
if
(
xid
!=
CDI_
UNDEFID
)
cdf_inq_dimlen
(
fileID
,
xid
,
&
xsize
);
if
(
yid
!=
CDI_
UNDEFID
)
cdf_inq_dimlen
(
fileID
,
yid
,
&
ysize
);
}
int
zaxisindex
=
vlistZaxisIndex
(
vlistID
,
zaxisID
);
int
zid
=
streamptr
->
zaxisID
[
zaxisindex
];
bool
zaxis_is_scalar
=
false
;
if
(
zid
==
UNDEFID
)
zaxis_is_scalar
=
zaxisInqScalar
(
zaxisID
)
>
0
;
if
(
zid
==
CDI_
UNDEFID
)
zaxis_is_scalar
=
zaxisInqScalar
(
zaxisID
)
>
0
;
if
(
dimorder
[
0
]
!=
3
)
lchunk
=
false
;
/* ZYX and ZXY */
if
(
((
dimorder
[
0
]
>
0
)
+
(
dimorder
[
1
]
>
0
)
+
(
dimorder
[
2
]
>
0
))
<
((
xid
!=
UNDEFID
)
+
(
yid
!=
UNDEFID
)
+
(
zid
!=
UNDEFID
))
)
if
(
((
dimorder
[
0
]
>
0
)
+
(
dimorder
[
1
]
>
0
)
+
(
dimorder
[
2
]
>
0
))
<
((
xid
!=
CDI_
UNDEFID
)
+
(
yid
!=
CDI_
UNDEFID
)
+
(
zid
!=
CDI_
UNDEFID
))
)
{
printf
(
"zid=%d yid=%d xid=%d
\n
"
,
zid
,
yid
,
xid
);
Error
(
"Internal problem, dimension order missing!"
);
...
...
@@ -383,32 +379,32 @@ int cdfDefVar(stream_t *streamptr, int varID)
if
(
tsteptype
!=
TSTEP_CONSTANT
)
{
if
(
tid
==
UNDEFID
)
Error
(
"Internal problem, time undefined!"
);
if
(
tid
==
CDI_
UNDEFID
)
Error
(
"Internal problem, time undefined!"
);
chunks
[
ndims
]
=
1
;
dims
[
ndims
++
]
=
tid
;
axis
[
iax
++
]
=
'T'
;
}
/*
if ( zid != UNDEFID ) axis[iax++] = 'Z';
if ( zid != UNDEFID ) chunks[ndims] = 1;
if ( zid != UNDEFID ) dims[ndims++] = zid;
if ( zid !=
CDI_
UNDEFID ) axis[iax++] = 'Z';
if ( zid !=
CDI_
UNDEFID ) chunks[ndims] = 1;
if ( zid !=
CDI_
UNDEFID ) dims[ndims++] = zid;
if ( yid != UNDEFID ) chunks[ndims] = ysize;
if ( yid != UNDEFID ) dims[ndims++] = yid;
if ( yid !=
CDI_
UNDEFID ) chunks[ndims] = ysize;
if ( yid !=
CDI_
UNDEFID ) dims[ndims++] = yid;
if ( xid != UNDEFID ) chunks[ndims] = xsize;
if ( xid != UNDEFID ) dims[ndims++] = xid;
if ( xid !=
CDI_
UNDEFID ) chunks[ndims] = xsize;
if ( xid !=
CDI_
UNDEFID ) dims[ndims++] = xid;
*/
for
(
int
id
=
0
;
id
<
3
;
++
id
)
{
if
(
dimorder
[
id
]
==
3
&&
zid
!=
UNDEFID
)
if
(
dimorder
[
id
]
==
3
&&
zid
!=
CDI_
UNDEFID
)
{
axis
[
iax
++
]
=
'Z'
;
chunks
[
ndims
]
=
1
;
dims
[
ndims
]
=
zid
;
ndims
++
;
}
else
if
(
dimorder
[
id
]
==
2
&&
yid
!=
UNDEFID
)
else
if
(
dimorder
[
id
]
==
2
&&
yid
!=
CDI_
UNDEFID
)
{
if
(
chunktype
==
CDI_CHUNK_LINES
)
chunks
[
ndims
]
=
1
;
...
...
@@ -417,7 +413,7 @@ int cdfDefVar(stream_t *streamptr, int varID)
dims
[
ndims
]
=
yid
;
ndims
++
;
}
else
if
(
dimorder
[
id
]
==
1
&&
xid
!=
UNDEFID
)
else
if
(
dimorder
[
id
]
==
1
&&
xid
!=
CDI_
UNDEFID
)
{
chunks
[
ndims
]
=
xsize
;
dims
[
ndims
]
=
xid
;
...
...
@@ -583,7 +579,7 @@ int cdfDefVar(stream_t *streamptr, int varID)
cdf_put_att_text
(
fileID
,
ncvarid
,
"param"
,
strlen
(
paramstr
),
paramstr
);
}
if
(
tableID
!=
UNDEFID
)
if
(
tableID
!=
CDI_
UNDEFID
)
{
tablenum
=
tableInqNum
(
tableID
);
if
(
tablenum
>
0
)
...
...
@@ -621,7 +617,7 @@ int cdfDefVar(stream_t *streamptr, int varID)
{
cdf_put_att_text
(
fileID
,
ncvarid
,
"coordinates"
,
9
,
"tlon tlat"
);
}
else
if
(
gridtype
==
GRID_LONLAT
&&
xid
==
UNDEFID
&&
yid
==
UNDEFID
&&
gridsize
==
1
)
else
if
(
gridtype
==
GRID_LONLAT
&&
xid
==
CDI_
UNDEFID
&&
yid
==
CDI_
UNDEFID
&&
gridsize
==
1
)
{
int
ncxvarID
=
streamptr
->
ncgrid
[
gridindex
].
xvarID
;
int
ncyvarID
=
streamptr
->
ncgrid
[
gridindex
].
yvarID
;
...
...
@@ -1009,7 +1005,7 @@ void cdf_write_var(stream_t *streamptr, int varID, int memtype, const void *data
int
zaxisID
=
vlistInqVarZaxis
(
vlistID
,
varID
);
int
tsteptype
=
vlistInqVarTsteptype
(
vlistID
,
varID
);
int
xid
=
UNDEFID
,
yid
=
UNDEFID
;
int
xid
=
CDI_
UNDEFID
,
yid
=
CDI_
UNDEFID
;
if
(
gridInqType
(
gridID
)
==
GRID_TRAJECTORY
)
{
cdfWriteGridTraj
(
streamptr
,
gridID
);
...
...
@@ -1031,14 +1027,14 @@ void cdf_write_var(stream_t *streamptr, int varID, int memtype, const void *data
ndims
++
;
}
if
(
zid
!=
UNDEFID
)
if
(
zid
!=
CDI_
UNDEFID
)
{
start
[
ndims
]
=
0
;
count
[
ndims
]
=
(
size_t
)
zaxisInqSize
(
zaxisID
);
ndims
++
;
}
if
(
yid
!=
UNDEFID
)
if
(
yid
!=
CDI_
UNDEFID
)
{
start
[
ndims
]
=
0
;
cdf_inq_dimlen
(
fileID
,
yid
,
&
size
);
...
...
@@ -1047,7 +1043,7 @@ void cdf_write_var(stream_t *streamptr, int varID, int memtype, const void *data
ndims
++
;
}
if
(
xid
!=
UNDEFID
)
if
(
xid
!=
CDI_
UNDEFID
)
{
start
[
ndims
]
=
0
;
cdf_inq_dimlen
(
fileID
,
xid
,
&
size
);
...
...
@@ -1081,7 +1077,7 @@ void cdf_write_var_chunk(stream_t *streamptr, int varID, int memtype,
{
if
(
streamptr
->
accessmode
==
0
)
cdfEndDef
(
streamptr
);
int
xid
=
UNDEFID
,
yid
=
UNDEFID
;
int
xid
=
CDI_
UNDEFID
,
yid
=
CDI_
UNDEFID
;
size_t
xsize
=
0
,
ysize
=
0
;
size_t
start
[
5
];
size_t
count
[
5
];
...
...
@@ -1128,7 +1124,7 @@ void cdf_write_var_chunk(stream_t *streamptr, int varID, int memtype,
count
[
ndims
]
=
1
;
ndims
++
;
}
if
(
zid
!=
UNDEFID
)
if
(
zid
!=
CDI_
UNDEFID
)
{
int
size
=
zaxisInqSize
(
zaxisID
);
xassert
(
rect
[
2
][
0
]
>=
0
&&
rect
[
2
][
0
]
<=
rect
[
2
][
1
]
...
...
@@ -1137,7 +1133,7 @@ void cdf_write_var_chunk(stream_t *streamptr, int varID, int memtype,
count
[
ndims
]
=
(
size_t
)
rect
[
2
][
1
]
-
(
size_t
)
rect
[
2
][
0
]
+
1
;
ndims
++
;
}
if
(
yid
!=
UNDEFID
)
if
(
yid
!=
CDI_
UNDEFID
)
{
size_t
size
;
cdf_inq_dimlen
(
fileID
,
yid
,
&
size
);
...
...
@@ -1147,7 +1143,7 @@ void cdf_write_var_chunk(stream_t *streamptr, int varID, int memtype,
count
[
ndims
]
=
(
size_t
)
rect
[
1
][
1
]
-
(
size_t
)
rect
[
1
][
0
]
+
1
;
ndims
++
;
}
if
(
xid
!=
UNDEFID
)
if
(
xid
!=
CDI_
UNDEFID
)
{
size_t
size
;
cdf_inq_dimlen
(
fileID
,
xid
,
&
size
);
...
...
@@ -1187,7 +1183,7 @@ void cdf_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtyp
size_t
start
[
5
];
size_t
count
[
5
];
int
dimorder
[
3
];
int
xid
=
UNDEFID
,
yid
=
UNDEFID
;
int
xid
=
CDI_
UNDEFID
,
yid
=
CDI_
UNDEFID
;
if
(
CDI_Debug
)
Message
(
"streamID = %d varID = %d"
,
streamptr
->
self
,
varID
);
...
...
@@ -1220,7 +1216,7 @@ void cdf_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtyp
int
zaxisindex
=
vlistZaxisIndex
(
vlistID
,
zaxisID
);
int
zid
=
streamptr
->
zaxisID
[
zaxisindex
];
bool
swapxy
=
(
dimorder
[
2
]
==
2
||
dimorder
[
0
]
==
1
)
&&
xid
!=
UNDEFID
&&
yid
!=
UNDEFID
;
bool
swapxy
=
(
dimorder
[
2
]
==
2
||
dimorder
[
0
]
==
1
)
&&
xid
!=
CDI_
UNDEFID
&&
yid
!=
CDI_
UNDEFID
;
size_t
ndims
=
0
;
if
(
tsteptype
!=
TSTEP_CONSTANT
)
...
...
@@ -1232,20 +1228,20 @@ void cdf_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtyp
for
(
int
id
=
0
;
id
<
3
;
++
id
)
{
if
(
dimorder
[
id
]
==
3
&&
zid
!=
UNDEFID
)
if
(
dimorder
[
id
]
==
3
&&
zid
!=
CDI_
UNDEFID
)
{
start
[
ndims
]
=
(
size_t
)
levelID
;
count
[
ndims
]
=
1
;
ndims
++
;
}
else
if
(
dimorder
[
id
]
==
2
&&
yid
!=
UNDEFID
)
else
if
(
dimorder
[
id
]
==
2
&&
yid
!=
CDI_
UNDEFID
)
{
start
[
ndims
]
=
0
;
cdf_inq_dimlen
(
fileID
,
yid
,
&
ysize
);
count
[
ndims
]
=
ysize
;
ndims
++
;
}
else
if
(
dimorder
[
id
]
==
1
&&
xid
!=
UNDEFID
)
else
if
(
dimorder
[
id
]
==
1
&&
xid
!=
CDI_
UNDEFID
)
{
start
[
ndims
]
=
0
;
cdf_inq_dimlen
(
fileID
,
xid
,
&
xsize
);
...
...
src/grid.c
View file @
7a6f6fe3
...
...
@@ -20,8 +20,6 @@
#include
"serialize.h"
#include
"vlist.h"
#undef UNDEFID
#define UNDEFID -1
/* the value in the second pair of brackets must match the length of
* the longest string (including terminating NUL) */
...
...
@@ -4509,7 +4507,7 @@ struct addIfNewRes cdiVlistAddGridIfNew(int vlistID, grid_t *grid, int mode)
if
(
mode
==
0
)
for
(
unsigned
index
=
0
;
index
<
ngrids
;
index
++
)
{
if
(
(
gridID
=
vlistptr
->
gridIDs
[
index
])
!=
UNDEFID
)
if
(
(
gridID
=
vlistptr
->
gridIDs
[
index
])
!=
CDI_
UNDEFID
)
{
if
(
gridCompare
(
gridID
,
grid
,
false
)
==
false
)
{
...
...
src/institution.c
View file @
7a6f6fe3
...
...
@@ -15,12 +15,10 @@
#include
"serialize.h"
#include
"institution.h"
#undef UNDEFID
#define UNDEFID -1
static
int
ECMWF
=
UNDEFID
,
MPIMET
=
UNDEFID
,
MCH
=
UNDEFID
;
static
int
ECMWF
=
CDI_
UNDEFID
,
MPIMET
=
CDI_
UNDEFID
,
MCH
=
CDI_
UNDEFID
;
typedef
struct
{
...
...
@@ -53,10 +51,10 @@ static const resOps instituteOps = {
static
void
instituteDefaultValue
(
institute_t
*
instituteptr
)
{
instituteptr
->
self
=
UNDEFID
;
instituteptr
->
self
=
CDI_
UNDEFID
;
instituteptr
->
used
=
0
;
instituteptr
->
center
=
UNDEFID
;
instituteptr
->
subcenter
=
UNDEFID
;
instituteptr
->
center
=
CDI_
UNDEFID
;
instituteptr
->
subcenter
=
CDI_
UNDEFID
;
instituteptr
->
name
=
NULL
;
instituteptr
->
longname
=
NULL
;
}
...
...
@@ -151,14 +149,14 @@ findInstitute(int id, void *res, void *data)
int
institutInq
(
int
center
,
int
subcenter
,
const
char
*
name
,
const
char
*
longname
)
{
institute_t
*
ip_ref
=
(
institute_t
*
)
Malloc
(
sizeof
(
*
ip_ref
));
ip_ref
->
self
=
UNDEFID
;
ip_ref
->
self
=
CDI_
UNDEFID
;
ip_ref
->
used
=
0
;
ip_ref
->
center
=
center
;
ip_ref
->
subcenter
=
subcenter
;
ip_ref
->
name
=
name
&&
name
[
0
]
?
(
char
*
)
name
:
NULL
;
ip_ref
->
longname
=
longname
&&
longname
[
0
]
?
(
char
*
)
longname
:
NULL
;
struct
instLoc
state
=
{
.
ip
=
ip_ref
,
.
id
=
UNDEFID
};
struct
instLoc
state
=
{
.
ip
=
ip_ref
,
.
id
=
CDI_
UNDEFID
};
cdiResHFilterApply
(
&
instituteOps
,
findInstitute
,
&
state
);
Free
(
ip_ref
);
...
...
@@ -202,10 +200,10 @@ int institutInqCenter(int instID)
{
institute_t
*
instituteptr
=
NULL
;
if
(
instID
!=
UNDEFID
)
if
(
instID
!=
CDI_
UNDEFID
)
instituteptr
=
(
institute_t
*
)
reshGetVal
(
instID
,
&
instituteOps
);
return
instituteptr
?
instituteptr
->
center
:
UNDEFID
;
return
instituteptr
?
instituteptr
->
center
:
CDI_
UNDEFID
;
}
...
...
@@ -213,10 +211,10 @@ int institutInqSubcenter(int instID)
{
institute_t
*
instituteptr
=
NULL
;
if
(
instID
!=
UNDEFID
)
if
(
instID
!=
CDI_
UNDEFID
)
instituteptr
=
(
institute_t
*
)
reshGetVal
(
instID
,
&
instituteOps
);
return
instituteptr
?
instituteptr
->
subcenter
:
UNDEFID
;
return
instituteptr
?
instituteptr
->
subcenter
:
CDI_
UNDEFID
;
}
...
...
@@ -224,7 +222,7 @@ const char *institutInqNamePtr(int instID)
{
institute_t
*
instituteptr
=
NULL
;
if
(
instID
!=
UNDEFID
)
if
(
instID
!=
CDI_
UNDEFID
)
instituteptr
=
(
institute_t
*
)
reshGetVal
(
instID
,
&
instituteOps
);
return
instituteptr
?
instituteptr
->
name
:
NULL
;
...
...
@@ -235,7 +233,7 @@ const char *institutInqLongnamePtr(int instID)
{
institute_t
*
instituteptr
=
NULL
;
if
(
instID
!=
UNDEFID
)
if
(
instID
!=
CDI_
UNDEFID
)
instituteptr
=
(
institute_t
*
)
reshGetVal
(
instID
,
&
instituteOps
);
return
instituteptr
?
instituteptr
->
longname
:
NULL
;
...
...
src/model.c
View file @
7a6f6fe3
...
...
@@ -13,12 +13,12 @@
#include
"resource_unpack.h"
#include
"serialize.h"
#undef UNDEFID
#define UNDEFID -1
#undef
CDI_
UNDEFID
#define
CDI_
UNDEFID -1
static
int
ECHAM4
=
UNDEFID
,
ECHAM5
=
UNDEFID
,
COSMO
=
UNDEFID
;
static
int
ECHAM4
=
CDI_
UNDEFID
,
ECHAM5
=
CDI_
UNDEFID
,
COSMO
=
CDI_
UNDEFID
;
typedef
struct
{
...
...
@@ -56,10 +56,10 @@ static const resOps modelOps = {
static
void
modelDefaultValue
(
model_t
*
modelptr
)
{
modelptr
->
self
=
UNDEFID
;
modelptr
->
self
=
CDI_
UNDEFID
;
modelptr
->
used
=
0
;
modelptr
->
instID
=
UNDEFID
;
modelptr
->
modelgribID
=
UNDEFID
;
modelptr
->
instID
=
CDI_
UNDEFID
;
modelptr
->
modelgribID
=
CDI_
UNDEFID
;
modelptr
->
name
=
NULL
;
}
...
...
@@ -186,7 +186,7 @@ int modelInq(int instID, int modelgribID, const char *name)
struct
modelLoc
searchState
=
{
.
name
=
name
,
.
instID
=
instID
,
.
modelgribID
=
modelgribID
,
.
resID
=
UNDEFID
};
.
resID
=
CDI_
UNDEFID
};
if
(
name
&&
*
name
)
cdiResHFilterApply
(
&
modelOps
,
findModelByName
,
&
searchState
);
else
...
...
@@ -213,10 +213,10 @@ int modelInqInstitut(int modelID)
modelInit
();
if
(
modelID
!=
UNDEFID
)
if
(
modelID
!=
CDI_
UNDEFID
)
modelptr
=
(
model_t
*
)
reshGetVal
(
modelID
,
&
modelOps
);
return
modelptr
?
modelptr
->
instID
:
UNDEFID
;
return
modelptr
?
modelptr
->
instID
:
CDI_
UNDEFID
;
}
...
...
@@ -226,10 +226,10 @@ int modelInqGribID(int modelID)
modelInit
();
if
(
modelID
!=
UNDEFID
)
if
(
modelID
!=
CDI_
UNDEFID
)
modelptr
=
(
model_t
*
)
reshGetVal
(
modelID
,
&
modelOps
);
return
modelptr
?
modelptr
->
modelgribID
:
UNDEFID
;
return
modelptr
?
modelptr
->
modelgribID
:
CDI_
UNDEFID
;
}
...
...
@@ -239,7 +239,7 @@ const char *modelInqNamePtr(int modelID)
modelInit
();
if
(
modelID
!=
UNDEFID
)
if
(
modelID
!=
CDI_
UNDEFID
)
modelptr
=
(
model_t
*
)
reshGetVal
(
modelID
,
&
modelOps
);
return
modelptr
?
modelptr
->
name
:
NULL
;
...
...
src/stream_cdf_i.c
View file @
7a6f6fe3
This diff is collapsed.
Click to expand it.
src/stream_cdf_o.c
View file @
7a6f6fe3
...
...
@@ -14,9 +14,6 @@
#include
"zaxis.h"
#undef UNDEFID
#define UNDEFID CDI_UNDEFID
#define POSITIVE_UP 1
#define POSITIVE_DOWN 2
...
...
src/stream_ext.c
View file @
7a6f6fe3
...
...
@@ -20,13 +20,8 @@
#include
"exse.h"
#undef UNDEFID
#define UNDEFID CDI_UNDEFID
#if defined (HAVE_LIBEXTRA)
typedef
struct
{
int
param
;
int
level
;
...
...
@@ -85,7 +80,7 @@ int extInqRecord(stream_t *streamptr, int *varID, int *levelID)
*varID = vlistInqVarID(vlistID, icode);
if ( *varID == UNDEFID ) Error("Code %d undefined", icode);
if ( *varID ==
CDI_
UNDEFID ) Error("Code %d undefined", icode);
zaxisID = vlistInqVarZaxis(vlistID, *varID);
...
...
@@ -630,8 +625,8 @@ int extInqTimestep(stream_t *streamptr, int tsID)
if
(
CDI_Debug
)
Message
(
"tsID = %d rtsteps = %d"
,
tsID
,
streamptr
->
rtsteps
);
long
ntsteps
=
UNDEFID
;
while
(
(
tsID
+
1
)
>
streamptr
->
rtsteps
&&
ntsteps
==
UNDEFID
)
long
ntsteps
=
CDI_
UNDEFID
;
while
(
(
tsID
+
1
)
>
streamptr
->
rtsteps
&&
ntsteps
==
CDI_
UNDEFID
)
ntsteps
=
extScanTimestep
(
streamptr
);
int
nrecs
=
0
;
...
...
src/stream_ieg.c
View file @
7a6f6fe3
...
...
@@ -24,13 +24,8 @@
#include
"exse.h"
#undef UNDEFID
#define UNDEFID CDI_UNDEFID
#if defined (HAVE_LIBIEG)
typedef
struct
{
int
param
;
int
level
;
...
...
@@ -82,7 +77,7 @@ int iegInqRecord(stream_t *streamptr, int *varID, int *levelID)
*varID = vlistInqVarID(vlistID, icode);
if ( *varID == UNDEFID ) Error("Code %d undefined", icode);
if ( *varID ==
CDI_
UNDEFID ) Error("Code %d undefined", icode);
zaxisID = vlistInqVarZaxis(vlistID, *varID);
...
...
@@ -1156,8 +1151,8 @@ int iegInqTimestep(stream_t *streamptr, int tsID)
if
(
CDI_Debug
)
Message
(
"tsID = %d rtsteps = %d"
,
tsID
,
streamptr
->
rtsteps
);
long
ntsteps
=
UNDEFID
;
while
(
(
tsID
+
1
)
>
streamptr
->
rtsteps
&&
ntsteps
==
UNDEFID
)
long
ntsteps
=
CDI_
UNDEFID
;
while
(
(
tsID
+
1
)
>
streamptr
->
rtsteps
&&
ntsteps
==
CDI_
UNDEFID
)
ntsteps
=
iegScanTimestep
(
streamptr
);
int
nrecs
=
0
;
...
...
src/stream_srv.c
View file @
7a6f6fe3
...
...
@@ -21,13 +21,8 @@
#include
"exse.h"
#undef UNDEFID
#define UNDEFID CDI_UNDEFID
#if defined (HAVE_LIBSERVICE)
typedef
struct
{
int
param
;