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
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
|
/****h* H5Lf/H5Lf
* PURPOSE
* This file contains C stubs for H5L Fortran APIs
*
* COPYRIGHT
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
******
*/
#include "H5f90.h"
#include "H5Eprivate.h"
/****if* H5Lf/h5lcopy_c
* NAME
* h5lcopy_c
* PURPOSE
* Call H5Lcopy
* INPUTS
*
* src_loc_id - Location identifier of the source link
* src_name - Name of the link to be copied
* src_namelen - length of the name
* dest_loc_id - Location identifier specifying the destination of the copy
* dest_name - Name to be assigned to the NEW copy
* dest_namelen - Length of the name
* loc_id - Identifier of the file or group containing the object
* name - Name of the link to delete
* lcpl_id - Link creation property list identifier
* lapl_id - Link access property list identifier
*
* RETURNS
* 0 on success, -1 on failure
* AUTHOR
* M. Scot Breitenfeld
* January, 2008
* HISTORY
*
* SOURCE
*/
int_f
h5lcopy_c(hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_namelen, hid_t_f *dest_loc_id,
_fcd dest_name, size_t_f *dest_namelen,
hid_t_f *lcpl_id, hid_t_f *lapl_id)
/******/
{
char *c_src_name = NULL;
char *c_dest_name = NULL;
int_f ret_value = 0;
/*
* Convert FORTRAN name to C name
*/
if(NULL == (c_src_name = HD5f2cstring(src_name, (size_t)*src_namelen)))
HGOTO_DONE(FAIL)
if(NULL == (c_dest_name = HD5f2cstring(dest_name, (size_t)*dest_namelen)))
HGOTO_DONE(FAIL)
/*
* Call H5Lcopy function.
*/
if(H5Lcopy((hid_t)*src_loc_id, c_src_name, (hid_t) *dest_loc_id,
c_dest_name, (hid_t)*lcpl_id, (hid_t)*lapl_id ) < 0)
HGOTO_DONE(FAIL)
done:
if(c_src_name)
HDfree(c_src_name);
if(c_dest_name)
HDfree(c_dest_name);
return ret_value;
}
/****if* H5Lf/h5lcreate_external_c
* NAME
* h5lcreate_external_c
* PURPOSE
* Call H5Lcreate_external_c
* INPUTS
*
* file_name - Name of the file containing the target object. Neither the file nor the target object is
* required to exist. May be the file the link is being created in.
* obj_name - Path within the target file to the target object.
* link_loc_id - The file or group identifier for the new link.
* link_name - The name of the new link.
* lcpl_id - Link creation property list identifier.
* lapl_id - Link access property list identifier.
*
* RETURNS
* 0 on success, -1 on failure
* AUTHOR
* M. Scot Breitenfeld
* February 29, 2008
* SOURCE
*/
int_f
h5lcreate_external_c(_fcd file_name, size_t_f *file_namelen, _fcd obj_name, size_t_f *obj_namelen,
hid_t_f *link_loc_id, _fcd link_name, size_t_f *link_namelen,
hid_t_f *lcpl_id, hid_t_f *lapl_id)
/******/
{
char *c_file_name = NULL;
char *c_obj_name = NULL;
char *c_link_name = NULL;
int_f ret_value = 0;
/*
* Convert FORTRAN name to C name
*/
if((c_file_name = HD5f2cstring(file_name, (size_t)*file_namelen)) == NULL)
HGOTO_DONE(FAIL);
if((c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)) == NULL)
HGOTO_DONE(FAIL);
if((c_link_name = HD5f2cstring(link_name, (size_t)*link_namelen)) == NULL)
HGOTO_DONE(FAIL);
/*
* Call H5Lcopy function.
*/
if( H5Lcreate_external( c_file_name, c_obj_name, (hid_t) *link_loc_id, c_link_name,
(hid_t) *lcpl_id, (hid_t) *lapl_id) < 0)
HGOTO_DONE(FAIL);
done:
if(c_file_name)
HDfree(c_file_name);
if(c_obj_name)
HDfree(c_obj_name);
if(c_link_name)
HDfree(c_link_name);
return ret_value;
}
/****if* H5Lf/h5ldelete_c
* NAME
* h5ldelete_c
* PURPOSE
* Call H5Ldelete
* INPUTS
*
*
* loc_id - Identifier of the file or group containing the object
* name - Name of the link to delete
* lapl_id - Link access property list identifier
* namelen - length of name
*
* RETURNS
* 0 on success, -1 on failure
* AUTHOR
* M. Scot Breitenfeld
* January, 2008
* SOURCE
*/
int_f
h5ldelete_c ( hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id )
/******/
{
char *c_name = NULL;
int_f ret_value = 0;
/*
* Convert FORTRAN name to C name
*/
if((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL)
HGOTO_DONE(FAIL);
/*
* Call H5Ldelete function.
*/
if( H5Ldelete( (hid_t)*loc_id, c_name, (hid_t)*lapl_id ) < 0)
HGOTO_DONE(FAIL);
done:
if(c_name)
HDfree(c_name);
return ret_value;
}
/****if* H5Lf/h5lcreate_soft_c
* NAME
* h5lcreate_soft_c
* PURPOSE
* Call H5Lcreate_soft
* INPUTS
*
*
* target_path - Path to the target object, which is not required to exist.
* link_loc_id - The file or group identifier for the new link.
* link_name - The name of the new link.
* lcpl_id - Link creation property list identifier.
* lapl_id - Link access property list identifier.
*
* RETURNS
* 0 on success, -1 on failure
* AUTHOR
* M. Scot Breitenfeld
* February 20, 2008
* SOURCE
*/
int_f
h5lcreate_soft_c(_fcd target_path, size_t_f *target_path_len,
hid_t_f *link_loc_id,
_fcd link_name, size_t_f *link_name_len,
hid_t_f *lcpl_id, hid_t_f *lapl_id )
/******/
{
char *c_target_path = NULL;
char *c_link_name = NULL;
int_f ret_value = 0;
/*
* Convert FORTRAN name to C name
*/
if((c_target_path = HD5f2cstring(target_path, (size_t)*target_path_len)) == NULL)
HGOTO_DONE(FAIL);
if((c_link_name = HD5f2cstring(link_name, (size_t)*link_name_len)) == NULL)
HGOTO_DONE(FAIL);
/*
* Call H5Adelete function.
*/
if ( H5Lcreate_soft(c_target_path,(hid_t)*link_loc_id, c_link_name, (hid_t)*lcpl_id, (hid_t)*lapl_id) < 0)
HGOTO_DONE(FAIL);
done:
if(c_target_path)
HDfree(c_target_path);
if(c_link_name)
HDfree(c_link_name);
return ret_value;
}
/****if* H5Lf/h5lcreate_hard_c
* NAME
* h5lcreate_hard_c
* PURPOSE
* Call H5Lcreate_hard
* INPUTS
*
* obj_loc_id - The file or group identifier for the target object.
* obj_name - Name of the target object, which must already exist.
* obj_namelen - Name length
* link_loc_id - The file or group identifier for the new link.
* link_name - The name of the new link.
* link_namelen- Name length
* lcpl_id - Link creation property list identifier.
* lapl_id - Link access property list identifier.
*
* RETURNS
* 0 on success, -1 on failure
* AUTHOR
* M. Scot Breitenfeld
* February 27, 2008
* SOURCE
*/
int_f
h5lcreate_hard_c(hid_t_f *obj_loc_id, _fcd obj_name, size_t_f *obj_namelen,
hid_t_f *link_loc_id,
_fcd link_name, size_t_f *link_namelen,
hid_t_f *lcpl_id, hid_t_f *lapl_id )
/******/
{
char *c_obj_name = NULL;
char *c_link_name = NULL;
int_f ret_value = 0;
/*
* Convert FORTRAN name to C name
*/
if((c_obj_name = HD5f2cstring(obj_name, (size_t)*obj_namelen)) == NULL)
HGOTO_DONE(FAIL);
if((c_link_name = HD5f2cstring(link_name, (size_t)*link_namelen)) == NULL)
HGOTO_DONE(FAIL);
/*
* Call H5Lcreate_hard function.
*/
if ( H5Lcreate_hard((hid_t)*obj_loc_id, c_obj_name, (hid_t)*link_loc_id, c_link_name, (hid_t)*lcpl_id, (hid_t)*lapl_id) < 0)
HGOTO_DONE(FAIL);
done:
if(c_obj_name)
HDfree(c_obj_name);
if(c_link_name)
HDfree(c_link_name);
return ret_value;
}
/****if* H5Lf/h5ldelete_by_idx_c
* NAME
* h5ldelete_by_idx_c
* PURPOSE
* Calls h5ldelete_by_idx
* INPUTS
*
* loc_id - File or group identifier specifying location of subject group
* group_name - Name of subject group
* group_namelen - Name length
* index_field - Type of index; Possible values are:
* H5_INDEX_UNKNOWN_F = -1 - Unknown index type
* H5_INDEX_NAME_F - Index on names
* H5_INDEX_CRT_ORDER_F - Index on creation order
* H5_INDEX_N_F - Number of indices defined
* order - Order within field or index; Possible values are:
* H5_ITER_UNKNOWN_F - Unknown order
* H5_ITER_INC_F - Increasing order
* H5_ITER_DEC_F - Decreasing order
* H5_ITER_NATIVE_F - No particular order, whatever is fastest
* H5_ITER_N_F - Number of iteration orders
* n - Link for which to retrieve information
* lapl_id - Link access property list
*
* OUTPUTS
* N/A
* RETURNS
* 0 on success, -1 on failure
* AUTHOR
* M. Scot Breitenfeld
* February 29, 2008
* HISTORY
* N/A
* SOURCE
*/
int_f
h5ldelete_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen,
int_f *index_field, int_f *order, hsize_t_f *n, hid_t_f *lapl_id)
/******/
{
char *c_group_name = NULL; /* Buffer to hold C string */
H5_index_t c_index_field;
H5_iter_order_t c_order;
int_f ret_value = 0; /* Return value */
/*
* Convert FORTRAN name to C name
*/
if((c_group_name = HD5f2cstring(group_name, (size_t)*group_namelen)) == NULL)
HGOTO_DONE(FAIL);
c_index_field = (H5_index_t)*index_field;
c_order = (H5_iter_order_t)*order;
/*
* Call H5Ldelete_by_name function.
*/
if(H5Ldelete_by_idx((hid_t)*loc_id, c_group_name, c_index_field, c_order, (hsize_t)*n, (hid_t)*lapl_id) < 0)
HGOTO_DONE(FAIL);
done:
if(c_group_name)
HDfree(c_group_name);
return ret_value;
}
/****if* H5Lf/h5lexists_c
* NAME
* h5lexists_c
* PURPOSE
* Calls H5Lexists
* INPUTS
*
* loc_id - Identifier of the file or group to query.
* name - Link name to check
* lapl_id - Link access property list identifier.
* OUTPUTS
*
* link_exists_c - returns a positive value, for TRUE, or 0 (zero), for FALSE.
* RETURNS
* 0 on success, -1 on failure
* AUTHOR
* M. Scot Breitenfeld
* February 29, 2008
* HISTORY
*
* SOURCE
*/
int_f
h5lexists_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id, int_f *link_exists)
/******/
{
char *c_name = NULL; /* Buffer to hold C string */
int_f ret_value = 0; /* Return value */
/*
* Convert FORTRAN name to C name
*/
if((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL)
HGOTO_DONE(FAIL);
/*
* Call H5Lexists function.
*/
if((*link_exists = (int_f)H5Lexists((hid_t)*loc_id, c_name, (hid_t)*lapl_id)) < 0)
HGOTO_DONE(FAIL);
done:
if(c_name)
HDfree(c_name);
return ret_value;
}
/****if* H5Lf/h5lget_info_c
* NAME
* h5lget_info_c
* PURPOSE
* Call H5Lget_info
* INPUTS
*
* link_loc_id - File or group identifier.
* link_name - Name of the link for which information is being sought
* link_namelen - Name length
* lapl_id - Link access property list
* OUTPUTS
*
*
* cset - indicates the character set used for link’s name.
* corder - specifies the link’s creation order position.
* corder_valid - indicates whether the value in corder is valid.
* link_type - specifies the link class:
* H5L_LINK_HARD_F - Hard link
* H5L_LINK_SOFT_F - Soft link
* H5L_LINK_EXTERNAL_F - External link
* H5L_LINK_ERROR_F - Error
* token - If the link is a hard link, token specifies the token for the object that the link points to
* val_size - If the link is a symbolic link, val_size will be the length of the link value
*
* RETURNS
* 0 on success, -1 on failure
* AUTHOR
* M. Scot Breitenfeld
* January, 2008
* HISTORY
* N/A
* SOURCE
*/
int_f
h5lget_info_c(hid_t_f *link_loc_id, _fcd link_name, size_t_f *link_namelen,
int_f *cset, int_f *corder, int_f *corder_valid, int_f *link_type,
H5O_token_t *token, size_t_f *val_size, hid_t_f *lapl_id)
/******/
{
char *c_link_name = NULL; /* Buffer to hold C string */
int_f ret_value = 0; /* Return value */
H5L_info2_t link_buff;
/*
* Convert FORTRAN name to C name
*/
if(NULL == (c_link_name = HD5f2cstring(link_name, (size_t)*link_namelen)))
HGOTO_DONE(FAIL);
/*
* Call H5Linfo function.
*/
if(H5Lget_info2((hid_t)*link_loc_id, c_link_name, &link_buff, (hid_t)*lapl_id) < 0)
HGOTO_DONE(FAIL);
/* Unpack the structure */
*cset = (int_f)link_buff.cset;
*corder = (int_f)link_buff.corder;
*corder_valid = 0;
if(link_buff.corder_valid > 0) *corder_valid = 1;
*link_type = (int_f)link_buff.type;
*token = link_buff.u.token;
*val_size = (size_t_f)link_buff.u.val_size;
done:
if(c_link_name)
HDfree(c_link_name);
return ret_value;
}
/****if* H5Lf/h5lget_info_by_idx_c
* NAME
* h5lget_info_by_idx_c
* PURPOSE
* Call H5Lget_info_by_idx
* INPUTS
*
* loc_id - File or group identifier specifying location of subject group
* group_name - Name of subject group
* group_namelen - Name length
* index_field - Index or field which determines the order
* order - Order within field or index
* n - Link for which to retrieve information
* lapl_id - Link access property list
* OUTPUTS
*
* corder_valid - Indicates whether the the creation order data is valid for this attribute
* corder - Is a positive integer containing the creation order of the attribute
* cset - Indicates the character set used for the attribute’s name
* data_size - indicates the size, in the number of characters, of the attribute
*
* RETURNS
* 0 on success, -1 on failure
* AUTHOR
* M. Scot Breitenfeld
* January, 2008
* HISTORY
* N/A
* SOURCE
*/
int_f
h5lget_info_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen,
int_f *index_field, int_f *order, hsize_t_f *n,
int_f *link_type, int_f *corder_valid, int_f *corder,
int_f *cset, H5O_token_t *token, size_t_f *val_size, hid_t_f *lapl_id)
/******/
{
char *c_group_name = NULL; /* Buffer to hold C string */
H5_index_t c_index_field;
H5_iter_order_t c_order;
int_f ret_value = 0; /* Return value */
H5L_info2_t link_buff;
/*
* Convert FORTRAN name to C name
*/
if((c_group_name = HD5f2cstring(group_name, (size_t)*group_namelen)) == NULL)
HGOTO_DONE(FAIL);
c_index_field = (H5_index_t)*index_field;
c_order = (H5_iter_order_t)*order;
/*
* Call H5Linfo_by_idx function.
*/
if(H5Lget_info_by_idx2((hid_t)*loc_id, c_group_name, c_index_field, c_order, (hsize_t)*n,
&link_buff, (hid_t)*lapl_id) < 0)
HGOTO_DONE(FAIL);
/* Unpack the structure */
*corder_valid = 0;
if(link_buff.corder_valid > 0) *corder_valid = 1;
*corder = (int_f)link_buff.corder;
*cset = (int_f)link_buff.cset;
*link_type = (int_f)link_buff.type;
*token = link_buff.u.token;
*val_size = (size_t_f)link_buff.u.val_size;
done:
return ret_value;
}
/****if* H5Lf/H5Lis_registered_c
* NAME
* H5Lis_registered_c
* PURPOSE
* Call H5Lis_registered
* INPUTS
*
* link_cls_id - User-defined link class identifier
* OUTPUTS
* NONE
*
* RETURNS
* Returns a positive value if the link class has been registered
* and zero if it is unregistered. Otherwise returns a negative value
* AUTHOR
* M. Scot Breitenfeld
* March 3, 2008
* HISTORY
* N/A
* SOURCE
*/
int_f
h5lis_registered_c(int_f *link_cls_id)
/******/
{
int_f ret_value; /* Return value */
/*
* Call H5Lis_registered
*/
ret_value = (int_f)H5Lis_registered((H5L_type_t)*link_cls_id);
return ret_value;
}
/* { not sure what this is fix -scot- */
/* int_f ret_value = 0; /\* Return value *\/ */
/* H5L_type_t c_link_cls_id; /\* User-defined link class identifier *\/ */
/* htri_t registered; /\* registration status *\/ */
/* c_link_cls_id = (H5L_type_t)*link_cls_id; */
/* /\* */
/* * Call H5Lis_registered */
/* *\/ */
/* registered = H5Lis_registered(c_link_cls_id); */
/* ret_value = (int_f)registered; */
/* return ret_value; */
/* } */
/****if* H5Lf/h5lmove_c
* NAME
* h5lmove_c
* PURPOSE
* Call H5Lmove
* INPUTS
*
* src_loc_id - Original file or group identifier.
* src_name - Original link name.
* src_namelen - name length
* dest_loc_id - Destination file or group identifier.
* dest_name - NEW link name.
* dest_namelen - name length
* OUTPUTS
*
*
* RETURNS
* 0 on success, -1 on failure
* AUTHOR
* M. Scot Breitenfeld
* March 3, 2008
* SOURCE
*/
int_f
h5lmove_c(hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_namelen, hid_t_f *dest_loc_id,
_fcd dest_name, size_t_f *dest_namelen, hid_t_f *lcpl_id, hid_t_f *lapl_id)
/******/
{
char *c_src_name = NULL; /* Buffer to hold C string */
char *c_dest_name = NULL; /* Buffer to hold C string */
int_f ret_value = 0; /* Return value */
/*
* Convert FORTRAN name to C name
*/
if(NULL == (c_src_name = HD5f2cstring(src_name, (size_t)*src_namelen)))
HGOTO_DONE(FAIL)
if(NULL == (c_dest_name = HD5f2cstring(dest_name, (size_t)*dest_namelen)))
HGOTO_DONE(FAIL)
/*
* Call H5Lmove function.
*/
if(H5Lmove((hid_t)*src_loc_id, c_src_name, (hid_t)*dest_loc_id,
c_dest_name, (hid_t)*lcpl_id, (hid_t)*lapl_id) < 0)
HGOTO_DONE(FAIL)
done:
if(c_src_name)
HDfree(c_src_name);
if(c_dest_name)
HDfree(c_dest_name);
return ret_value;
}
/****if* H5Lf/h5lget_name_by_idx_c
* NAME
* h5lget_name_by_idx_c
* PURPOSE
* Call H5Lget_name_by_idx
* INPUTS
*
* loc_id - File or group identifier specifying location of subject group
* group_name - Name of subject group
* index_field - Index or field which determines the order
* order - Order within field or index
* n - Link for which to retrieve information
* size - Maximum number of characters of link value to be returned.
* lapl_id - Link access property list
* OUTPUTS
*
* name - Buffer in which link value is returned
* size - The size of the link name on success
* RETURNS
* 0 on success, -1 on failure
* AUTHOR
* M. Scot Breitenfeld
* March 10, 2008
* SOURCE
*/
int_f
h5lget_name_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen,
int_f *index_field, int_f *order, hsize_t_f *n,
size_t_f *size, _fcd name, hid_t_f *lapl_id)
/******/
{
char *c_group_name = NULL; /* Buffer to hold C string */
char *c_name = NULL; /* Buffer to hold C string */
size_t c_size;
ssize_t c_size_link;
int_f ret_value = 0; /* Return value */
/*
* Convert FORTRAN name to C name
*/
if(NULL == (c_group_name = HD5f2cstring(group_name, (size_t)*group_namelen)))
HGOTO_DONE(FAIL)
c_size = (size_t)*size + 1;
/*
* Allocate buffer to hold name of an attribute
*/
if(NULL == (c_name = (char *)HDmalloc(c_size)))
HGOTO_DONE(FAIL)
if((c_size_link = H5Lget_name_by_idx((hid_t)*loc_id, c_group_name, (H5_index_t)*index_field,
(H5_iter_order_t)*order, (hsize_t)*n,c_name, c_size, (hid_t)*lapl_id)) < 0)
HGOTO_DONE(FAIL)
*size = (size_t_f)c_size_link;
/*
* Convert C name to FORTRAN and place it in the given buffer
*/
if(c_name)
HD5packFstring(c_name, _fcdtocp(name), c_size - 1);
done:
if(c_group_name)
HDfree(c_group_name);
if(c_name)
HDfree(c_name);
return ret_value;
}
/* /\****if* H5Lf/h5lget_val_c */
/* * NAME */
/* * h5lget_val_c */
/* * PURPOSE */
/* * Call H5Lget_val */
/* * INPUTS */
/* * */
/* * link_loc_id - File or group identifier. */
/* * link_name - Name of the link for which valrmation is being sought */
/* * link_namelen - Name length */
/* * size - Maximum number of characters of link value to be returned. */
/* * lapl_id - Link access property list */
/* * OUTPUTS */
/* * */
/* * linkval_buff - The buffer to hold the returned link value. */
/* * */
/* * RETURNS */
/* * 0 on success, -1 on failure */
/* * AUTHOR */
/* * M. Scot Breitenfeld */
/* * March 3, 2008 */
/* * HISTORY */
/* * N/A */
/* * SOURCE */
/* *\/ */
/* int_f */
/* h5lget_val_c (hid_t_f *link_loc_id, _fcd link_name, size_t_f *link_namelen, */
/* size_t_f *size, _fcd linkval_buff, */
/* hid_t_f *lapl_id) */
/* { */
/* char *c_link_name = NULL; /\* Buffer to hold C string *\/ */
/* int_f ret_value = 0; /\* Return value *\/ */
/* void *c_linkval_buff = NULL; */
/* /\* */
/* * Convert FORTRAN name to C name */
/* *\/ */
/* if((c_link_name = HD5f2cstring(link_name, (size_t)*link_namelen)) == NULL) */
/* HGOTO_DONE(FAIL); */
/* /\* */
/* * Call H5Lval function. */
/* *\/ */
/* if(H5Lget_val((hid_t)*link_loc_id, c_link_name, &linkval_buff, (size_t)*size, (hid_t)*lapl_id) < 0) */
/* HGOTO_DONE(FAIL); */
/* /\* */
/* * Convert C name to FORTRAN */
/* *\/ */
/* HD5packFstring(c_buf, _fcdtocp(buf), c_bufsize-1); */
/* done: */
/* return ret_value; */
/* } */
/* /\****if* H5Lf/ */
/* * NAME */
/* * H5Lregistered_c */
/* * PURPOSE */
/* * Call H5Lregistered */
/* * INPUTS */
/* * */
/* * */
/* * INPUTS */
/* * */
/* * version - Version number of this struct */
/* * class_id - Link class identifier */
/* * comment - Comment for debugging */
/* * comment_len - Comment for debugging */
/* * create_func - Callback during link creation */
/* * create_func_len - length */
/* * move_func - Callback after moving link */
/* * move_func_len - length */
/* * copy_func - Callback after copying link */
/* * copy_func_len - length */
/* * trav_func - The main traversal function */
/* * trav_func_len - length */
/* * del_func - Callback for link deletion */
/* * del_func_len - length */
/* * query_func - Callback for queries */
/* * query_func_len - length */
/* * */
/* * RETURNS */
/* * 0 on success, -1 on failure */
/* * AUTHOR */
/* * M. Scot Breitenfeld */
/* * February 3, 2008 */
/* * HISTORY */
/* * */
/* * SOURCE */
/* *\/ */
/* int_f */
/* h5lregistered_c(int_f *version, int_f *class_id, */
/* _fcd comment, size_t_f *comment_len, */
/* _fcd create_func, size_t_f *create_func_len, */
/* _fcd move_func, size_t_f *move_func_len, */
/* _fcd copy_func, size_t_f *copy_func_len, */
/* _fcd trav_func, size_t_f *trav_func_len, */
/* _fcd del_func , size_t_f *del_func_len, */
/* _fcd query_func, size_t_f *query_func_len) */
/* { */
/* char *c_comment = NULL; */
/* char *c_create_func = NULL; */
/* char *c_move_func = NULL; */
/* char *c_copy_func = NULL; */
/* char *c_trav_func = NULL; */
/* char *c_del_func = NULL; */
/* char *c_query_func = NULL; */
/* H5L_class_t class_t; */
/* int_f ret_value = 0; */
/* /\* */
/* * Convert FORTRAN name to C name */
/* *\/ */
/* if((c_comment = HD5f2cstring(c_comment, (size_t)*sc_comment_len)) == NULL) */
/* HGOTO_DONE(FAIL); */
/* if((c_create_func = HD5f2cstring(c_create_func, (size_t)*c_create_func_len)) == NULL) */
/* HGOTO_DONE(FAIL); */
/* if((c_move_func = HD5f2cstring(c_move_func, (size_t)*sc_move_func_len)) == NULL) */
/* HGOTO_DONE(FAIL); */
/* if((c_copy_func = HD5f2cstring(c_copy_func, (size_t)*c_copy_func_len)) == NULL) */
/* HGOTO_DONE(FAIL); */
/* if((c_trav_func = HD5f2cstring(c_trav_func, (size_t)*sc_trav_func_len)) == NULL) */
/* HGOTO_DONE(FAIL); */
/* if((c_del_func = HD5f2cstring(c_del_func, (size_t)*c_del_func_len)) == NULL) */
/* HGOTO_DONE(FAIL); */
/* if((c_query_func = HD5f2cstring(c_query_func, (size_t)*c_query_func_len)) == NULL) */
/* HGOTO_DONE(FAIL); */
/* /\* */
/* * Pack into C struct H5L_class_t */
/* *\/ */
/* int version; /\* Version number of this struct *\/ */
/* H5L_type_t class_id; /\* Link class identifier *\/ */
/* const char *comment; /\* Comment for debugging *\/ */
/* H5L_create_func_t create_func; /\* Callback during link creation *\/ */
/* H5L_move_func_t move_func; /\* Callback after moving link *\/ */
/* H5L_copy_func_t copy_func; /\* Callback after copying link *\/ */
/* H5L_traverse_func_t trav_func; /\* The main traversal function *\/ */
/* H5L_delete_func_t del_func; /\* Callback for link deletion *\/ */
/* H5L_query_func_t query_func; /\* Callback for queries *\/ */
/* class_t.version = (int)*version; */
/* class_t.class_id = (H5L_type_t)*class_id; */
/* class_t.comment = c_comment; */
/* class_t. */
/* /\* */
/* * Call H5Lcopy function. */
/* *\/ */
/* if( H5Lcopy( (hid_t)*src_loc_id, c_src_name, (hid_t) *dest_loc_id, */
/* c_dest_name, (hid_t)*lcpl_id, (hid_t)*lapl_id ) < 0) */
/* HGOTO_DONE(FAIL); */
/* done: */
/* if(c_src_name) */
/* HDfree(c_src_name); */
/* if(c_dest_name) */
/* HDfree(c_dest_name); */
/* return ret_value; */
/* } */
/****if* H5Lf/h5lget_val_c
* NAME
* h5lget_val_c
* PURPOSE
* Call H5Lget_val
* INPUTS
*
* link_loc_id - File or group identifier.
* link_name - Link whose value is to be returned.
* link_name_len - length of link_name
* size - Maximum number of characters of link value to be returned.
* lapl_id - List access property list identifier
* OUTPUTS
*
* linkval_buff - The buffer to hold the returned link value.
*
* RETURNS
* 0 on success, -1 on failure
* AUTHOR
* M. Scot Breitenfeld
* April 11, 2008
* SOURCE
*/
int_f
h5lget_val_c(hid_t_f *link_loc_id, _fcd link_name, size_t_f *link_namelen, size_t_f *size,
void *linkval_buff, hid_t_f *lapl_id)
/******/
{
char *c_link_name = NULL; /* Buffer to hold C string */
int_f ret_value = 0; /* Return value */
/*
* Convert FORTRAN name to C name
*/
if(NULL == (c_link_name = HD5f2cstring(link_name, (size_t)*link_namelen)))
HGOTO_DONE(FAIL)
/*
* Call H5Lget_val
*/
if(H5Lget_val((hid_t)*link_loc_id, c_link_name, &linkval_buff, (size_t)*size, (hid_t)*lapl_id )< 0)
HGOTO_DONE(FAIL)
done:
if(c_link_name)
HDfree(c_link_name);
return ret_value;
}
/****if* H5Lf/h5literate_c
* NAME
* h5literate_c
* PURPOSE
* Calls H5Literate
* INPUTS
*
* group_id - Identifier specifying subject group
* index_type - Type of index which determines the order
* order - Order within index
* idx - Iteration position at which to start
* op - Callback function passing data regarding the link to the calling application
* op_data - User-defined pointer to data required by the application for its processing of the link
*
* OUTPUTS
*
* idx - Position at which an interrupted iteration may be restarted
*
* RETURNS
* >0 on success, 0< on failure
* AUTHOR
* M. Scot Breitenfeld
* July 8, 2008
* SOURCE
*/
int_f
h5literate_c(hid_t_f *group_id, int_f *index_type, int_f *order, hsize_t_f *idx, H5L_iterate2_t op, void *op_data )
/******/
{
int_f ret_value = -1; /* Return value */
herr_t func_ret_value; /* H5Linterate return value */
hsize_t idx_c = 0;
idx_c = (hsize_t)*idx;
/*
* Call H5Linterate
*/
func_ret_value = H5Literate2( (hid_t)*group_id, (H5_index_t)*index_type, (H5_iter_order_t)*order, &idx_c, op, op_data);
ret_value = (int_f)func_ret_value;
*idx = (hsize_t_f)idx_c;
return ret_value;
}
/****if* H5Lf/h5literate_by_name_c
* NAME
* h5literate_by_name_c
* PURPOSE
* Call H5Literate_by_name
* INPUTS
*
* loc_id - Identifier specifying subject group
* name - Name of subject group
* namelen - Name length
* index_type - Type of index which determines the order
* order - Order within index
* idx - Iteration position at which to start
* op - Callback function passing data regarding the link to the calling application
* op_data - User-defined pointer to data required by the application for its processing of the link
* lapl_id - List access property list identifier
*
* OUTPUTS
*
* idx - Position at which an interrupted iteration may be restarted
*
* RETURNS
* >0 on success, 0< on failure
* AUTHOR
* M. Scot Breitenfeld
* August 18, 2008
* SOURCE
*/
int_f
h5literate_by_name_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, int_f *index_type, int_f *order, hsize_t_f *idx, H5L_iterate2_t op, void *op_data, hid_t_f *lapl_id)
/******/
{
int_f ret_value = -1; /* Return value */
herr_t func_ret_value; /* H5Linterate return value */
hsize_t idx_c = 0;
char *c_name = NULL; /* Buffer to hold C string */
/*
* Convert FORTRAN name to C name
*/
if((c_name = HD5f2cstring(name, (size_t)*namelen)) == NULL)
return ret_value=-1;
idx_c = (hsize_t)*idx;
/*
* Call H5Linterate
*/
func_ret_value = H5Literate_by_name2((hid_t)*loc_id, c_name,(H5_index_t)*index_type,(H5_iter_order_t)*order,&idx_c,op,op_data,(hid_t)*lapl_id);
ret_value = (int_f)func_ret_value;
*idx = (hsize_t_f)idx_c;
if(c_name) HDfree(c_name);
return ret_value;
}
|