1!****h* ROBODoc/H5R (F03)
2!
3! NAME
4!  MODULE H5R_PROVISIONAL
5!
6! FILE
7!  fortran/src/H5Rff_F03.f90
8!
9! PURPOSE
10!  This file contains Fortran 90 and Fortran 2003 interfaces for H5R functions.
11!  It contains the same functions as H5Rff_DEPRECIATE.f90 but includes the
12!  Fortran 2003 functions and the interface listings. This file will be compiled
13!  instead of H5Rff_DEPRECIATE.f90 if Fortran 2003 functions are enabled.
14!
15! COPYRIGHT
16!  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
17!  Copyright by The HDF Group.                                                 *
18!  Copyright by the Board of Trustees of the University of Illinois.           *
19!  All rights reserved.                                                        *
20!                                                                              *
21!  This file is part of HDF5.  The full HDF5 copyright notice, including       *
22!  terms governing use, modification, and redistribution, is contained in      *
23!   the COPYING file, which can be found at the root of the source code       *
24!   distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.  *
25!   If you do not have access to either file, you may request a copy from     *
26!   help@hdfgroup.org.                                                        *
27!  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
28!
29! NOTES
30!                         *** IMPORTANT ***
31!  If you add a new H5R function you must add the function name to the
32!  Windows dll file 'hdf5_fortrandll.def.in' in the fortran/src directory.
33!  This is needed for Windows based operating systems.
34!
35!*****
36MODULE H5R_PROVISIONAL
37  USE H5GLOBAL
38  USE, INTRINSIC :: ISO_C_BINDING
39
40  ! If you change the value of these parameters, do not forget to change corresponding
41  ! values in the H5f90.h file.
42  !        INTEGER, PARAMETER :: REF_OBJ_BUF_LEN = 2
43  !        INTEGER, PARAMETER :: REF_REG_BUF_LEN = 3
44  !
45  !        TYPE hobj_ref_t_f
46  !             INTEGER ref(REF_OBJ_BUF_LEN)
47  !        END TYPE
48  !
49  !        TYPE hdset_reg_ref_t_f
50  !             INTEGER ref(REF_REG_BUF_LEN)
51  !        END TYPE
52  !
53
54  TYPE :: hdset_reg_ref_t_f03
55     INTEGER(C_SIGNED_CHAR), DIMENSION(1:H5R_DSET_REG_REF_BUF_SIZE_F) :: ref
56  END TYPE hdset_reg_ref_t_f03
57
58  INTERFACE h5rget_region_f
59
60     MODULE PROCEDURE h5rget_region_region_f ! obsolete
61     MODULE PROCEDURE h5rget_region_ptr_f  ! F2003
62
63  END INTERFACE
64
65
66  INTERFACE h5rcreate_f
67
68     MODULE PROCEDURE h5rcreate_object_f ! obsolete
69     MODULE PROCEDURE h5rcreate_region_f ! obsolete
70     MODULE PROCEDURE h5rcreate_ptr_f  ! F2003
71
72  END INTERFACE
73
74  INTERFACE h5rdereference_f
75
76     MODULE PROCEDURE h5rdereference_object_f ! obsolete
77     MODULE PROCEDURE h5rdereference_region_f ! obsolete
78     MODULE PROCEDURE h5rdereference_ptr_f ! F2003
79
80  END INTERFACE
81
82  INTERFACE h5rget_name_f
83
84     MODULE PROCEDURE h5rget_name_object_f ! obsolete
85     MODULE PROCEDURE h5rget_name_region_f ! obsolete
86     MODULE PROCEDURE h5rget_name_ptr_f ! F2003
87
88  END INTERFACE
89
90  INTERFACE
91     INTEGER FUNCTION h5rget_name_ptr_c(loc_id, ref_type, ref, name, name_len, size_default) &
92          BIND(C, NAME='h5rget_name_ptr_c')
93       USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_char, c_ptr
94       USE H5GLOBAL
95       INTEGER(HID_T), INTENT(IN) :: loc_id
96       INTEGER, INTENT(IN) :: ref_type
97       TYPE(C_PTR), INTENT(IN), VALUE :: ref
98       CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name
99       INTEGER(SIZE_T) :: name_len
100       INTEGER(SIZE_T) :: size_default
101     END FUNCTION h5rget_name_ptr_c
102  END INTERFACE
103
104  INTERFACE
105     INTEGER FUNCTION h5rdereference_ptr_c(obj_id, ref_type, ref, ref_obj_id) &
106          BIND(C, NAME='h5rdereference_ptr_c')
107       USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_ptr
108       USE H5GLOBAL
109       INTEGER(HID_T), INTENT(IN) :: obj_id
110       INTEGER, INTENT(IN) :: ref_type
111       TYPE(C_PTR), INTENT(IN), VALUE :: ref
112       INTEGER(HID_T), INTENT(OUT) :: ref_obj_id
113     END FUNCTION h5rdereference_ptr_c
114  END INTERFACE
115
116  INTERFACE
117     INTEGER FUNCTION h5rcreate_ptr_c(ref, loc_id, name, namelen, ref_type, space_id) &
118          BIND(C, NAME='h5rcreate_ptr_c')
119       USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_char, c_ptr
120       USE H5GLOBAL
121       TYPE(C_PTR), VALUE :: ref
122       INTEGER(HID_T), INTENT(IN) :: loc_id
123       CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: name
124       INTEGER :: namelen
125       INTEGER, INTENT(IN) :: ref_type
126       INTEGER(HID_T), INTENT(IN) :: space_id
127     END FUNCTION h5rcreate_ptr_c
128  END INTERFACE
129
130  INTERFACE
131     INTEGER FUNCTION h5rget_region_ptr_c(dset_id, ref, space_id) &
132          BIND(C, NAME='h5rget_region_ptr_c')
133       USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_ptr
134       USE H5GLOBAL
135       INTEGER(HID_T), INTENT(IN) :: dset_id
136       TYPE(C_PTR), VALUE :: ref
137       INTEGER(HID_T), INTENT(OUT) :: space_id
138     END FUNCTION h5rget_region_ptr_c
139  END INTERFACE
140
141CONTAINS
142
143!****s* H5R/h5rget_region_region_f
144!
145! NAME
146!  h5rget_region_region_f
147!
148! PURPOSE
149!  Retrieves a dataspace with the specified region selected
150!
151! INPUTS
152!  dset_id 	 - identifier of the dataset containing
153!                  reference to the regions
154!  ref 	         - reference to open
155! OUTPUTS
156!  space_id 	 - dataspace identifier
157!  hdferr 	 - Returns 0 if successful and -1 if fails
158! AUTHOR
159!  Elena Pourmal
160!  August 12, 1999
161!
162! HISTORY
163!  Explicit Fortran interfaces were added for
164!  called C functions (it is needed for Windows
165!  port).  February 28, 2001
166!
167! NOTES
168!  This is a module procedure for the h5rget_region_f subroutine.
169!
170! SOURCE
171  SUBROUTINE h5rget_region_region_f(dset_id, ref, space_id, hdferr)
172    IMPLICIT NONE
173    INTEGER(HID_T), INTENT(IN) :: dset_id      ! Dataset identifier
174    TYPE(hdset_reg_ref_t_f), INTENT(IN) :: ref ! Dataset region reference
175    INTEGER(HID_T), INTENT(OUT) :: space_id    ! Space identifier
176    INTEGER, INTENT(OUT) :: hdferr             ! Error code
177!*****
178    INTEGER :: ref_f(REF_REG_BUF_LEN)          ! Local buffer to pass reference
179
180    INTERFACE
181       INTEGER FUNCTION h5rget_region_region_c(dset_id, ref_f, space_id)
182         USE H5GLOBAL
183         !DEC$IF DEFINED(HDF5F90_WINDOWS)
184         !DEC$ATTRIBUTES C,reference,decorate,alias:'H5RGET_REGION_REGION_C':: h5rget_region_region_c
185         !DEC$ENDIF
186         INTEGER(HID_T), INTENT(IN) :: dset_id
187         !              INTEGER, PARAMETER :: REF_REG_BUF_LEN = 3
188         INTEGER :: ref_f(REF_REG_BUF_LEN)
189         INTEGER(HID_T), INTENT(OUT) :: space_id
190       END FUNCTION h5rget_region_region_c
191    END INTERFACE
192
193    ref_f = ref%ref
194    hdferr = h5rget_region_region_c(dset_id, ref_f, space_id )
195
196  END SUBROUTINE h5rget_region_region_f
197
198!****s* H5R/h5rget_region_ptr_f
199!
200! NAME
201!  h5rget_region_ptr_f
202!
203! PURPOSE
204!  Retrieves a dataspace with the specified region
205!  selected using pointer
206!
207! INPUTS
208!  dset_id 	 - identifier of the dataset containing
209!                  reference to the regions
210!  ref 	         - reference to open
211! OUTPUTS
212!  space_id 	 - dataspace identifier
213!  hdferr 	 - Returns 0 if successful and -1 if fails
214! AUTHOR
215!  M. Scot Breitenfeld
216!  August 4, 2012
217!
218! NOTES
219!  This is a module procedure for the h5rget_region_f subroutine.
220!
221! SOURCE
222  SUBROUTINE h5rget_region_ptr_f(dset_id, ref, space_id, hdferr)
223    IMPLICIT NONE
224    INTEGER(HID_T), INTENT(IN) :: dset_id      ! Dataset identifier
225    TYPE(C_PTR), INTENT(IN) :: ref ! Dataset region reference
226    INTEGER(HID_T), INTENT(OUT) :: space_id    ! Space identifier
227    INTEGER, INTENT(OUT) :: hdferr             ! Error code
228!*****
229
230    hdferr = h5rget_region_ptr_c(dset_id, ref, space_id )
231
232  END SUBROUTINE h5rget_region_ptr_f
233
234
235!****s* H5R (F03)/h5rcreate_object_f
236!
237! NAME
238!  h5rcreate_object_f
239!
240! PURPOSE
241!  Creates reference to the object
242!
243! Inputs:
244!  loc_id    - location identifier
245!  name      - name of the object at the specified location
246! Outputs:
247!  ref 	     - reference to the specified object
248!  hdferr    - returns 0 if successful and -1 if fails
249! AUTHOR
250!  Elena Pourmal
251!  August 12, 1999
252!
253! HISTORY
254!  Explicit Fortran interfaces were added for
255!  called C functions (it is needed for Windows
256!  port).  February 28, 2001
257!
258! NOTES
259!  This is a module procedure for the h5rcreate_f subroutine.
260!
261! Signature:
262  SUBROUTINE h5rcreate_object_f(loc_id, name, ref, hdferr)
263    USE, INTRINSIC :: ISO_C_BINDING
264    IMPLICIT NONE
265    INTEGER(HID_T), INTENT(IN) :: loc_id   ! Location identifier
266    CHARACTER(LEN=*), INTENT(IN) :: name   ! Name of the object at location specified
267                                           ! by loc_id identifier
268    TYPE(hobj_ref_t_f), INTENT(INOUT), TARGET :: ref   ! Object reference
269    INTEGER, INTENT(OUT) :: hdferr         ! Error code
270!*****
271    INTEGER :: namelen                     ! Name length
272    TYPE(C_PTR) :: f_ptr
273
274    f_ptr = C_LOC(ref)
275
276    namelen = LEN(name)
277
278    hdferr = h5rcreate_ptr_c(f_ptr, loc_id, name, namelen, INT(0), INT(-1,HID_T))
279
280  END SUBROUTINE h5rcreate_object_f
281
282!****s* H5R (F90)/h5rcreate_region_f
283!
284! NAME
285!  h5rcreate_region_f
286!
287! PURPOSE
288!  Creates reference to the dataset region
289!
290! INPUTS
291!  loc_id 	 - location identifier
292!  name 	 - name of the dataset at the specified location
293!  space_id 	 - dataspace identifier that describes selected region
294! OUTPUTS
295!  ref 	         - reference to the dataset region
296!  hdferr        - returns 0 if successful and -1 if fails
297! AUTHOR
298!  Elena Pourmal
299!  August 12, 1999
300!
301! HISTORY
302!  Explicit Fortran interfaces were added for
303!  called C functions (it is needed for Windows
304!  port).  February 28, 2001
305!
306! NOTES
307!  This is a module procedure for the h5rcreate_f subroutine.
308!
309! SOURCE
310  SUBROUTINE h5rcreate_region_f(loc_id, name, space_id, ref, hdferr)
311    IMPLICIT NONE
312    INTEGER(HID_T), INTENT(IN) :: loc_id   ! Location identifier
313    CHARACTER(LEN=*), INTENT(IN) :: name   ! Name of the dataset at location specified
314                                           ! by loc_id identifier
315    INTEGER(HID_T), INTENT(IN) :: space_id ! Dataset's dataspace identifier
316    TYPE(hdset_reg_ref_t_f), INTENT(OUT) :: ref ! Dataset region reference
317    INTEGER, INTENT(OUT) :: hdferr         ! Error code
318!*****
319    INTEGER :: namelen                     ! Name length
320    INTEGER :: ref_f(REF_REG_BUF_LEN)      ! Local buffer to pass reference
321
322    INTERFACE
323       INTEGER FUNCTION h5rcreate_region_c(ref_f, loc_id, name, namelen, space_id)
324         USE H5GLOBAL
325         !DEC$IF DEFINED(HDF5F90_WINDOWS)
326         !DEC$ATTRIBUTES C,reference,decorate,alias:'H5RCREATE_REGION_C':: h5rcreate_region_c
327         !DEC$ENDIF
328         !DEC$ATTRIBUTES reference :: name
329         !              INTEGER, PARAMETER :: REF_REG_BUF_LEN = 3
330         INTEGER :: ref_f(REF_REG_BUF_LEN)
331         INTEGER(HID_T), INTENT(IN) :: loc_id
332         CHARACTER(LEN=*), INTENT(IN) :: name
333         INTEGER :: namelen
334         INTEGER(HID_T), INTENT(IN) :: space_id
335       END FUNCTION h5rcreate_region_c
336    END INTERFACE
337
338    namelen = LEN(name)
339    ref_f = 0
340    hdferr = h5rcreate_region_c(ref_f, loc_id, name, namelen, space_id )
341    ref%ref = ref_f
342
343  END SUBROUTINE h5rcreate_region_f
344
345!****s* H5R (F03)/h5rcreate_ptr_f
346!
347! NAME
348!  h5rcreate_ptr_f
349!
350! PURPOSE
351!  Creates a reference.
352!
353! Inputs:
354!  loc_id     - location identifier
355!  name	      - name of the dataset at the specified location
356!  ref_type   - type of reference:
357!                H5R_OBJECT
358!                H5T_STD_REF_DSETREG
359! Outputs:
360!  ref	      - reference created by the function call.
361!  hdferr     - returns 0 if successful and -1 if fails.
362! OPTIONAL
363!  space_id   - dataspace identifier that describes selected region
364!
365! AUTHOR
366!  M. Scot Breitenfeld
367!  June 20, 2008
368!
369! NOTES
370!  This is a module procedure for the h5rcreate_f
371!  subroutine where the output is a pointer.
372!
373! Signature:
374  SUBROUTINE h5rcreate_ptr_f(loc_id, name, ref_type, ref, hdferr, space_id)
375    USE, INTRINSIC :: ISO_C_BINDING
376    IMPLICIT NONE
377    INTEGER(HID_T), INTENT(IN) :: loc_id     ! Location identifier
378    CHARACTER(LEN=*), INTENT(IN) :: name     ! Name of the dataset at location specified
379                                             ! by loc_id identifier
380    INTEGER, INTENT(IN) :: ref_type          ! type of reference
381    TYPE(C_PTR), INTENT(INOUT) :: ref        ! Reference created by the function call
382    INTEGER, INTENT(OUT) :: hdferr           ! Error code
383    INTEGER(HID_T), INTENT(IN), OPTIONAL :: space_id ! Dataset's dataspace identifier
384!*****
385    INTEGER :: namelen                       ! Name length
386    INTEGER(HID_T) :: space_id_c
387
388    namelen = LEN(name)
389    space_id_c = -1
390    IF(PRESENT(space_id)) space_id_c =  space_id
391    hdferr = h5rcreate_ptr_c(ref, loc_id, name, namelen, ref_type, space_id_c)
392
393  END SUBROUTINE h5rcreate_ptr_f
394!****s* H5R (F03)/h5rdereference_object_f
395!
396! NAME
397!  h5rdereference_object_f
398!
399! PURPOSE
400!  Opens the HDF5 object referenced
401!
402! Inputs:
403!  dset_id  - identifier of the dataset containing
404!             reference
405!  ref 	    - reference to open
406! Outputs:
407!  obj_id   - object_identifier
408!  hdferr   - returns 0 if successful and -1 if fails
409! AUTHOR
410!  Elena Pourmal
411!  August 12, 1999
412!
413! HISTORY
414!  Explicit Fortran interfaces were added for
415!  called C functions (it is needed for Windows
416!  port).  February 28, 2001
417!
418! NOTES
419!  This is a module procedure for the h5rdereference_f subroutine.
420!
421! Signature:
422  SUBROUTINE h5rdereference_object_f(obj_id, ref, ref_obj_id, hdferr)
423    USE, INTRINSIC :: ISO_C_BINDING
424    IMPLICIT NONE
425    INTEGER(HID_T), INTENT(IN) :: obj_id          ! Dataset identifier
426    TYPE(hobj_ref_t_f), INTENT(IN), TARGET :: ref ! Object reference
427    INTEGER(HID_T), INTENT(OUT) :: ref_obj_id     ! Object identifier
428    INTEGER, INTENT(OUT) :: hdferr                ! Error code
429!*****
430    TYPE(C_PTR) :: f_ptr
431
432    f_ptr = C_LOC(ref)
433    hdferr = h5rdereference_ptr_c(obj_id, 0, f_ptr, ref_obj_id)
434
435  END SUBROUTINE h5rdereference_object_f
436!****s* H5R (F03)/h5rdereference_region_f
437!
438! NAME
439!  h5rdereference_region_f
440!
441! PURPOSE
442!  Opens the dataset region
443!
444! Inputs:
445!  dset_id  - identifier of the dataset containing
446!             reference to teh regions
447!  ref 	    - reference to open
448! Outputs:
449!  obj_id   - dataspace identifier
450!  hdferr   - returns 0 if successful and -1 if fails
451!
452! AUTHOR
453!  Elena Pourmal
454!  August 12, 1999
455!
456! HISTORY
457!  Explicit Fortran interfaces were added for
458!  called C functions (it is needed for Windows
459!  port).  February 28, 2001
460!
461! NOTES
462!  This is a module procedure for the h5rdereference_f subroutine.
463!
464! Signature:
465  SUBROUTINE h5rdereference_region_f(obj_id, ref, ref_obj_id, hdferr)
466    USE, INTRINSIC :: ISO_C_BINDING
467    IMPLICIT NONE
468    INTEGER(HID_T), INTENT(IN) :: obj_id   ! Dataset identifier
469    TYPE(hdset_reg_ref_t_f), INTENT(IN), TARGET :: ref   ! Object reference
470    INTEGER(HID_T), INTENT(OUT) :: ref_obj_id  ! Dataspace identifier
471    INTEGER, INTENT(OUT) :: hdferr          ! Error code
472!*****
473    TYPE(C_PTR) :: f_ptr
474
475    f_ptr = C_LOC(ref)
476    hdferr = h5rdereference_ptr_c(obj_id, 1, f_ptr, ref_obj_id)
477
478  END SUBROUTINE h5rdereference_region_f
479
480!****s* H5R (F03)/h5rdereference_ptr_f
481!
482! NAME
483!  h5rdereference_ptr_f
484!
485! PURPOSE
486!  Opens the HDF5 object referenced.
487!
488! Inputs:
489!  obj_id     - valid identifier for the file containing the
490!               referenced object or any object in that file.
491!  ref_type   - the reference type of ref.
492!  ref        - Reference to open.
493! Outputs:
494!  ref_obj_id - identifier of referenced object
495!  hdferr     - returns 0 if successful and -1 if fails
496!
497! AUTHOR
498!  M. Scot Breitenfeld
499!  June 20, 2008
500!
501! NOTES
502!  This is a module procedure for the h5rdereference_f
503!  subroutine using pointers.
504!
505! Signature:
506  SUBROUTINE h5rdereference_ptr_f(obj_id, ref_type, ref, ref_obj_id, hdferr)
507    USE, INTRINSIC :: ISO_C_BINDING
508    IMPLICIT NONE
509    INTEGER(HID_T), INTENT(IN) :: obj_id  ! Valid identifier for the file containing the
510                                          !  referenced object or any object in that file.
511    INTEGER, INTENT(IN) :: ref_type       ! The reference type of ref.
512    TYPE(C_PTR), INTENT(IN) :: ref        ! Object reference
513    INTEGER(HID_T), INTENT(OUT) :: ref_obj_id
514                                          ! Identifier of referenced object
515    INTEGER, INTENT(OUT) :: hdferr        ! Error code
516!*****
517    hdferr = h5rdereference_ptr_c(obj_id, ref_type, ref, ref_obj_id)
518
519  END SUBROUTINE h5rdereference_ptr_f
520!
521!****s* H5R (F03)/h5rget_name_object_f
522!
523! NAME
524!  h5rget_name_object_f
525!
526! PURPOSE
527!  Retrieves a name of a referenced object.
528!
529! Inputs:
530!  loc_id    - Identifier for the file containing the reference or for any object in that file.
531!  ref 	     - An object or dataset region reference.
532!
533! Outputs:
534!  name      - A name associated with the referenced object or dataset region.
535!  hdferr    - Returns 0 if successful and -1 if fails.
536!
537! Optional parameters:
538!  size     - The size of the name buffer, returning 0 (zero) if no name is associated
539!             with the identifier.
540!
541! AUTHOR
542!  M. Scot Breitenfeld
543!  March 28, 2008
544!
545! Signature:
546  SUBROUTINE h5rget_name_object_f(loc_id,  ref, name, hdferr, size)
547    USE, INTRINSIC :: ISO_C_BINDING
548    IMPLICIT NONE
549    INTEGER(HID_T), INTENT(IN) :: loc_id
550    TYPE(hobj_ref_t_f), INTENT(IN), TARGET :: ref
551    INTEGER(SIZE_T), OPTIONAL, INTENT(OUT) :: size
552    CHARACTER(LEN=*), INTENT(INOUT) :: name
553    INTEGER, INTENT(OUT) :: hdferr
554!*****
555
556    INTEGER(SIZE_T) :: size_default
557    INTEGER(SIZE_T) :: name_len
558    TYPE(C_PTR) :: f_ptr
559
560    f_ptr = C_LOC(ref)
561
562    name_len=LEN(name)
563
564    hdferr = h5rget_name_ptr_c(loc_id, 0, f_ptr, name, name_len, size_default)
565
566    IF(PRESENT(size)) size = size_default
567
568  END SUBROUTINE h5rget_name_object_f
569!****s* H5R (F03)/h5rget_name_region_f
570!
571! NAME
572!  h5rget_name_region_f
573!
574! PURPOSE
575!  Retrieves a name of a dataset region.
576!
577! Inputs:
578!  loc_id  - Identifier for the file containing the reference or for any object in that file.
579!  ref 	   - An object or dataset region reference.
580!
581! Outputs:
582!  name    - A name associated with the referenced object or dataset region.
583!  hdferr  - Returns 0 if successful and -1 if fails.
584!
585! Optional parameters:
586!  size    - The size of the name buffer, returning 0 (zero) if no name is associated with the identifier
587!
588! AUTHOR
589!  M. Scot Breitenfeld
590!  March 28, 2008
591!
592! Signature:
593  SUBROUTINE h5rget_name_region_f(loc_id, ref, name, hdferr, size)
594    USE, INTRINSIC :: ISO_C_BINDING
595    IMPLICIT NONE
596    INTEGER(HID_T), INTENT(IN) :: loc_id
597    TYPE(hdset_reg_ref_t_f), INTENT(IN), TARGET :: ref
598    INTEGER(SIZE_T), OPTIONAL, INTENT(OUT) :: size
599    CHARACTER(LEN=*), INTENT(INOUT) :: name
600    INTEGER, INTENT(OUT) :: hdferr
601!*****
602    INTEGER(SIZE_T) :: size_default
603    INTEGER(SIZE_T) :: name_len
604    TYPE(C_PTR) :: f_ptr
605
606    f_ptr = C_LOC(ref)
607
608    name_len=LEN(name)
609
610    hdferr = h5rget_name_ptr_c(loc_id, 1, f_ptr, name, name_len, size_default)
611
612    IF(PRESENT(size)) size = size_default
613
614  END SUBROUTINE h5rget_name_region_f
615
616  !****s* H5R (F03)/h5rget_name_ptr_f
617  !
618  ! NAME
619  !  h5rget_name_ptr_f
620  !
621  ! PURPOSE
622  !  Retrieves a name of a referenced object.
623  !
624  ! Inputs:
625  !  loc_id   - Identifier for the file containing the reference or for any object in that file.
626  !  ref_type - Type of reference.
627  !  ref      - An object or dataset region reference.
628  !
629  ! Outputs:
630  !  name     - A name associated with the referenced object or dataset ptr.
631  !  hdferr   - Returns 0 if successful and -1 if fails.
632  !
633  ! Optional parameters:
634  !   size    - The size of the name buffer, returning 0 (zero) if no name is associated
635  !             with the identifier
636  !
637  ! AUTHOR
638  !  M. Scot Breitenfeld
639  !  March 28, 2008
640  !
641  ! Signature:
642  SUBROUTINE h5rget_name_ptr_f(loc_id, ref_type, ref, name, hdferr, size)
643    USE, INTRINSIC :: ISO_C_BINDING
644    IMPLICIT NONE
645    INTEGER(HID_T), INTENT(IN) :: loc_id
646    INTEGER, INTENT(IN) :: ref_type
647    TYPE(C_PTR), INTENT(IN) :: ref
648    CHARACTER(LEN=*), INTENT(INOUT) :: name
649    INTEGER, INTENT(OUT) :: hdferr
650    INTEGER(SIZE_T), OPTIONAL, INTENT(OUT) :: size
651!*****
652    INTEGER(SIZE_T) :: size_default
653    INTEGER(SIZE_T) :: name_len
654
655    name_len=LEN(name)
656
657    hdferr = h5rget_name_ptr_c(loc_id, ref_type, ref, name, name_len, size_default)
658
659    IF(PRESENT(size)) size = size_default
660
661  END SUBROUTINE h5rget_name_ptr_f
662
663  !****s* H5R (F03)/h5rget_obj_type_f
664  !
665  ! NAME
666  !  h5rget_obj_type_f
667  !
668  ! PURPOSE
669  !  Retrieves the type of object that an object reference points to.
670  !
671  ! Inputs:
672  !  loc_id   - Identifier for the dataset containing the reference or
673  !             for the group that dataset is in.
674  !  ref_type - Type of reference to query.
675  !  ref      - Reference to query.
676  !
677  ! Outputs:
678  !  obj_type - Type of referenced object.
679  !               H5G_UNKNOWN_F
680  !               H5G_GROUP_F
681  !               H5G_DATASET_F
682  !               H5G_TYPE_F
683  !
684  !  hdferr   - Returns 0 if successful and -1 if fails.
685  !
686  ! AUTHOR
687  !  M. Scot Breitenfeld
688  !  Decemeber 17, 2008
689  !
690  ! Signature:
691  SUBROUTINE h5rget_obj_type_f(loc_id, ref_type, ref, obj_type, hdferr)
692    USE, INTRINSIC :: ISO_C_BINDING
693    IMPLICIT NONE
694    INTEGER(HID_T), INTENT(IN) :: loc_id
695    INTEGER, INTENT(IN) :: ref_type
696    TYPE(C_PTR), INTENT(IN) :: ref
697    INTEGER, INTENT(OUT) :: obj_type
698    INTEGER, INTENT(OUT) :: hdferr
699    !*****
700
701    INTERFACE
702       INTEGER FUNCTION h5rget_obj_type_c(loc_id, ref_type, ref, obj_type) &
703            BIND(C, NAME='h5rget_obj_type_c')
704         USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_ptr
705         USE H5GLOBAL
706         INTEGER(HID_T), INTENT(IN) :: loc_id
707         INTEGER, INTENT(IN) :: ref_type
708         TYPE(C_PTR), VALUE :: ref
709         INTEGER :: obj_type
710       END FUNCTION h5rget_obj_type_c
711    END INTERFACE
712
713    hdferr = h5rget_obj_type_c(loc_id, ref_type, ref, obj_type)
714
715  END SUBROUTINE h5rget_obj_type_f
716
717END MODULE H5R_PROVISIONAL
718