summaryrefslogtreecommitdiffstats
path: root/fortran/src/H5Gff.f90
blob: c4e83c2f92c1a8aec94b457b159daea9f3e3ee12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
!
! This file contains Fortran90 interfaces for H5F functions.
! 
      MODULE H5G
      USE H5GLOBAL
 
        CONTAINS
          
!----------------------------------------------------------------------
! Name:		h5gcreate_f 
!
! Purpose:	Creates a new group. 
!
! Inputs:  
!		loc_id		- location identifier
!		name		- group name at the specified location
! Outputs:  
!		grp_id		- group identifier
!		hdferr:		- error code		
!				 	Success:  0
!				 	Failure: -1   
! Optional parameters:
!		size_hint	- a parameter indicating the number of bytes 
!				  to reserve for the names that will appear 
!				  in the group
!
! Programmer:	Elena Pourmal
!		August 12, 1999	
!
! Modifications: 	Explicit Fortran interfaces were added for 
!			called C functions (it is needed for Windows
!			port).  March 5, 2001 
!
! Comment:		
!----------------------------------------------------------------------
          SUBROUTINE h5gcreate_f(loc_id, name, grp_id, hdferr, size_hint)
           
            IMPLICIT NONE
            INTEGER(HID_T), INTENT(IN) :: loc_id   ! File or group identifier 
            CHARACTER(LEN=*), INTENT(IN) :: name   ! Name of the group 
            INTEGER(HID_T), INTENT(OUT) :: grp_id  ! Group identifier 
            INTEGER, INTENT(OUT) :: hdferr         ! Error code 
            INTEGER(SIZE_T), OPTIONAL, INTENT(IN) :: size_hint 
                                                   ! Parameter indicating
                                                   ! the number of bytes
                                                   ! to reserve for the
                                                   ! names that will appear
                                                   ! in the group  
            INTEGER :: namelen ! Length of the name character string
            INTEGER(SIZE_T) :: size_hint_default 

!            INTEGER, EXTERNAL :: h5gcreate_c
!  MS FORTRAN needs explicit interface for C functions called here.
!
            INTERFACE
              INTEGER FUNCTION h5gcreate_c(loc_id, name, namelen, &
                               size_hint_default, grp_id)
              USE H5GLOBAL
              !MS$ATTRIBUTES C,reference,alias:'_H5GCREATE_C'::h5gcreate_c
              !DEC$ATTRIBUTES reference :: name
              INTEGER(HID_T), INTENT(IN) :: loc_id
              CHARACTER(LEN=*), INTENT(IN) :: name
              INTEGER :: namelen
              INTEGER(SIZE_T) :: size_hint_default
              INTEGER(HID_T), INTENT(OUT) :: grp_id
              END FUNCTION h5gcreate_c
            END INTERFACE

            size_hint_default = OBJECT_NAMELEN_DEFAULT_F 
            if (present(size_hint)) size_hint_default = size_hint 
            namelen = LEN(name)
            hdferr = h5gcreate_c(loc_id, name, namelen, size_hint_default, &
                                 grp_id)

          END SUBROUTINE h5gcreate_f

!----------------------------------------------------------------------
! Name:		h5gopen_f 
!
! Purpose: 	Opens an existing group. 	
!
! Inputs:  
!		loc_id		- location identifier
!		name 		- name of the group to open
! Outputs:  
!		grp_id		- group identifier
!		hdferr:		- error code		
!				 	Success:  0
!				 	Failure: -1   
! Optional parameters:
!				NONE
!
! Programmer:	Elena Pourmal
!		August 12, 1999	
!
! Modifications: 	Explicit Fortran interfaces were added for 
!			called C functions (it is needed for Windows
!			port).  March 5, 2001 
!
! Comment:		
!----------------------------------------------------------------------
          SUBROUTINE h5gopen_f(loc_id, name, grp_id, hdferr)
           
            IMPLICIT NONE
            INTEGER(HID_T), INTENT(IN) :: loc_id   ! File or group identifier 
            CHARACTER(LEN=*), INTENT(IN) :: name   ! Name of the group 
            INTEGER(HID_T), INTENT(OUT) :: grp_id  ! File identifier 
            INTEGER, INTENT(OUT) :: hdferr         ! Error code 

            INTEGER :: namelen ! Length of the name character string

!            INTEGER, EXTERNAL :: h5gopen_c
!  MS FORTRAN needs explicit interface for C functions called here.
!
            INTERFACE
              INTEGER FUNCTION h5gopen_c(loc_id, name, namelen, grp_id)
              USE H5GLOBAL
              !MS$ATTRIBUTES C,reference,alias:'_H5GOPEN_C'::h5gopen_c
              !DEC$ATTRIBUTES reference :: name
              INTEGER(HID_T), INTENT(IN) :: loc_id
              CHARACTER(LEN=*), INTENT(IN) :: name
              INTEGER :: namelen
              INTEGER(HID_T), INTENT(OUT) :: grp_id
              END FUNCTION h5gopen_c
            END INTERFACE
  
            namelen = LEN(name)
            hdferr = h5gopen_c(loc_id, name, namelen, grp_id) 

          END SUBROUTINE h5gopen_f

!----------------------------------------------------------------------
! Name:		h5gclose_f 
!
! Purpose:	Closes the specified group. 	
!
! Inputs:  
!		grp_id		- group identifier
! Outputs:  
!		hdferr:		- error code		
!				 	Success:  0
!				 	Failure: -1   
! Optional parameters:
!				NONE
!
! Programmer:	Elena Pourmal
!		August 12, 1999	
!
! Modifications: 	Explicit Fortran interfaces were added for 
!			called C functions (it is needed for Windows
!			port).  March 5, 2001 
!
! Comment:		
!----------------------------------------------------------------------
          SUBROUTINE h5gclose_f(grp_id, hdferr)

            IMPLICIT NONE
            INTEGER(HID_T), INTENT(IN) :: grp_id  ! Group identifier
            INTEGER, INTENT(OUT) :: hdferr        ! Error code

!            INTEGER, EXTERNAL :: h5gclose_c
!  MS FORTRAN needs explicit interface for C functions called here.
!
            INTERFACE
              INTEGER FUNCTION h5gclose_c(grp_id)
              USE H5GLOBAL
              !MS$ATTRIBUTES C,reference,alias:'_H5GCLOSE_C'::h5gclose_c
              INTEGER(HID_T), INTENT(IN) :: grp_id
              END FUNCTION h5gclose_c
            END INTERFACE

            hdferr = h5gclose_c(grp_id)

          END SUBROUTINE h5gclose_f


!----------------------------------------------------------------------
! Name:		h5gget_obj_info_idx_f 
!
! Purpose:	Returns name and type of the group member identified by 
!		its index. 
!
! Inputs:  
!		loc_id		- location identifier
!		name		- name of the group at the specified location
!		idx		- object index (zero-based)
! Outputs:  
!		obj_name	- object name
!		obj_type	- object type
!		hdferr:		- error code		
!				 	Success:  0
!				 	Failure: -1   
! Optional parameters:
!				NONE
!
! Programmer:	Elena Pourmal
!		August 12, 1999	
!
! Modifications: 	Explicit Fortran interfaces were added for 
!			called C functions (it is needed for Windows
!			port).  March 5, 2001 
!
! Comment:		
!----------------------------------------------------------------------
          SUBROUTINE h5gget_obj_info_idx_f(loc_id, name, idx, &
                                           obj_name, obj_type, hdferr)
           
            IMPLICIT NONE
            INTEGER(HID_T), INTENT(IN) :: loc_id   ! File or group identifier 
            CHARACTER(LEN=*), INTENT(IN) :: name   ! Name of the group 
            INTEGER, INTENT(IN) :: idx             ! Index of member object 
            CHARACTER(LEN=*), INTENT(OUT) :: obj_name   ! Name of the object 
            INTEGER, INTENT(OUT) :: obj_type       ! Object type 
            INTEGER, INTENT(OUT) :: hdferr         ! Error code 

            INTEGER :: namelen ! Length of the name character string
            INTEGER :: obj_namelen ! Length of the obj_name character string

!            INTEGER, EXTERNAL :: h5gget_obj_info_idx_c
!  MS FORTRAN needs explicit interface for C functions called here.
!
            INTERFACE
              INTEGER FUNCTION h5gget_obj_info_idx_c(loc_id, name, &
                               namelen, idx, &
                               obj_name, obj_namelen, obj_type)
              USE H5GLOBAL
              !MS$ATTRIBUTES C,reference,alias:'_H5GGET_OBJ_INFO_IDX_C'::h5gget_obj_info_idx_c
              !DEC$ATTRIBUTES reference :: name
              !DEC$ATTRIBUTES reference :: obj_name
              INTEGER(HID_T), INTENT(IN) :: loc_id
              CHARACTER(LEN=*), INTENT(IN) :: name
              INTEGER :: namelen
              INTEGER, INTENT(IN) :: idx
              CHARACTER(LEN=*), INTENT(OUT) :: obj_name
              INTEGER :: obj_namelen
              INTEGER, INTENT(OUT) :: obj_type
              END FUNCTION h5gget_obj_info_idx_c
            END INTERFACE

            namelen = LEN(name)
            obj_namelen = LEN(obj_name)
            hdferr = h5gget_obj_info_idx_c(loc_id, name, namelen, idx, &
                                           obj_name, obj_namelen, obj_type)     

          END SUBROUTINE h5gget_obj_info_idx_f

!----------------------------------------------------------------------
! Name:		h5gn_members_f 
!
! Purpose: 	Returns the number of group members. 	
!
! Inputs:  
!		loc_id		- location identifier
!		name		- name of the group at the specified location
! Outputs:  
!		nmembers	- number of group members
!		hdferr:		- error code		
!				 	Success:  0
!				 	Failure: -1   
! Optional parameters:
!				NONE
!
! Programmer:	Elena Pourmal
!		August 12, 1999	
!
! Modifications: 	Explicit Fortran interfaces were added for 
!			called C functions (it is needed for Windows
!			port).  March 5, 2001 
!
! Comment:		
!----------------------------------------------------------------------

          SUBROUTINE h5gn_members_f(loc_id, name, nmembers, hdferr)
           
            IMPLICIT NONE
            INTEGER(HID_T), INTENT(IN) :: loc_id   ! File or group identifier 
            CHARACTER(LEN=*), INTENT(IN) :: name   ! Name of the group 
            INTEGER, INTENT(OUT) :: nmembers       ! Number of members in the
                                                   ! group 
            INTEGER, INTENT(OUT) :: hdferr         ! Error code 

            INTEGER :: namelen ! Length of the name character string
  
!            INTEGER, EXTERNAL :: h5gn_members_c
!  MS FORTRAN needs explicit interface for C functions called here.
!
            INTERFACE
              INTEGER FUNCTION h5gn_members_c(loc_id, name, namelen, nmembers)
              USE H5GLOBAL
              !MS$ATTRIBUTES C,reference,alias:'_H5GN_MEMBERS_C'::h5gn_members_c
              !DEC$ATTRIBUTES reference :: name
              INTEGER(HID_T), INTENT(IN) :: loc_id
              CHARACTER(LEN=*), INTENT(IN) :: name
              INTEGER :: namelen
              INTEGER, INTENT(OUT) :: nmembers
              END FUNCTION h5gn_members_c
            END INTERFACE

            namelen = LEN(name)
            hdferr = h5gn_members_c(loc_id, name, namelen, nmembers) 

          END SUBROUTINE h5gn_members_f

!----------------------------------------------------------------------
! Name:		h5glink_f 
!
! Purpose: 	Creates a link of the specified type from new_name 
!		to current_name. 	
!
! Inputs:  
!		loc_id		- location identifier
!		link_type	- link type
!				  Possible values are:
!				  H5G_LINK_HARD_F (0) or
!				  H5G_LINK_SOFT_F (1) 
!		current_name	- name of the existing object if link is a 
!				  hard link. Can be anything for the soft link. 
!		new_name	- new name for the object
! Outputs:  
!		hdferr:		- error code		
!				 	Success:  0
!				 	Failure: -1   
! Optional parameters:
!				NONE
!
! Programmer:	Elena Pourmal
!		August 12, 1999	
!
! Modifications: 	Explicit Fortran interfaces were added for 
!			called C functions (it is needed for Windows
!			port).  March 5, 2001 
!
! Comment:		
!----------------------------------------------------------------------

          SUBROUTINE h5glink_f(loc_id, link_type, current_name, &
                                                   new_name, hdferr)

            IMPLICIT NONE
            INTEGER(HID_T), INTENT(IN) :: loc_id   ! File or group identifier 
            INTEGER, INTENT(IN) :: link_type       ! link type
                                                   ! Possible values are:
                                                   ! H5G_LINK_HARD_F (0) or
                                                   ! H5G_LINK_SOFT_F (1) 
            
            CHARACTER(LEN=*), INTENT(IN) :: current_name   
                                                   ! Current name of an object 
            CHARACTER(LEN=*), INTENT(IN) :: new_name ! New name of an object
            INTEGER, INTENT(OUT) :: hdferr         ! Error code
            
            INTEGER :: current_namelen ! Lenghth of the current_name string
            INTEGER :: new_namelen     ! Lenghth of the new_name string

!            INTEGER, EXTERNAL :: h5glink_c
!  MS FORTRAN needs explicit interface for C functions called here.
!
            INTERFACE
              INTEGER FUNCTION h5glink_c(loc_id, link_type, current_name, &
                               current_namelen, new_name, new_namelen)
                              
              USE H5GLOBAL
              !MS$ATTRIBUTES C,reference,alias:'_H5GLINK_C'::h5glink_c
              !DEC$ATTRIBUTES reference :: current_name
              !DEC$ATTRIBUTES reference :: new_name
              INTEGER(HID_T), INTENT(IN) :: loc_id 
              INTEGER, INTENT(IN) :: link_type
              CHARACTER(LEN=*), INTENT(IN) :: current_name
              INTEGER :: current_namelen
              CHARACTER(LEN=*), INTENT(IN) :: new_name
              INTEGER :: new_namelen
              END FUNCTION h5glink_c
            END INTERFACE
            
            current_namelen = LEN(current_name)
            new_namelen = LEN(new_name)
            hdferr = h5glink_c(loc_id, link_type, current_name, &
                               current_namelen, new_name, new_namelen)
          END SUBROUTINE h5glink_f

!----------------------------------------------------------------------
! Name:		h5gunlink_f 
!
! Purpose: 	Removes the specified name from the group graph and 
!		decrements the link count for the object to which name 
!		points	
!
! Inputs:  
!		loc_id		- location identifier
!		name		- name of the object to unlink
! Outputs:  
!		hdferr:		- error code		
!				 	Success:  0
!				 	Failure: -1   
! Optional parameters:
!				NONE
!
! Programmer:	Elena Pourmal
!		August 12, 1999	
!
! Modifications: 	Explicit Fortran interfaces were added for 
!			called C functions (it is needed for Windows
!			port).  March 5, 2001 
!
! Comment:		
!----------------------------------------------------------------------

          SUBROUTINE h5gunlink_f(loc_id, name, hdferr)

            IMPLICIT NONE
            INTEGER(HID_T), INTENT(IN) :: loc_id   ! File or group identifier 
            CHARACTER(LEN=*), INTENT(IN) :: name   ! Name of an object 
            INTEGER, INTENT(OUT) :: hdferr         ! Error code
            
            INTEGER :: namelen ! Lenghth of the name character string
            
!            INTEGER, EXTERNAL :: h5gunlink_c
!  MS FORTRAN needs explicit interface for C functions called here.
!
            INTERFACE
              INTEGER FUNCTION h5gunlink_c(loc_id, name, namelen)
              USE H5GLOBAL
              !MS$ATTRIBUTES C,reference,alias:'_H5GUNLINK_C'::h5gunlink_c
              !DEC$ATTRIBUTES reference :: name
              INTEGER(HID_T), INTENT(IN) :: loc_id
              CHARACTER(LEN=*), INTENT(IN) :: name
              INTEGER :: namelen
              END FUNCTION h5gunlink_c
            END INTERFACE
            
            namelen = LEN(name)
            hdferr = h5gunlink_c(loc_id, name, namelen)
          END SUBROUTINE h5gunlink_f

!----------------------------------------------------------------------
! Name:		h5gmove_f 
!
! Purpose:	Renames an object within an HDF5 file.  	
!
! Inputs:  
!		loc_id		- location identifier
!		name		- object's name at specified location
!		new_name	- object's new name
! Outputs:  
!		hdferr:		- error code		
!				 	Success:  0
!				 	Failure: -1   
! Optional parameters:
!				NONE
!
! Programmer:	Elena Pourmal
!		August 12, 1999	
!
! Modifications: 	Explicit Fortran interfaces were added for 
!			called C functions (it is needed for Windows
!			port).  March 5, 2001 
!
! Comment:		
!----------------------------------------------------------------------

          
          SUBROUTINE h5gmove_f(loc_id, name, new_name, hdferr)

            IMPLICIT NONE
            INTEGER(HID_T), INTENT(IN) :: loc_id   ! File or group identifier 
            CHARACTER(LEN=*), INTENT(IN) :: name   ! Current name of an object 
            CHARACTER(LEN=*), INTENT(IN) :: new_name ! New name of an object
            INTEGER, INTENT(OUT) :: hdferr         ! Error code
            
            INTEGER :: namelen         ! Lenghth of the current_name string
            INTEGER :: new_namelen     ! Lenghth of the new_name string

!            INTEGER, EXTERNAL :: h5gmove_c
!  MS FORTRAN needs explicit interface for C functions called here.
!
            INTERFACE
              INTEGER FUNCTION h5gmove_c(loc_id, name, namelen, new_name, new_namelen)
              USE H5GLOBAL
              !MS$ATTRIBUTES C,reference,alias:'_H5GMOVE_C'::h5gmove_c
              !DEC$ATTRIBUTES reference :: name
              !DEC$ATTRIBUTES reference :: new_name
              INTEGER(HID_T), INTENT(IN) :: loc_id
              CHARACTER(LEN=*), INTENT(IN) :: name
              INTEGER :: namelen
              CHARACTER(LEN=*), INTENT(IN) :: new_name
              INTEGER :: new_namelen
              END FUNCTION h5gmove_c
            END INTERFACE
            
            namelen = LEN(name)
            new_namelen = LEN(new_name)
            hdferr = h5gmove_c(loc_id, name, namelen, new_name, new_namelen)
          END SUBROUTINE h5gmove_f

!----------------------------------------------------------------------
! Name:		h5gget_linkval_f 
!
! Purpose: 	Returns the name of the object that the symbolic link 
! 		points to. 	
!
! Inputs:  
!		loc_id		- location identifier
!		name		- symbolic link to the object whose name 
!				  is to be returned.  
!		size		- maximum number of characters to be returned
! Outputs:  
!		buffer		- a buffer to hold the name of the object 
!				  being sought 
!		hdferr:		- error code		
!				 	Success:  0
!				 	Failure: -1   
! Optional parameters:
!				NONE
!
! Programmer:	Elena Pourmal
!		August 12, 1999	
!
! Modifications: 	Explicit Fortran interfaces were added for 
!			called C functions (it is needed for Windows
!			port).  March 5, 2001 
!
! Comment:		
!----------------------------------------------------------------------

          SUBROUTINE h5gget_linkval_f(loc_id, name, size, buffer, hdferr)

            IMPLICIT NONE
            INTEGER(HID_T), INTENT(IN) :: loc_id   ! File or group identifier 
            CHARACTER(LEN=*), INTENT(IN) :: name   ! Current name of an object 
            INTEGER(SIZE_T), INTENT(IN) :: size    ! Maximum number of buffer
            CHARACTER(LEN=size), INTENT(OUT) :: buffer 
                                                   ! Buffer to hold a name of
                                                   ! the object symbolic link
                                                   ! points to
            INTEGER, INTENT(OUT) :: hdferr         ! Error code
            
            INTEGER :: namelen ! Lenghth of the current_name string

!            INTEGER, EXTERNAL :: h5gget_linkval_c
!  MS FORTRAN needs explicit interface for C functions called here.
!
            INTERFACE
              INTEGER FUNCTION h5gget_linkval_c(loc_id, name, namelen, size, buffer)
              USE H5GLOBAL
              !MS$ATTRIBUTES C,reference,alias:'_H5GGET_LINKVAL_C'::h5gget_linkval_c
              !DEC$ATTRIBUTES reference :: name
              !DEC$ATTRIBUTES reference :: buffer 
              INTEGER(HID_T), INTENT(IN) :: loc_id
              CHARACTER(LEN=*), INTENT(IN) :: name 
              INTEGER :: namelen
              INTEGER(SIZE_T), INTENT(IN) :: size
              CHARACTER(LEN=*), INTENT(OUT) :: buffer
              END FUNCTION h5gget_linkval_c
            END INTERFACE
            
            namelen = LEN(name)
            hdferr = h5gget_linkval_c(loc_id, name, namelen, size, buffer)
          END SUBROUTINE h5gget_linkval_f

!----------------------------------------------------------------------
! Name:		h5gset_comment_f 
!
! Purpose: 	Sets comment for specified object. 	
!
! Inputs:  
!		loc_id		- location identifier
!		name		- name of the object
!		comment		- comment to set for the object
! Outputs:  
!		hdferr:		- error code		
!				 	Success:  0
!				 	Failure: -1   
! Optional parameters:
!				NONE
!
! Programmer:	Elena Pourmal
!		August 12, 1999	
!
! Modifications: 	Explicit Fortran interfaces were added for 
!			called C functions (it is needed for Windows
!			port).  March 5, 2001 
!
! Comment:		
!----------------------------------------------------------------------

           SUBROUTINE h5gset_comment_f(loc_id, name, comment, hdferr)

            IMPLICIT NONE
            INTEGER(HID_T), INTENT(IN) :: loc_id   ! File or group identifier 
            CHARACTER(LEN=*), INTENT(IN) :: name   ! Current name of an object 
            CHARACTER(LEN=*), INTENT(IN) :: comment ! New name of an object
            INTEGER, INTENT(OUT) :: hdferr         ! Error code
            
            INTEGER :: namelen ! Lenghth of the current_name string
            INTEGER :: commentlen     ! Lenghth of the comment string

!            INTEGER, EXTERNAL :: h5gset_comment_c
!  MS FORTRAN needs explicit interface for C functions called here.
!
            INTERFACE
              INTEGER FUNCTION h5gset_comment_c(loc_id, name, namelen, &
                                                comment, commentlen)
              USE H5GLOBAL
              !MS$ATTRIBUTES C,reference,alias:'_H5GSET_COMMENT_C'::h5gset_comment_c
              !DEC$ATTRIBUTES reference :: name 
              !DEC$ATTRIBUTES reference :: comment 
              INTEGER(HID_T), INTENT(IN) :: loc_id
              CHARACTER(LEN=*), INTENT(IN) :: name
              INTEGER :: namelen
              CHARACTER(LEN=*), INTENT(IN) :: comment
              INTEGER :: commentlen
              END FUNCTION h5gset_comment_c
            END INTERFACE
            
            namelen = LEN(name)
            commentlen = LEN(comment)
            hdferr = h5gset_comment_c(loc_id, name, namelen, comment, commentlen)
          END SUBROUTINE h5gset_comment_f

!----------------------------------------------------------------------
! Name:		h5gget_comment_f 
!
! Purpose:	Retrieves comment for specified object.  	
!
! Inputs:  
!		loc_id		- location identifier
!		name		- name of the object at specified location
!		size		- size of the buffer required to hold comment
! Outputs:  
!		buffer		- buffer to hold object's comment
!		hdferr:		- error code		
!				 	Success:  0
!				 	Failure: -1   
! Optional parameters:
!				NONE
!
! Programmer:	Elena Pourmal
!		August 12, 1999	
!
! Modifications: 	Explicit Fortran interfaces were added for 
!			called C functions (it is needed for Windows
!			port).  March 5, 2001 
!
! Comment:		
!----------------------------------------------------------------------

          SUBROUTINE h5gget_comment_f(loc_id, name, size, buffer, hdferr)

            IMPLICIT NONE
            INTEGER(HID_T), INTENT(IN) :: loc_id   ! File or group identifier 
            CHARACTER(LEN=*), INTENT(IN) :: name   ! Current name of an object 
            INTEGER(SIZE_T), INTENT(IN) :: size    ! Maximum number of buffer
            CHARACTER(LEN=size), INTENT(OUT) :: buffer 
                                                   ! Buffer to hold a comment
            INTEGER, INTENT(OUT) :: hdferr         ! Error code
            
            INTEGER :: namelen ! Lenghth of the current_name string

!            INTEGER, EXTERNAL :: h5gget_comment_c
!  MS FORTRAN needs explicit interface for C functions called here.
!
            INTERFACE
              INTEGER FUNCTION h5gget_comment_c(loc_id, name, namelen, &
                                                size, buffer)
              USE H5GLOBAL
              !MS$ATTRIBUTES C,reference,alias:'_H5GGET_COMMENT_C'::h5gget_comment_c
              !DEC$ATTRIBUTES reference :: name 
              !DEC$ATTRIBUTES reference :: buffer 
              INTEGER(HID_T), INTENT(IN) :: loc_id
              CHARACTER(LEN=*), INTENT(IN) :: name
              INTEGER :: namelen
              INTEGER(SIZE_T), INTENT(IN) :: size
              CHARACTER(LEN=*), INTENT(OUT) :: buffer
              END FUNCTION h5gget_comment_c
            END INTERFACE
            
            namelen = LEN(name)
            hdferr = h5gget_comment_c(loc_id, name, namelen, size, buffer)
          END SUBROUTINE h5gget_comment_f


      END MODULE H5G