1!****h* ROBODoc/H5R (F90)
2!
3! NAME
4!  MODULE H5R_PROVISIONAL
5!
6! FILE
7!  fortran/src/H5Rff_F90.f90
8!
9! PURPOSE
10!  This file contains Fortran 90 interfaces for H5R functions. It contains
11!  the same functions as H5Rff_F03.f90 but excludes the Fortran 2003 functions
12!  and the interface listings. This file will be compiled instead of H5Rff_F03.f90
13!  if Fortran 2003 functions are not 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
39!  If you change the value of these parameters, do not forget to change corresponding
40!  values in the H5f90.h file.
41!  INTEGER, PARAMETER :: REF_OBJ_BUF_LEN = 2
42!  INTEGER, PARAMETER :: REF_REG_BUF_LEN = 3
43!
44!  TYPE hobj_ref_t_f
45!  INTEGER ref(REF_OBJ_BUF_LEN)
46!  END TYPE
47!
48!  TYPE hdset_reg_ref_t_f
49!  INTEGER ref(REF_REG_BUF_LEN)
50!  END TYPE
51!
52  INTERFACE h5rcreate_f
53
54     MODULE PROCEDURE h5rcreate_object_f
55     MODULE PROCEDURE h5rcreate_region_f
56
57  END INTERFACE
58
59  INTERFACE h5rdereference_f
60
61     MODULE PROCEDURE h5rdereference_object_f
62     MODULE PROCEDURE h5rdereference_region_f
63
64  END INTERFACE
65
66  INTERFACE h5rget_name_f
67
68     MODULE PROCEDURE h5rget_name_object_f
69     MODULE PROCEDURE h5rget_name_region_f
70
71  END INTERFACE
72
73  INTERFACE h5rget_region_f
74
75     MODULE PROCEDURE h5rget_region_region_f
76
77  END INTERFACE
78
79
80CONTAINS
81
82
83!****s* H5R/h5rget_region_region_f
84!
85! NAME
86!  h5rget_region_region_f
87!
88! PURPOSE
89!  Retrieves a dataspace with the specified region selected
90!
91! INPUTS
92!  dset_id 	 - identifier of the dataset containing
93!                  reference to the regions
94!  ref 	         - reference to open
95! OUTPUTS
96!  space_id 	 - dataspace identifier
97!  hdferr 	 - Returns 0 if successful and -1 if fails
98! AUTHOR
99!  Elena Pourmal
100!  August 12, 1999
101!
102! HISTORY
103!  Explicit Fortran interfaces were added for
104!  called C functions (it is needed for Windows
105!  port).  February 28, 2001
106!
107! NOTES
108!  This is a module procedure for the h5rget_region_f subroutine.
109!
110! SOURCE
111  SUBROUTINE h5rget_region_region_f(dset_id, ref, space_id, hdferr)
112    IMPLICIT NONE
113    INTEGER(HID_T), INTENT(IN) :: dset_id      ! Dataset identifier
114    TYPE(hdset_reg_ref_t_f), INTENT(IN) :: ref ! Dataset region reference
115    INTEGER(HID_T), INTENT(OUT) :: space_id    ! Space identifier
116    INTEGER, INTENT(OUT) :: hdferr             ! Error code
117!*****
118    INTEGER :: ref_f(REF_REG_BUF_LEN)          ! Local buffer to pass reference
119
120    INTERFACE
121       INTEGER FUNCTION h5rget_region_region_c(dset_id, ref_f, space_id)
122         USE H5GLOBAL
123         !DEC$IF DEFINED(HDF5F90_WINDOWS)
124         !DEC$ATTRIBUTES C,reference,decorate,alias:'H5RGET_REGION_REGION_C':: h5rget_region_region_c
125         !DEC$ENDIF
126         INTEGER(HID_T), INTENT(IN) :: dset_id
127         !              INTEGER, PARAMETER :: REF_REG_BUF_LEN = 3
128         INTEGER :: ref_f(REF_REG_BUF_LEN)
129         INTEGER(HID_T), INTENT(OUT) :: space_id
130       END FUNCTION h5rget_region_region_c
131    END INTERFACE
132
133    ref_f = ref%ref
134    hdferr = h5rget_region_region_c(dset_id, ref_f, space_id )
135
136  END SUBROUTINE h5rget_region_region_f
137
138
139
140!****s* H5R (F90)/h5rcreate_object_f
141!
142! NAME
143!  h5rcreate_object_f
144!
145! PURPOSE
146!  Creates reference to the object
147!
148! INPUTS
149!  loc_id 	 - location identifier
150!  name 	 - name of the object at the specified location
151! OUTPUTS
152!  ref 	         - reference to the specified object
153!  hdferr:	 - error code
154!                   Success:  0
155!                   Failure: -1
156! AUTHOR
157!  Elena Pourmal
158!  August 12, 1999
159!
160! HISTORY
161!  Explicit Fortran interfaces were added for
162!  called C functions (it is needed for Windows
163!  port).  February 28, 2001
164!
165! NOTES
166!  This is a module procedure for the h5rcreate_f subroutine.
167!
168! SOURCE
169  SUBROUTINE h5rcreate_object_f(loc_id, name, ref, hdferr)
170    IMPLICIT NONE
171    INTEGER(HID_T), INTENT(IN) :: loc_id   ! Location identifier
172    CHARACTER(LEN=*), INTENT(IN) :: name   ! Name of the object at location specified
173                                           ! by loc_id identifier
174    TYPE(hobj_ref_t_f), INTENT(OUT) :: ref ! Object reference
175    INTEGER, INTENT(OUT) :: hdferr         ! Error code
176!*****
177    INTEGER :: namelen                     ! Name length
178    INTEGER(HADDR_T) :: ref_f              ! Local buffer to pass reference
179
180    INTERFACE
181       INTEGER FUNCTION h5rcreate_object_c(ref_f, loc_id, name, namelen)
182         USE H5GLOBAL
183         !DEC$IF DEFINED(HDF5F90_WINDOWS)
184         !DEC$ATTRIBUTES C,reference,decorate,alias:'H5RCREATE_OBJECT_C':: h5rcreate_object_c
185         !DEC$ENDIF
186         !DEC$ATTRIBUTES reference :: name
187         INTEGER(HADDR_T) :: ref_f
188         INTEGER(HID_T), INTENT(IN) :: loc_id
189         CHARACTER(LEN=*), INTENT(IN) :: name
190         INTEGER :: namelen
191       END FUNCTION h5rcreate_object_c
192    END INTERFACE
193
194    namelen = LEN(name)
195    ref_f = 0
196    hdferr = h5rcreate_object_c(ref_f, loc_id, name, namelen )
197    ref%ref = ref_f
198
199  END SUBROUTINE h5rcreate_object_f
200
201!****s* H5R (F90)/h5rcreate_region_f
202!
203! NAME
204!  h5rcreate_region_f
205!
206! PURPOSE
207!  Creates reference to the dataset region
208!
209! INPUTS
210!  loc_id 	 - location identifier
211!  name 	 - name of the dataset at the specified location
212!  space_id 	 - dataspace identifier that describes selected region
213! OUTPUTS
214!  ref 	         - reference to the dataset region
215!  hdferr:	 - error code
216!                   Success:  0
217!                   Failure: -1
218! AUTHOR
219!  Elena Pourmal
220!  August 12, 1999
221!
222! HISTORY
223!  Explicit Fortran interfaces were added for
224!  called C functions (it is needed for Windows
225!  port).  February 28, 2001
226!
227! NOTES
228!  This is a module procedure for the h5rcreate_f subroutine.
229!
230! SOURCE
231  SUBROUTINE h5rcreate_region_f(loc_id, name, space_id, ref, hdferr)
232    IMPLICIT NONE
233    INTEGER(HID_T), INTENT(IN) :: loc_id   ! Location identifier
234    CHARACTER(LEN=*), INTENT(IN) :: name   ! Name of the dataset at location specified
235                                           ! by loc_id identifier
236    INTEGER(HID_T), INTENT(IN) :: space_id ! Dataset's dataspace identifier
237    TYPE(hdset_reg_ref_t_f), INTENT(OUT) :: ref ! Dataset region reference
238    INTEGER, INTENT(OUT) :: hdferr         ! Error code
239!*****
240    INTEGER :: namelen                     ! Name length
241    INTEGER :: ref_f(REF_REG_BUF_LEN)      ! Local buffer to pass reference
242
243    INTERFACE
244       INTEGER FUNCTION h5rcreate_region_c(ref_f, loc_id, name, namelen, space_id)
245         USE H5GLOBAL
246         !DEC$IF DEFINED(HDF5F90_WINDOWS)
247         !DEC$ATTRIBUTES C,reference,decorate,alias:'H5RCREATE_REGION_C':: h5rcreate_region_c
248         !DEC$ENDIF
249         !DEC$ATTRIBUTES reference :: name
250         !              INTEGER, PARAMETER :: REF_REG_BUF_LEN = 3
251         INTEGER :: ref_f(REF_REG_BUF_LEN)
252         INTEGER(HID_T), INTENT(IN) :: loc_id
253         CHARACTER(LEN=*), INTENT(IN) :: name
254         INTEGER :: namelen
255         INTEGER(HID_T), INTENT(IN) :: space_id
256       END FUNCTION h5rcreate_region_c
257    END INTERFACE
258
259    namelen = LEN(name)
260    ref_f = 0
261    hdferr = h5rcreate_region_c(ref_f, loc_id, name, namelen, space_id )
262    ref%ref = ref_f
263
264  END SUBROUTINE h5rcreate_region_f
265!****s* H5R (F90)/h5rdereference_object_f
266!
267! NAME
268!  h5rdereference_object_f
269!
270! PURPOSE
271!  Opens the HDF5 object referenced
272!
273! INPUTS
274!  dset_id  - identifier of the dataset containing reference
275!  ref 	    - reference to open
276! OUTPUTS
277!  obj_id   - object_identifier
278!  hdferr   - error code
279!              Success:  0
280!              Failure: -1
281!
282! AUTHOR
283!  Elena Pourmal
284!  August 12, 1999
285!
286! HISTORY
287!  Explicit Fortran interfaces were added for
288!  called C functions (it is needed for Windows
289!  port).  February 28, 2001
290!
291! NOTES
292!  This is a module procedure for the h5rdereference_f subroutine.
293!
294! SOURCE
295  SUBROUTINE h5rdereference_object_f(dset_id, ref, obj_id, hdferr)
296    IMPLICIT NONE
297    INTEGER(HID_T), INTENT(IN) :: dset_id   ! Dataset identifier
298    TYPE(hobj_ref_t_f), INTENT(IN) :: ref   ! Object reference
299    INTEGER(HID_T), INTENT(OUT) :: obj_id   ! Object identifier
300    INTEGER, INTENT(OUT) :: hdferr          ! Error code
301!*****
302    INTEGER(HADDR_T) :: ref_f          ! Local buffer to pass reference
303
304    INTERFACE
305       INTEGER FUNCTION h5rdereference_object_c(dset_id, ref_f, obj_id)
306         USE H5GLOBAL
307         !DEC$IF DEFINED(HDF5F90_WINDOWS)
308         !DEC$ATTRIBUTES C,reference,decorate,alias:'H5RDEREFERENCE_OBJECT_C':: h5rdereference_object_c
309         !DEC$ENDIF
310         !              INTEGER, PARAMETER :: REF_OBJ_BUF_LEN = 2
311         INTEGER(HID_T), INTENT(IN) :: dset_id
312         INTEGER(HADDR_T) :: ref_f
313         INTEGER(HID_T), INTENT(OUT) :: obj_id
314       END FUNCTION h5rdereference_object_c
315    END INTERFACE
316
317    ref_f = ref%ref
318    hdferr = h5rdereference_object_c(dset_id, ref_f, obj_id )
319
320  END SUBROUTINE h5rdereference_object_f
321!****s* H5R (F90)/h5rdereference_region_f
322!
323! NAME
324!  h5rdereference_region_f
325!
326! PURPOSE
327!  Opens the dataset region
328!
329! INPUTS
330!  dset_id 	 - identifier of the dataset containing
331!                  reference to teh regions
332!  ref 	         - reference to open
333! OUTPUTS
334!  obj_id 	 - dataspace identifier
335!  hdferr 	 - error code
336!                   Success:  0
337!                   Failure: -1
338!
339! AUTHOR
340!  Elena Pourmal
341!  August 12, 1999
342!
343! HISTORY
344!  Explicit Fortran interfaces were added for
345!  called C functions (it is needed for Windows
346!  port).  February 28, 2001
347!
348! NOTES
349!  This is a module procedure for the h5rdereference_f subroutine.
350!
351! SOURCE
352  SUBROUTINE h5rdereference_region_f(dset_id, ref, obj_id, hdferr)
353    IMPLICIT NONE
354    INTEGER(HID_T), INTENT(IN) :: dset_id      ! Dataset identifier
355    TYPE(hdset_reg_ref_t_f), INTENT(IN) :: ref ! Object reference
356    INTEGER(HID_T), INTENT(OUT) :: obj_id   ! Dataspace identifier
357    INTEGER, INTENT(OUT) :: hdferr          ! Error code
358!*****
359    INTEGER :: ref_f(REF_REG_BUF_LEN)       ! Local buffer to pass reference
360
361    INTERFACE
362       INTEGER FUNCTION h5rdereference_region_c(dset_id, ref_f, obj_id)
363         USE H5GLOBAL
364         !DEC$IF DEFINED(HDF5F90_WINDOWS)
365         !DEC$ATTRIBUTES C,reference,decorate,alias:'H5RDEREFERENCE_REGION_C':: h5rdereference_region_c
366         !DEC$ENDIF
367         INTEGER(HID_T), INTENT(IN) :: dset_id
368!  INTEGER, PARAMETER :: REF_REG_BUF_LEN = 3
369         INTEGER :: ref_f(REF_REG_BUF_LEN)
370         INTEGER(HID_T), INTENT(OUT) :: obj_id
371       END FUNCTION h5rdereference_region_c
372    END INTERFACE
373
374    ref_f = ref%ref
375    hdferr = h5rdereference_region_c(dset_id, ref_f, obj_id )
376
377  END SUBROUTINE h5rdereference_region_f
378!****s* H5R (F90)/h5rget_name_object_f
379!
380! NAME
381!  h5rget_name_object_f
382!
383! PURPOSE
384!  Retrieves a name of a referenced object.
385!
386! INPUTS
387!  loc_id  - Identifier for the file containing the reference or for any object in that file.
388!  ref 	   - An object or dataset region reference.
389!
390! OUTPUTS
391!  name    - A name associated with the referenced object or dataset region.
392!
393!  hdferr  - error code
394!             Success:  0
395!             Failure: -1
396!
397! OPTIONAL PARAMETERS
398!  size    - The size of the name buffer, returning 0 (zero) if
399!            no name is associated with the identifier
400!
401! AUTHOR
402!  M. Scot Breitenfeld
403!  March 28, 2008
404!
405! SOURCES
406  SUBROUTINE h5rget_name_object_f(loc_id,  ref, name, hdferr, size)
407    IMPLICIT NONE
408    INTEGER(HID_T), INTENT(IN) :: loc_id   ! Identifier for the file containing the reference or
409                                           ! for any object in that file.
410                                           ! or for the group that dataset is in.
411    TYPE(hobj_ref_t_f), INTENT(IN) :: ref  ! Object reference
412    INTEGER(SIZE_T), OPTIONAL, INTENT(OUT) :: size   ! The size of the name buffer,
413                                           ! returning 0 (zero) if no name is associated with the identifier
414    CHARACTER(LEN=*), INTENT(OUT) :: name  ! A name associated with the referenced object or dataset region.
415    INTEGER, INTENT(OUT) :: hdferr         ! Error code
416!*****
417    INTEGER(HADDR_T) :: ref_f              ! Local buffer to pass reference
418
419    INTEGER(SIZE_T) :: size_default
420    INTEGER(SIZE_T) :: name_len
421
422    INTERFACE
423       INTEGER FUNCTION h5rget_name_object_c(loc_id, ref_f, name, name_len, size_default)
424         USE H5GLOBAL
425         !DEC$IF DEFINED(HDF5F90_WINDOWS)
426         !DEC$ATTRIBUTES C,reference,decorate,alias:'H5RGET_NAME_OBJECT_C':: h5rget_name_object_c
427         !DEC$ENDIF
428         !DEC$ATTRIBUTES reference :: name
429         INTEGER(HID_T), INTENT(IN) :: loc_id
430         INTEGER(SIZE_T)  :: size_default
431         CHARACTER(LEN=*), INTENT(OUT) :: name
432         INTEGER(HADDR_T) :: ref_f
433
434         INTEGER(SIZE_T) :: name_len
435       END FUNCTION h5rget_name_object_c
436    END INTERFACE
437
438    name_len=LEN(name)
439
440    ref_f = ref%ref
441    hdferr = h5rget_name_object_c(loc_id, ref_f, name, name_len, size_default)
442
443    IF(PRESENT(size)) size = size_default
444
445  END SUBROUTINE h5rget_name_object_f
446
447!****s* H5R (F90)/h5rget_name_region_f
448!
449! NAME
450!  h5rget_name_region_f
451!
452! PURPOSE
453!  Retrieves a name of a dataset region.
454!
455! INPUTS
456!  loc_id 	 - Identifier for the file containing the reference or
457!                  for any object in that file.
458!  ref 	         - An object or dataset region reference.
459!
460! OUTPUTS
461!  name 	 - A name associated with the referenced object or dataset region.
462!  hdferr 	 - error code
463!                   Success:  0
464!                   Failure: -1
465!
466! OPTIONAL PARAMETERS
467!  size 	 - The size of the name buffer,  returning 0 (zero) if no
468!                  name is associated  with the identifier
469!
470! AUTHOR
471!  M. Scot Breitenfeld
472!  March 28, 2008
473!
474! SOURCE
475  SUBROUTINE h5rget_name_region_f(loc_id, ref, name, hdferr, size)
476    IMPLICIT NONE
477    INTEGER(HID_T), INTENT(IN) :: loc_id
478    TYPE(hdset_reg_ref_t_f), INTENT(IN) :: ref
479    INTEGER(SIZE_T), OPTIONAL, INTENT(OUT) :: size
480    CHARACTER(LEN=*), INTENT(OUT) :: name
481    INTEGER, INTENT(OUT) :: hdferr
482!*****
483    INTEGER :: ref_f(REF_REG_BUF_LEN)      ! Local buffer to pass reference
484    INTEGER(SIZE_T) :: size_default
485    INTEGER(SIZE_T) :: name_len
486
487    INTERFACE
488       INTEGER FUNCTION h5rget_name_region_c(loc_id, ref_f, name, name_len, size_default)
489         USE H5GLOBAL
490         !DEC$IF DEFINED(HDF5F90_WINDOWS)
491         !DEC$ATTRIBUTES C,reference,decorate,alias:'H5RGET_NAME_REGION_C':: h5rget_name_region_c
492         !DEC$ENDIF
493         !DEC$ATTRIBUTES reference :: name
494         INTEGER(HID_T), INTENT(IN) :: loc_id
495         INTEGER(SIZE_T)  :: size_default
496         CHARACTER(LEN=*), INTENT(OUT) :: name
497         INTEGER :: ref_f(REF_REG_BUF_LEN)
498
499         INTEGER(SIZE_T) :: name_len
500       END FUNCTION h5rget_name_region_c
501    END INTERFACE
502
503    name_len=LEN(name)
504
505    ref_f = ref%ref
506    hdferr = h5rget_name_region_c(loc_id, ref_f, name, name_len, size_default)
507
508    IF(PRESENT(size)) size = size_default
509
510  END SUBROUTINE h5rget_name_region_f
511
512END MODULE H5R_PROVISIONAL
513