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
102c70ad
Commit
102c70ad
authored
Sep 07, 2016
by
Uwe Schulzweida
Browse files
Renamed cdiZaxisDefString to cdiZaxisDefKeyStr.
parent
07f7bf35
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/cdi.h
View file @
102c70ad
...
...
@@ -986,8 +986,8 @@ void zaxisInqUUID(int zaxisID, unsigned char uuid[CDI_UUID_SIZE]);
#define CDI_ZAXIS_LONGNAME 804 // Z-axis longname
#define CDI_ZAXIS_UNITS 805 // Z-axis units
// cdiZaxisDefStr
ing
: Define a CDI Z-axis string value from a key
int
cdiZaxisDefStr
ing
(
int
zaxisID
,
int
key
,
int
size
,
const
char
*
mesg
);
// cdiZaxisDef
Key
Str: Define a CDI Z-axis string value from a key
int
cdiZaxisDef
Key
Str
(
int
zaxisID
,
int
key
,
int
size
,
const
char
*
mesg
);
// cdiZaxisInqString: Get a CDI Z-axis string value from a key
int
cdiZaxisInqString
(
int
zaxisID
,
int
key
,
int
size
,
char
*
mesg
);
...
...
src/cdiFortran.c
View file @
102c70ad
...
...
@@ -420,7 +420,7 @@ FCALLSCSUB2 (zaxisInqUUID, ZAXISINQUUID, zaxisinquuid, INT, PVOID)
/* CDI zaxis string key values */
FCALLSCFUN4
(
INT
,
cdiZaxisDefStr
ing
,
CDIZAXISDEFSTRING
,
cdizaxisdefstring
,
INT
,
INT
,
INT
,
STRING
)
FCALLSCFUN4
(
INT
,
cdiZaxisDef
Key
Str
,
CDIZAXISDEFSTRING
,
cdizaxisdefstring
,
INT
,
INT
,
INT
,
STRING
)
FCALLSCFUN4
(
INT
,
cdiZaxisInqString
,
CDIZAXISINQSTRING
,
cdizaxisinqstring
,
INT
,
INT
,
INT
,
PSTRING
)
FCALLSCSUB2
(
zaxisDefName
,
ZAXISDEFNAME
,
zaxisdefname
,
INT
,
STRING
)
FCALLSCSUB2
(
zaxisInqName
,
ZAXISINQNAME
,
zaxisinqname
,
INT
,
PSTRING
)
...
...
src/grid.c
View file @
102c70ad
...
...
@@ -162,8 +162,8 @@ void grid_init(grid_t *gridptr)
}
static
void
grid_free_components
(
grid_t
*
gridptr
)
static
void
grid_free_components
(
grid_t
*
gridptr
)
{
void
*
p2free
[]
=
{
gridptr
->
mask
,
gridptr
->
mask_gme
,
gridptr
->
x
.
vals
,
gridptr
->
y
.
vals
,
...
...
@@ -171,7 +171,7 @@ grid_free_components(grid_t *gridptr)
gridptr
->
rowlon
,
gridptr
->
area
,
gridptr
->
reference
,
gridptr
->
name
};
for
(
size_t
i
=
0
;
i
<
sizeof
(
p2free
)
/
sizeof
(
p2free
[
0
]);
++
i
)
for
(
size_t
i
=
0
;
i
<
sizeof
(
p2free
)
/
sizeof
(
p2free
[
0
]);
++
i
)
if
(
p2free
[
i
]
)
Free
(
p2free
[
i
]);
}
...
...
@@ -187,7 +187,7 @@ grid_t *gridNewEntry(cdiResH resH)
grid_t
*
gridptr
=
(
grid_t
*
)
Malloc
(
sizeof
(
grid_t
));
grid_init
(
gridptr
);
if
(
resH
==
CDI_UNDEFID
)
if
(
resH
==
CDI_UNDEFID
)
gridptr
->
self
=
reshPut
(
gridptr
,
&
gridOps
);
else
{
...
...
@@ -201,28 +201,26 @@ grid_t *gridNewEntry(cdiResH resH)
static
void
gridInit
(
void
)
{
static
int
gridInitialized
=
0
;
static
bool
gridInitialized
=
false
;
if
(
gridInitialized
)
return
;
gridInitialized
=
1
;
gridInitialized
=
true
;
const
char
*
env
=
getenv
(
"GRID_DEBUG"
);
if
(
env
)
GRID_Debug
=
atoi
(
env
);
}
static
void
grid_copy_base_scalar_fields
(
grid_t
*
gridptrOrig
,
grid_t
*
gridptrDup
)
static
void
grid_copy_base_scalar_fields
(
grid_t
*
gridptrOrig
,
grid_t
*
gridptrDup
)
{
memcpy
(
gridptrDup
,
gridptrOrig
,
sizeof
(
grid_t
));
gridptrDup
->
self
=
CDI_UNDEFID
;
if
(
gridptrOrig
->
reference
)
if
(
gridptrOrig
->
reference
)
gridptrDup
->
reference
=
strdupx
(
gridptrOrig
->
reference
);
}
static
grid_t
*
grid_copy_base
(
grid_t
*
gridptrOrig
)
static
grid_t
*
grid_copy_base
(
grid_t
*
gridptrOrig
)
{
grid_t
*
gridptrDup
=
(
grid_t
*
)
Malloc
(
sizeof
(
*
gridptrDup
));
gridptrOrig
->
vtable
->
copyScalarFields
(
gridptrOrig
,
gridptrDup
);
...
...
@@ -609,14 +607,14 @@ int cdiGridDefKeyStr(int gridID, int key, int size, const char *mesg)
grid_t
*
gridptr
=
gridID2Ptr
(
gridID
);
char
*
gridstring
=
(
char
*
)
grid_key_to_ptr
(
gridptr
,
key
);
if
(
gridstring
==
NULL
)
char
*
keyptr
=
(
char
*
)
grid_key_to_ptr
(
gridptr
,
key
);
if
(
keyptr
==
NULL
)
{
Warning
(
"CDI grid string key %d not supported!"
,
key
);
return
-
1
;
}
gridSetString
(
gridstring
,
mesg
,
(
size_t
)
size
);
gridSetString
(
keyptr
,
mesg
,
(
size_t
)
size
);
gridMark4Update
(
gridID
);
return
0
;
...
...
@@ -649,14 +647,14 @@ int cdiGridInqKeyStr(int gridID, int key, int size, char *mesg)
if
(
size
<
1
||
mesg
==
NULL
)
return
-
1
;
grid_t
*
gridptr
=
gridID2Ptr
(
gridID
);
const
char
*
gridstring
=
(
const
char
*
)
grid_key_to_ptr
(
gridptr
,
key
);
if
(
gridstring
==
NULL
)
const
char
*
keyptr
=
(
const
char
*
)
grid_key_to_ptr
(
gridptr
,
key
);
if
(
keyptr
==
NULL
)
{
Warning
(
"CDI grid string key %d not supported!"
,
key
);
return
-
1
;
}
gridGetString
(
mesg
,
gridstring
,
(
size_t
)
size
);
gridGetString
(
mesg
,
keyptr
,
(
size_t
)
size
);
return
0
;
}
...
...
src/stream_cdf_i.c
View file @
102c70ad
...
...
@@ -2890,10 +2890,10 @@ void cdf_define_all_zaxes(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int
if
(
is_scalar
)
zaxisDefScalar
(
ncvar
->
zaxisID
);
if
(
zdimid
!=
-
1
)
cdiZaxisDefStr
ing
(
ncvar
->
zaxisID
,
CDI_ZAXIS_DIMNAME
,
(
int
)(
strlen
(
ncdims
[
zdimid
].
name
)
+
1
),
ncdims
[
zdimid
].
name
);
cdiZaxisDef
Key
Str
(
ncvar
->
zaxisID
,
CDI_ZAXIS_DIMNAME
,
(
int
)(
strlen
(
ncdims
[
zdimid
].
name
)
+
1
),
ncdims
[
zdimid
].
name
);
/*
if ( vdimid != -1 )
cdiZaxisDefStr
ing
(ncvar->zaxisID, CDI_ZAXIS_VDIMNAME, strlen(ncdims[vdimid].name)+1, ncdims[vdimid].name);
cdiZaxisDef
Key
Str(ncvar->zaxisID, CDI_ZAXIS_VDIMNAME, strlen(ncdims[vdimid].name)+1, ncdims[vdimid].name);
*/
Free
(
zvar
);
Free
(
lbounds
);
...
...
src/zaxis.c
View file @
102c70ad
...
...
@@ -174,7 +174,7 @@ zaxis_t *zaxisNewEntry(int id)
zaxisDefaultValue
(
zaxisptr
);
if
(
id
==
CDI_UNDEFID
)
if
(
id
==
CDI_UNDEFID
)
zaxisptr
->
self
=
reshPut
(
zaxisptr
,
&
zaxisOps
);
else
{
...
...
@@ -185,8 +185,8 @@ zaxis_t *zaxisNewEntry(int id)
return
zaxisptr
;
}
static
inline
zaxis_t
*
zaxisID2Ptr
(
int
id
)
static
inline
zaxis_t
*
zaxisID2Ptr
(
int
id
)
{
return
(
zaxis_t
*
)
reshGetVal
(
id
,
&
zaxisOps
);
}
...
...
@@ -199,7 +199,7 @@ void zaxisInit(void)
if
(
zaxisInitialized
)
return
;
zaxisInitialized
=
true
;
char
*
env
=
getenv
(
"ZAXIS_DEBUG"
);
const
char
*
env
=
getenv
(
"ZAXIS_DEBUG"
);
if
(
env
)
ZAXIS_Debug
=
atoi
(
env
);
}
...
...
@@ -248,7 +248,6 @@ zaxisCreate_(int zaxistype, int size, int id)
return
zaxisID
;
}
/*
@Function zaxisCreate
@Title Create a vertical Z-axis
...
...
@@ -291,8 +290,7 @@ zaxisDefLevels(zaxisID, levs);
*/
int
zaxisCreate
(
int
zaxistype
,
int
size
)
{
if
(
CDI_Debug
)
Message
(
"zaxistype: %d size: %d "
,
zaxistype
,
size
);
if
(
CDI_Debug
)
Message
(
"zaxistype: %d size: %d "
,
zaxistype
,
size
);
zaxisInit
();
return
zaxisCreate_
(
zaxistype
,
size
,
CDI_UNDEFID
);
...
...
@@ -329,15 +327,14 @@ static void zaxisDestroyKernel( zaxis_t * zaxisptr )
void
zaxisDestroy
(
int
zaxisID
)
{
zaxis_t
*
zaxisptr
=
zaxisID2Ptr
(
zaxisID
);
zaxisDestroyKernel
(
zaxisptr
);
zaxisDestroyKernel
(
zaxisptr
);
}
static
void
zaxisDestroyP
(
void
*
zaxisptr
)
void
zaxisDestroyP
(
void
*
zaxisptr
)
{
zaxisDestroyKernel
((
zaxis_t
*
)
zaxisptr
);
zaxisDestroyKernel
((
zaxis_t
*
)
zaxisptr
);
}
...
...
@@ -374,22 +371,22 @@ void zaxisGetString(char *name, const char *zaxisstrname, size_t len)
static
char
*
zaxis_key_to_string
(
zaxis_t
*
zaxisptr
,
int
key
)
{
char
*
zaxisstring
=
NULL
;
char
*
keyptr
=
NULL
;
switch
(
key
)
{
case
CDI_ZAXIS_DIMNAME
:
zaxisstring
=
zaxisptr
->
dimname
;
break
;
case
CDI_ZAXIS_VDIMNAME
:
zaxisstring
=
zaxisptr
->
vdimname
;
break
;
case
CDI_ZAXIS_DIMNAME
:
keyptr
=
zaxisptr
->
dimname
;
break
;
case
CDI_ZAXIS_VDIMNAME
:
keyptr
=
zaxisptr
->
vdimname
;
break
;
}
return
zaxisstring
;
return
keyptr
;
}
/*
@Function cdiZaxisDefStr
ing
@Function cdiZaxisDef
Key
Str
@Title Define a CDI Z-axis string value from a key
@Prototype int cdiZaxisDefStr
ing
(int zaxisID, int key, int size, const char *mesg)
@Prototype int cdiZaxisDef
Key
Str(int zaxisID, int key, int size, const char *mesg)
@Parameter
@Item zaxisID Z-axis ID, from a previous call to @fref{zaxisCreate}.
@Item key The key to be searched
...
...
@@ -397,27 +394,27 @@ char *zaxis_key_to_string(zaxis_t *zaxisptr, int key)
@Item mesg The address of a string where the data will be read
@Description
The function @func{cdiZaxisDefStr
ing
} defines a CDI Z-axis string value from a key.
The function @func{cdiZaxisDef
Key
Str} defines a CDI Z-axis string value from a key.
@Result
@func{cdiZaxisDefStr
ing
} returns 0 if OK and integer value on error.
@func{cdiZaxisDef
Key
Str} returns 0 if OK and integer value on error.
@EndFunction
*/
int
cdiZaxisDefStr
ing
(
int
zaxisID
,
int
key
,
int
size
,
const
char
*
mesg
)
int
cdiZaxisDef
Key
Str
(
int
zaxisID
,
int
key
,
int
size
,
const
char
*
mesg
)
{
if
(
size
<
=
0
||
mesg
==
NULL
||
*
mesg
==
0
)
return
-
1
;
if
(
size
<
1
||
mesg
==
NULL
||
*
mesg
==
0
)
return
-
1
;
zaxis_t
*
zaxisptr
=
zaxisID2Ptr
(
zaxisID
);
char
*
zaxisstring
=
zaxis_key_to_string
(
zaxisptr
,
key
);
if
(
zaxisstring
==
NULL
)
char
*
keyptr
=
zaxis_key_to_string
(
zaxisptr
,
key
);
if
(
keyptr
==
NULL
)
{
Warning
(
"CDI zaxis string key %d not supported!"
,
key
);
return
-
1
;
}
zaxisSetString
(
zaxisstring
,
mesg
,
(
size_t
)
size
);
zaxisSetString
(
keyptr
,
mesg
,
(
size_t
)
size
);
reshSetStatus
(
zaxisID
,
&
zaxisOps
,
RESH_DESYNC_IN_USE
);
return
0
;
...
...
@@ -447,17 +444,17 @@ The function @func{cdiZaxisInqString} return a CDI Z-axis string value from a ke
*/
int
cdiZaxisInqString
(
int
zaxisID
,
int
key
,
int
size
,
char
*
mesg
)
{
if
(
size
<
=
0
||
mesg
==
NULL
)
return
-
1
;
if
(
size
<
1
||
mesg
==
NULL
)
return
-
1
;
zaxis_t
*
zaxisptr
=
zaxisID2Ptr
(
zaxisID
);
const
char
*
zaxisstring
=
zaxis_key_to_string
(
zaxisptr
,
key
);
if
(
zaxisstring
==
NULL
)
const
char
*
keyptr
=
zaxis_key_to_string
(
zaxisptr
,
key
);
if
(
keyptr
==
NULL
)
{
Warning
(
"CDI zaxis string key %d not supported!"
,
key
);
return
-
1
;
}
zaxisGetString
(
mesg
,
zaxisstring
,
(
size_t
)
size
);
zaxisGetString
(
mesg
,
keyptr
,
(
size_t
)
size
);
return
0
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment