Commit 039e3e44 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

0003-workaround-for-FORTRAN-compilers-that-can-t-handle-C.patch

parent a4939037
......@@ -415,6 +415,7 @@ int cdiIterator_inqLevelUuid(CdiIterator *me, int *outVgridNumber_optional, int
int cdiIterator_inqTile(CdiIterator *me, int *outTileIndex, int *outTileAttribute); //Returns CDI_EINVAL if there is no tile information connected to the current field, *outTileIndex and *outTileAttribute will be set to -1 in this case.
int cdiIterator_inqTileCount(CdiIterator *me, int *outTileCount, int *outTileAttributeCount); //outTileAttributeCount is the count for the tile associated with the current field, a total attribute count cannot be inquired. Returns CDI_EINVAL if there is no tile information connected to the current field, *outTileCount and *outTileAttributeCount will be set to 0 in this case.
CdiParam cdiIterator_inqParam(CdiIterator *me);
void cdiIterator_inqParamParts(CdiIterator *me, int *outDiscipline, int *outCategory, int *outNumber); //Some FORTRAN compilers produce wrong code for the cdiIterator_inqParam()-wrapper, rendering it unusable from FORTRAN. This function is the workaround.
int cdiIterator_inqDatatype(CdiIterator *me);
int cdiIterator_inqTsteptype(CdiIterator *me);
char *cdiIterator_inqVariableName(CdiIterator *me); //The caller is responsible to Free() the returned buffer.
......
......@@ -818,6 +818,31 @@ CdiParam cdiIterator_inqParam(CdiIterator* me)
return me->param;
}
/*
@Function cdiIterator_inqParamParts
@Title Get discipline, category, and number
@Prototype void cdiIterator_inqParamParts(CdiIterator *me, int *outDiscipline, int *outCategory, int *outNumber)
@Parameter
@item iterator The iterator to operate on.
@item outDiscipline This is used to return the discipline.
@item outCategory This is used to return the category.
@item outNumber This is used to return the number.
@Description
Simple metadata inspection function.
Some FORTRAN compilers produce wrong code for the cdiIterator_inqParam()-wrapper,
rendering it unusable from FORTRAN. This function is the workaround.
*/
void cdiIterator_inqParamParts(CdiIterator *me, int *outDiscipline, int *outCategory, int *outNumber)
{
CdiParam result = cdiIterator_inqParam(me);
if(outDiscipline) *outDiscipline = result.discipline;
if(outCategory) *outCategory = result.category;
if(outNumber) *outNumber = result.number;
}
/*
@Function cdiIterator_inqDatatype
@Title Get the datatype of the current field
......
......@@ -276,6 +276,7 @@ module mo_cdi
public :: cdiIterator_inqTile
public :: cdiIterator_inqTileCount
public :: cdiIterator_inqParam
public :: cdiIterator_inqParamParts
public :: cdiIterator_inqDatatype
public :: cdiIterator_inqTsteptype
public :: cdiIterator_inqVariableName
......@@ -3520,6 +3521,27 @@ contains
f_result = lib_cdiIterator_inqParam(me_dummy%ptr)
end function cdiIterator_inqParam
subroutine cdiIterator_inqParamParts(me_dummy, outDiscipline_dummy,&
& outCategory_dummy, outNumber_dummy)
type(t_CdiIterator), intent(in) :: me_dummy
integer(c_int), intent(inout) :: outDiscipline_dummy
integer(c_int), intent(inout) :: outCategory_dummy
integer(c_int), intent(inout) :: outNumber_dummy
interface
subroutine lib_cdiIterator_inqParamParts(me_dummy, outDiscipline_dummy,&
& outCategory_dummy, outNumber_dummy) bind(c, name =&
& 'cdiIterator_inqParamParts')
import c_int, c_ptr
type(c_ptr), value :: me_dummy
integer(c_int), intent(inout) :: outDiscipline_dummy
integer(c_int), intent(inout) :: outCategory_dummy
integer(c_int), intent(inout) :: outNumber_dummy
end subroutine lib_cdiIterator_inqParamParts
end interface
call lib_cdiIterator_inqParamParts(me_dummy%ptr, outDiscipline_dummy,&
& outCategory_dummy, outNumber_dummy)
end subroutine cdiIterator_inqParamParts
function cdiIterator_inqDatatype(me_dummy) result(f_result)
integer(c_int) :: f_result
type(t_CdiIterator), intent(in) :: me_dummy
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment