diff --git a/src/g2cf.F90 b/src/g2cf.F90 index 816e20bf..4e7a3962 100644 --- a/src/g2cf.F90 +++ b/src/g2cf.F90 @@ -146,7 +146,7 @@ function g2cf_inq(g2id, num_msg) result(status) implicit none integer, intent(in) :: g2id - integer(c_int), intent(out) :: num_msg + integer, intent(out) :: num_msg integer :: status integer(c_int) :: cg2id, cnum_msg, cstatus @@ -178,19 +178,30 @@ function g2cf_inq_msg(g2id, msg_num, discipline, num_fields, & use g2c_interface implicit none - integer, intent(in) :: g2id - integer(c_int), intent(in) :: msg_num - integer(c_signed_char), intent(out) :: discipline - integer(c_int), intent(out) :: num_fields, num_local - integer(c_short), intent(out) :: center, subcenter - integer(c_signed_char), intent(out) :: master_version, local_version + integer, intent(in) :: g2id, msg_num + integer, intent(out) :: discipline + integer, intent(out) :: num_fields, num_local + integer(kind = 2), intent(out) :: center, subcenter + integer(kind = 2), intent(out) :: master_version, local_version integer :: status - - integer(c_int) :: cg2id, cnum_msg, cstatus + + integer(c_int) :: cg2id, cmsg_num, cstatus + integer(c_signed_char) :: cdiscipline + integer(c_int) :: cnum_fields, cnum_local + integer(c_short) :: ccenter, csubcenter + integer(c_signed_char) :: cmaster_version, clocal_version cg2id = g2id - cstatus = g2c_inq(cg2id, cnum_msg) - !num_msg = cnum_msg + cmsg_num = msg_num + cstatus = g2c_inq_msg(cg2id, cmsg_num, cdiscipline, cnum_fields, & + cnum_local, ccenter, csubcenter, cmaster_version, clocal_version) + discipline = cdiscipline + num_fields = cnum_fields + num_local = cnum_local + center = ccenter + subcenter = csubcenter + master_version = cmaster_version + local_version = clocal_version status = cstatus end function g2cf_inq_msg diff --git a/tests/test_g2cf.F90 b/tests/test_g2cf.F90 index cb6e2aa0..474d3da9 100644 --- a/tests/test_g2cf.F90 +++ b/tests/test_g2cf.F90 @@ -26,11 +26,11 @@ program test_g2cf if (ierr .ne. 0) stop 10 if (num_msg .ne. 19) stop 11 - ! ! Check the last message. - ! ierr = g2cf_inq_msg(g2cid, 19, discipline, num_fields, num_local, center, subcenter, & - ! master_version, local_version) - ! if (discipline .ne. 10 .or. num_fields .ne. 1 .or. num_local .ne. 0 .or. center .ne. 7 .or. & - ! subcenter .ne. 0 .or. master_version .ne. 2 .or. local_version .ne. 1) stop 12 + ! Check the last message. + ierr = g2cf_inq_msg(g2cid, 19, discipline, num_fields, num_local, center, subcenter, & + master_version, local_version) + if (discipline .ne. 10 .or. num_fields .ne. 1 .or. num_local .ne. 0 .or. center .ne. 7 .or. & + subcenter .ne. 0 .or. master_version .ne. 2 .or. local_version .ne. 1) stop 12 ! Close the file. ierr = g2cf_close(g2cid)