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
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
|
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
! 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 files COPYING and Copyright.html. COPYING can be found at the root *
! of the source code distribution tree; Copyright.html can be found at the *
! root level of an installed copy of the electronic HDF5 document set and *
! is linked from the top-level documents page. It can also be found at *
! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
! access to either file, you may request a copy from help@hdfgroup.org. *
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
!
SUBROUTINE group_test(cleanup, total_error)
USE HDF5 ! This module contains all necessary modules
IMPLICIT NONE
LOGICAL, INTENT(IN) :: cleanup
INTEGER, INTENT(OUT) :: total_error
INTEGER(HID_T) :: fapl, fapl2, my_fapl ! /* File access property lists */
INTEGER :: error
CALL H5Pcreate_f(H5P_FILE_ACCESS_F, fapl, error)
CALL check("H5Pcreate_f",error, total_error)
! /* Copy the file access property list */
CALL H5Pcopy_f(fapl, fapl2, error)
CALL check("H5Pcopy_f",error, total_error)
! /* Set the "use the latest version of the format" bounds for creating objects in the file */
CALL H5Pset_libver_bounds_f(fapl2, H5F_LIBVER_LATEST_F, H5F_LIBVER_LATEST_F, error)
CALL check("H5Pset_libver_bounds_f",error, total_error)
! /* Check for FAPL to USE */
my_fapl = fapl2
CALL mklinks(fapl2, total_error)
CALL cklinks(fapl2, total_error)
CALL group_info(cleanup, fapl2,total_error)
! CALL ud_hard_links(fapl2,total_error)
CALL timestamps(cleanup, fapl2, total_error)
CALL test_move_preserves(fapl2, total_error)
CALL delete_by_idx(cleanup,fapl2, total_error)
CALL test_lcpl(cleanup, fapl, total_error)
CALL objcopy(fapl, total_error)
CALL lifecycle(cleanup, fapl2, total_error)
IF(cleanup) CALL h5_cleanup_f("TestLinks", H5P_DEFAULT_F, error)
CALL check("h5_cleanup_f", error, total_error)
END SUBROUTINE group_test
!/*-------------------------------------------------------------------------
! * Function: group_info
! *
! * Purpose: Create a group with creation order indices and test querying
! * group info.
! *
! * Return: Success: 0
! * Failure: -1
! *
! * Programmer: Adapted from C test routines by
! * M.S. Breitenfeld
! * February 18, 2008
! *
! *-------------------------------------------------------------------------
! */
SUBROUTINE group_info(cleanup, fapl, total_error)
USE HDF5 ! This module contains all necessary modules
IMPLICIT NONE
INTEGER, INTENT(OUT) :: total_error
INTEGER(HID_T), INTENT(IN) :: fapl
INTEGER(HID_T) :: gcpl_id ! /* Group creation property list ID */
INTEGER :: max_compact ! /* Maximum # of links to store in group compactly */
INTEGER :: min_dense ! /* Minimum # of links to store in group "densely" */
INTEGER :: idx_type ! /* Type of index to operate on */
INTEGER :: order, iorder ! /* Order within in the index */
LOGICAL, DIMENSION(1:2) :: use_index = (/.FALSE.,.TRUE./) ! /* Use index on creation order values */
CHARACTER(LEN=6), PARAMETER :: prefix = 'links0'
CHARACTER(LEN=9), PARAMETER :: filename = prefix//'.h5' ! /* File name */
INTEGER :: Input1
INTEGER(HID_T) :: group_id ! /* Group ID */
INTEGER(HID_T) :: soft_group_id ! /* Group ID for soft links */
INTEGER :: i ! /* Local index variables */
INTEGER :: storage_type ! Type of storage for links in group:
! H5G_STORAGE_TYPE_COMPACT: Compact storage
! H5G_STORAGE_TYPE_DENSE: Indexed storage
! H5G_STORAGE_TYPE_SYMBOL_TABLE: Symbol tables, the original HDF5 structure
INTEGER :: nlinks ! Number of links in group
INTEGER :: max_corder ! Current maximum creation order value for group
INTEGER :: u,v ! /* Local index variables */
CHARACTER(LEN=2) :: chr2
INTEGER(HID_T) :: group_id2, group_id3 ! /* Group IDs */
CHARACTER(LEN=7) :: objname ! /* Object name */
CHARACTER(LEN=7) :: objname2 ! /* Object name */
CHARACTER(LEN=19) :: valname ! /* Link value */
CHARACTER(LEN=12), PARAMETER :: CORDER_GROUP_NAME = "corder_group"
CHARACTER(LEN=17), PARAMETER :: CORDER_SOFT_GROUP_NAME = "corder_soft_group"
INTEGER(HID_T) :: file_id ! /* File ID */
INTEGER :: error ! /* Generic return value */
LOGICAL :: cleanup
! /* Create group creation property list */
CALL H5Pcreate_f(H5P_GROUP_CREATE_F, gcpl_id, error )
CALL check("H5Pcreate_f", error, total_error)
! /* Query the group creation properties */
CALL H5Pget_link_phase_change_f(gcpl_id, max_compact, min_dense, error)
CALL check("H5Pget_link_phase_change_f", error, total_error)
! /* Loop over operating on different indices on link fields */
DO idx_type = H5_INDEX_NAME_F, H5_INDEX_CRT_ORDER_F
! /* Loop over operating in different orders */
DO iorder = H5_ITER_INC_F, H5_ITER_NATIVE_F
! /* Loop over using index for creation order value */
DO i = 1, 2
! /* Print appropriate test message */
IF(idx_type == H5_INDEX_CRT_ORDER_F)THEN
IF(iorder == H5_ITER_INC_F)THEN
order = H5_ITER_INC_F
IF(use_index(i))THEN
WRITE(*,'(5x,A)')"query group info by creation order index in increasing order w/creation order index"
ELSE
WRITE(*,'(5x,A)')"query group info by creation order index in increasing order w/o creation order index"
ENDIF
ELSE IF (iorder == H5_ITER_DEC_F) THEN
order = H5_ITER_DEC_F
IF(use_index(i))THEN
WRITE(*,'(5x,A)')"query group info by creation order index in decreasing order w/creation order index"
ELSE
WRITE(*,'(5x,A)')"query group info by creation order index in decreasing order w/o creation order index"
ENDIF
ELSE
order = H5_ITER_NATIVE_F
IF(use_index(i))THEN
WRITE(*,'(5x,A)')"query group info by creation order index in native order w/creation order index"
ELSE
WRITE(*,'(5x,A)')"query group info by creation order index in native order w/o creation order index"
ENDIF
ENDIF
ELSE
IF(iorder == H5_ITER_INC_F)THEN
order = H5_ITER_INC_F
IF(use_index(i))THEN
WRITE(*,'(5x,A)')"query group info by creation order index in increasing order w/creation order index"
ELSE
WRITE(*,'(5x,A)')"query group info by creation order index in increasing order w/o creation order index"
ENDIF
ELSE IF (iorder == H5_ITER_DEC_F) THEN
order = H5_ITER_DEC_F
IF(use_index(i))THEN
WRITE(*,'(5x,A)')"query group info by creation order index in decreasing order w/creation order index"
ELSE
WRITE(*,'(5x,A)')"query group info by creation order index in decreasing order w/o creation order index"
ENDIF
ELSE
order = H5_ITER_NATIVE_F
IF(use_index(i))THEN
WRITE(*,'(5x,A)')"query group info by creation order index in native order w/creation order index"
ELSE
WRITE(*,'(5x,A)')"query group info by creation order index in native order w/o creation order index"
ENDIF
ENDIF
END IF
! /* Create file */
CALL H5Fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error, H5P_DEFAULT_F, fapl)
CALL check("H5Fcreate_f", error, total_error)
! /* Set creation order tracking & indexing on group */
IF(use_index(i))THEN
Input1 = H5P_CRT_ORDER_INDEXED_F
ELSE
Input1 = 0
ENDIF
CALL H5Pset_link_creation_order_f(gcpl_id, IOR(H5P_CRT_ORDER_TRACKED_F, Input1), error)
CALL check("H5Pset_link_creation_order_f", error, total_error)
! /* Create group with creation order tracking on */
CALL H5Gcreate_f(file_id, CORDER_GROUP_NAME, group_id, error, gcpl_id=gcpl_id)
CALL check("H5Gcreate_f", error, total_error)
! /* Create group with creation order tracking on for soft links */
CALL H5Gcreate_f(file_id, CORDER_SOFT_GROUP_NAME, soft_group_id, error, &
OBJECT_NAMELEN_DEFAULT_F, H5P_DEFAULT_F, gcpl_id)
CALL check("H5Gcreate_f", error, total_error)
! /* Check for out of bound query by index on empty group, should fail */
CALL H5Gget_info_by_idx_f(group_id, ".", H5_INDEX_NAME_F, order, INT(0,HSIZE_T), &
storage_type, nlinks, max_corder, error)
CALL VERIFY("H5Gget_info_by_idx", error, -1, total_error)
! /* Create several links, up to limit of compact form */
DO u = 0, max_compact-1
! /* Make name for link */
WRITE(chr2,'(I2.2)') u
objname = 'fill '//chr2
! /* Create hard link, with group object */
CALL H5Gcreate_f(group_id, objname, group_id2, error, OBJECT_NAMELEN_DEFAULT_F, H5P_DEFAULT_F, gcpl_id)
CALL check("H5Gcreate_f", error, total_error)
! /* Retrieve group's information */
CALL H5Gget_info_f(group_id2, storage_type, nlinks, max_corder, error)
CALL check("H5Gget_info_f", error, total_error)
! /* Check (new/empty) group's information */
CALL VERIFY("H5Gget_info_f", storage_type, H5G_STORAGE_TYPE_COMPACT_F, total_error)
CALL VERIFY("H5Gget_info_f", max_corder, 0, total_error)
CALL VERIFY("H5Gget_info_f", nlinks, 0, total_error)
! /* Retrieve group's information */
CALL H5Gget_info_by_name_f(group_id, objname, storage_type, nlinks, max_corder, error)
CALL check("H5Gget_info_by_name", error, total_error)
! /* Check (new/empty) group's information */
CALL VERIFY("H5Gget_info_f", storage_type, H5G_STORAGE_TYPE_COMPACT_F, total_error)
CALL VERIFY("H5Gget_info_f", max_corder, 0, total_error)
CALL VERIFY("H5Gget_info_f", nlinks, 0, total_error)
! /* Retrieve group's information */
CALL H5Gget_info_by_name_f(group_id2, ".", storage_type, nlinks, max_corder, error)
CALL check("H5Gget_info_by_name", error, total_error)
! /* Check (new/empty) group's information */
CALL VERIFY("H5Gget_info_f", storage_type, H5G_STORAGE_TYPE_COMPACT_F, total_error)
CALL VERIFY("H5Gget_info_f", max_corder, 0, total_error)
CALL VERIFY("H5Gget_info_f", nlinks, 0, total_error)
! /* Create objects in new group created */
DO v = 0, u
! /* Make name for link */
WRITE(chr2,'(I2.2)') v
objname2 = 'fill '//chr2
! /* Create hard link, with group object */
CALL H5Gcreate_f(group_id2, objname2, group_id3, error )
CALL check("H5Gcreate_f", error, total_error)
! /* Close group created */
CALL H5Gclose_f(group_id3, error)
CALL check("H5Gclose_f", error, total_error)
ENDDO
! /* Retrieve group's information */
CALL H5Gget_info_f(group_id2, storage_type, nlinks, max_corder, error)
CALL check("H5Gget_info_f", error, total_error)
! /* Check (new) group's information */
CALL VERIFY("H5Gget_info_f", storage_type, H5G_STORAGE_TYPE_COMPACT_F, total_error)
CALL VERIFY("H5Gget_info_f", max_corder, u+1, total_error)
CALL VERIFY("H5Gget_info_f", nlinks, u+1, total_error)
! /* Retrieve group's information */
CALL H5Gget_info_by_name_f(group_id, objname, storage_type, nlinks, max_corder, error)
CALL check("H5Gget_info_by_name_f", error, total_error)
! /* Check (new) group's information */
CALL VERIFY("H5Gget_info_by_name_f", storage_type, H5G_STORAGE_TYPE_COMPACT_F, total_error)
CALL VERIFY("H5Gget_info_by_name_f",max_corder, u+1, total_error)
CALL VERIFY("H5Gget_info_by_name_f", nlinks, u+1, total_error)
! /* Retrieve group's information */
CALL H5Gget_info_by_name_f(group_id2, ".", storage_type, nlinks, max_corder, error)
CALL check("H5Gget_info_by_name_f", error, total_error)
! /* Check (new) group's information */
CALL VERIFY("H5Gget_info_by_name_f", storage_type, H5G_STORAGE_TYPE_COMPACT_F, total_error)
CALL VERIFY("H5Gget_info_by_name_f2", max_corder, u+1, total_error)
CALL VERIFY("H5Gget_info_by_name_f", nlinks, u+1, total_error)
! /* Retrieve group's information */
IF(order.NE.H5_ITER_NATIVE_F)THEN
IF(order.EQ.H5_ITER_INC_F) THEN
CALL H5Gget_info_by_idx_f(group_id, ".", idx_type, order, INT(u,HSIZE_T), &
storage_type, nlinks, max_corder, error,lapl_id=H5P_DEFAULT_F)
CALL check("H5Gget_info_by_idx_f", error, total_error)
ELSE
CALL H5Gget_info_by_idx_f(group_id, ".", idx_type, order, INT(0,HSIZE_T), &
storage_type, nlinks, max_corder, error)
CALL check("H5Gget_info_by_idx_f", error, total_error)
ENDIF
! /* Check (new) group's information */
CALL VERIFY("H5Gget_info_by_idx_f", storage_type, H5G_STORAGE_TYPE_COMPACT_F, total_error)
CALL VERIFY("H5Gget_info_by_idx_f33", max_corder, u+1, total_error)
CALL VERIFY("H5Gget_info_by_idx_f", nlinks, u+1, total_error)
ENDIF
! /* Close group created */
CALL H5Gclose_f(group_id2, error)
CALL check("H5Gclose_f", error, total_error)
! /* Retrieve main group's information */
CALL H5Gget_info_f(group_id, storage_type, nlinks, max_corder, error)
CALL check("H5Gget_info_f", error, total_error)
! /* Check main group's information */
CALL VERIFY("H5Gget_info_f", storage_type, H5G_STORAGE_TYPE_COMPACT_F, total_error)
CALL VERIFY("H5Gget_info_f2", max_corder, u+1, total_error)
CALL VERIFY("H5Gget_info_f", nlinks, u+1, total_error)
! /* Retrieve main group's information, by name */
CALL H5Gget_info_by_name_f(file_id, CORDER_GROUP_NAME, storage_type, nlinks, max_corder, error)
CALL check("H5Gget_info_by_name_f", error, total_error)
! /* Check main group's information */
CALL VERIFY("H5Gget_info_by_name_f", storage_type, H5G_STORAGE_TYPE_COMPACT_F, total_error)
CALL VERIFY("H5Gget_info_by_name_f", max_corder, u+1, total_error)
CALL VERIFY("H5Gget_info_by_name_f", nlinks, u+1, total_error)
! /* Retrieve main group's information, by name */
CALL H5Gget_info_by_name_f(group_id, ".", storage_type, nlinks, max_corder, error, H5P_DEFAULT_F)
CALL check("H5Gget_info_by_name_f", error, total_error)
! /* Check main group's information */
CALL VERIFY("H5Gget_info_by_name_f", storage_type, H5G_STORAGE_TYPE_COMPACT_F, total_error)
CALL VERIFY("H5Gget_info_by_name_f", max_corder, u+1, total_error)
CALL VERIFY("H5Gget_info_by_name_f", nlinks, u+1, total_error)
! /* Create soft link in another group, to objects in main group */
valname = CORDER_GROUP_NAME//objname
CALL H5Lcreate_soft_f(valname, soft_group_id, objname, error, H5P_DEFAULT_F, H5P_DEFAULT_F)
! /* Retrieve soft link group's information, by name */
CALL H5Gget_info_f(soft_group_id, storage_type, nlinks, max_corder, error)
CALL check("H5Gget_info_f", error, total_error)
! /* Check soft link group's information */
CALL VERIFY("H5Gget_info_f", storage_type, H5G_STORAGE_TYPE_COMPACT_F, total_error)
CALL VERIFY("H5Gget_info_f", max_corder, u+1, total_error)
CALL VERIFY("H5Gget_info_f", nlinks, u+1, total_error)
ENDDO
! /* Verify state of group (compact) */
! if(H5G_has_links_test(group_id, NULL) != TRUE) TEST_ERROR
!/* Check for out of bound query by index */
! H5E_BEGIN_TRY {
! ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &grp_info, H5P_DEFAULT);
! } H5E_END_TRY;
! if(ret >= 0) TEST_ERROR
! /* Create more links, to push group into dense form */
!!$ for(; u < (max_compact * 2); u++) {
!!$ hid_t group_id2, group_id3; /* Group IDs */
!!$
!!$ /* Make name for link */
!!$ sprintf(objname, "filler %02u", u);
!!$
!!$ /* Create hard link, with group object */
!!$ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
!!$
!!$
!!$ /* Retrieve group's information */
!!$ if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR
!!$
!!$ /* Check (new/empty) group's information */
!!$ if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR
!!$ if(grp_info.max_corder != 0) TEST_ERROR
!!$ if(grp_info.nlinks != 0) TEST_ERROR
!!$
!!$ /* Retrieve group's information, by name */
!!$ if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
!!$
!!$ /* Check (new/empty) group's information */
!!$ if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR
!!$ if(grp_info.max_corder != 0) TEST_ERROR
!!$ if(grp_info.nlinks != 0) TEST_ERROR
!!$
!!$ /* Retrieve group's information, by name */
!!$ if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
!!$
!!$ /* Check (new/empty) group's information */
!!$ if(grp_info.storage_type != H5G_STORAGE_TYPE_COMPACT) TEST_ERROR
!!$ if(grp_info.max_corder != 0) TEST_ERROR
!!$ if(grp_info.nlinks != 0) TEST_ERROR
!!$
!!$
!!$ /* Create objects in new group created */
!!$ for(v = 0; v <= u; v++) {
!!$ /* Make name for link */
!!$ sprintf(objname2, "filler %02u", v);
!!$
!!$ /* Create hard link, with group object */
!!$ if((group_id3 = H5Gcreate2(group_id2, objname2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
!!$
!!$ /* Close group created */
!!$ if(H5Gclose(group_id3) < 0) TEST_ERROR
!!$ } /* end for */
!!$
!!$
!!$ /* Retrieve group's information */
!!$ if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR
!!$
!!$ /* Check (new) group's information */
!!$ if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR
!!$ if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR
!!$ if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
!!$
!!$ /* Retrieve group's information, by name */
!!$ if(H5Gget_info_by_name(group_id, objname, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
!!$
!!$ /* Check (new) group's information */
!!$ if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR
!!$ if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR
!!$ if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
!!$
!!$ /* Retrieve group's information, by name */
!!$ if(H5Gget_info_by_name(group_id2, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
!!$
!!$ /* Check (new) group's information */
!!$ if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR
!!$ if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR
!!$ if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
!!$
!!$
!!$ /* Retrieve group's information */
!!$ if(order != H5_ITER_NATIVE) {
!!$ if(order == H5_ITER_INC) {
!!$ if(H5Gget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)u, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
!!$ } /* end if */
!!$ else {
!!$ if(H5Gget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
!!$ } /* end else */
!!$
!!$ /* Check (new) group's information */
!!$ if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR
!!$ if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR
!!$ if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
!!$ } /* end if */
!!$
!!$ /* Close group created */
!!$ if(H5Gclose(group_id2) < 0) TEST_ERROR
!!$
!!$
!!$ /* Retrieve main group's information */
!!$ if(H5Gget_info(group_id, &grp_info) < 0) TEST_ERROR
!!$
!!$ /* Check main group's information */
!!$ if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR
!!$ if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR
!!$ if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
!!$
!!$ /* Retrieve main group's information, by name */
!!$ if(H5Gget_info_by_name(file_id, CORDER_GROUP_NAME, &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
!!$
!!$ /* Check main group's information */
!!$ if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR
!!$ if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR
!!$ if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
!!$
!!$ /* Retrieve main group's information, by name */
!!$ if(H5Gget_info_by_name(group_id, ".", &grp_info, H5P_DEFAULT) < 0) TEST_ERROR
!!$
!!$ /* Check main group's information */
!!$ if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR
!!$ if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR
!!$ if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
!!$
!!$
!!$ /* Create soft link in another group, to objects in main group */
!!$ sprintf(valname, "/%s/%s", CORDER_GROUP_NAME, objname);
!!$ if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
!!$
!!$ /* Retrieve soft link group's information, by name */
!!$ if(H5Gget_info(soft_group_id, &grp_info) < 0) TEST_ERROR
!!$
!!$ /* Check soft link group's information */
!!$ if(grp_info.storage_type != H5G_STORAGE_TYPE_DENSE) TEST_ERROR
!!$ if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR
!!$ if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR
!!$ } /* end for */
!!$
!!$ /* Verify state of group (dense) */
!!$ if(H5G_is_new_dense_test(group_id) != TRUE) TEST_ERROR
!!$
!!$ /* Check for out of bound query by index */
!!$ H5E_BEGIN_TRY {
!!$ ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &grp_info, H5P_DEFAULT);
!!$ } H5E_END_TRY;
!!$ if(ret >= 0) TEST_ERROR
! /* Close the groups */
CALL H5Gclose_f(group_id, error)
CALL check("H5Gclose_f", error, total_error)
CALL H5Gclose_f(soft_group_id, error)
CALL check("H5Gclose_f", error, total_error)
! /* Close the file */
CALL H5Fclose_f(file_id, error)
CALL check("H5Fclose_f", error, total_error)
ENDDO
ENDDO
ENDDO
! /* Free resources */
CALL H5Pclose_f(gcpl_id, error)
CALL check("H5Pclose_f", error, total_error)
IF(cleanup) CALL h5_cleanup_f(prefix, H5P_DEFAULT_F, error)
CALL check("h5_cleanup_f", error, total_error)
END SUBROUTINE group_info
!/*-------------------------------------------------------------------------
! * Function: timestamps
! *
! * Purpose: Verify that disabling tracking timestamps for an object
! * works correctly
! *
! *
! * Programmer: M.S. Breitenfeld
! * February 20, 2008
! *
! *-------------------------------------------------------------------------
! */
SUBROUTINE timestamps(cleanup, fapl, total_error)
USE HDF5 ! This module contains all necessary modules
IMPLICIT NONE
INTEGER, INTENT(OUT) :: total_error
INTEGER(HID_T), INTENT(IN) :: fapl
INTEGER(HID_T) :: file_id !/* File ID */
INTEGER(HID_T) :: group_id !/* Group ID */
INTEGER(HID_T) :: group_id2 !/* Group ID */
INTEGER(HID_T) :: gcpl_id !/* Group creation property list ID */
INTEGER(HID_T) :: gcpl_id2 !/* Group creation property list ID */
CHARACTER(LEN=6), PARAMETER :: prefix = 'links9'
CHARACTER(LEN=9), PARAMETER :: filename = prefix//'.h5' ! /* File name */
! /* Timestamp macros */
CHARACTER(LEN=10), PARAMETER :: TIMESTAMP_GROUP_1="timestamp1"
CHARACTER(LEN=10), PARAMETER :: TIMESTAMP_GROUP_2="timestamp2"
LOGICAL :: track_times
LOGICAL :: cleanup
INTEGER :: error
! /* Print test message */
WRITE(*,*) "timestamps on objects"
! /* Create group creation property list */
CALL H5Pcreate_f(H5P_GROUP_CREATE_F, gcpl_id, error )
CALL check("H5Pcreate_f", error, total_error)
! /* Query the object timestamp setting */
CALL H5Pget_obj_track_times_f(gcpl_id, track_times, error)
CALL check("H5Pget_obj_track_times_f", error, total_error)
!/* Check default timestamp information */
CALL VerifyLogical("H5Pget_obj_track_times",track_times,.TRUE.,total_error)
! /* Set a non-default object timestamp setting */
CALL H5Pset_obj_track_times_f(gcpl_id, .FALSE., error)
CALL check("H5Pset_obj_track_times_f", error, total_error)
! /* Query the object timestamp setting */
CALL H5Pget_obj_track_times_f(gcpl_id, track_times, error)
CALL check("H5Pget_obj_track_times_f", error, total_error)
! /* Check default timestamp information */
CALL VerifyLogical("H5Pget_obj_track_times",track_times,.FALSE.,total_error)
! /* Create file */
!h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
CALL H5Fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error, H5P_DEFAULT_F, fapl)
CALL check("h5fcreate_f",error,total_error)
! /* Create group with non-default object timestamp setting */
CALL h5gcreate_f(file_id, TIMESTAMP_GROUP_1, group_id, error, &
OBJECT_NAMELEN_DEFAULT_F, H5P_DEFAULT_F, gcpl_id, H5P_DEFAULT_F)
CALL check("h5fcreate_f",error,total_error)
! /* Close the group creation property list */
CALL H5Pclose_f(gcpl_id, error)
CALL check("H5Pclose_f", error, total_error)
! /* Create group with default object timestamp setting */
CALL h5gcreate_f(file_id, TIMESTAMP_GROUP_2, group_id2, error, &
OBJECT_NAMELEN_DEFAULT_F, H5P_DEFAULT_F, H5P_DEFAULT_F, H5P_DEFAULT_F)
CALL check("h5fcreate_f",error,total_error)
! /* Retrieve the new groups' creation properties */
CALL H5Gget_create_plist_f(group_id, gcpl_id, error)
CALL check("H5Gget_create_plist", error, total_error)
CALL H5Gget_create_plist_f(group_id2, gcpl_id2, error)
CALL check("H5Gget_create_plist", error, total_error)
! /* Query & verify the object timestamp settings */
CALL H5Pget_obj_track_times_f(gcpl_id, track_times, error)
CALL check("H5Pget_obj_track_times_f", error, total_error)
CALL VerifyLogical("H5Pget_obj_track_times1",track_times,.FALSE.,total_error)
CALL H5Pget_obj_track_times_f(gcpl_id2, track_times, error)
CALL check("H5Pget_obj_track_times_f", error, total_error)
CALL VerifyLogical("H5Pget_obj_track_times2",track_times,.TRUE.,total_error)
! /* Query the object information for each group */
! if(H5Oget_info(group_id, &oinfo) < 0) TEST_ERROR
! if(H5Oget_info(group_id2, &oinfo2) < 0) TEST_ERROR
!!$ /* Sanity check object information for each group */
!!$ if(oinfo.atime != 0) TEST_ERROR
!!$ if(oinfo.mtime != 0) TEST_ERROR
!!$ if(oinfo.ctime != 0) TEST_ERROR
!!$ if(oinfo.btime != 0) TEST_ERROR
!!$ if(oinfo.atime == oinfo2.atime) TEST_ERROR
!!$ if(oinfo.mtime == oinfo2.mtime) TEST_ERROR
!!$ if(oinfo.ctime == oinfo2.ctime) TEST_ERROR
!!$ if(oinfo.btime == oinfo2.btime) TEST_ERROR
!!$ if((oinfo.hdr.flags & H5O_HDR_STORE_TIMES) != 0) TEST_ERROR
!!$ if((oinfo2.hdr.flags & H5O_HDR_STORE_TIMES) == 0) TEST_ERROR
!!$ if(oinfo.hdr.space.total >= oinfo2.hdr.space.total) TEST_ERROR
!!$ if(oinfo.hdr.space.meta >= oinfo2.hdr.space.meta) TEST_ERROR
! /* Close the property lists */
CALL H5Pclose_f(gcpl_id, error)
CALL check("H5Pclose_f", error, total_error)
CALL H5Pclose_f(gcpl_id2, error)
CALL check("H5Pclose_f", error, total_error)
! /* Close the groups */
CALL H5Gclose_f(group_id, error)
CALL check("H5Gclose_f", error, total_error)
CALL H5Gclose_f(group_id2, error)
CALL check("H5Gclose_f", error, total_error)
!/* Close the file */
CALL H5Fclose_f(file_id, error)
CALL check("H5Fclose_f", error, total_error)
!/* Re-open the file */
CALL h5fopen_f(FileName, H5F_ACC_RDONLY_F, file_id, error, H5P_DEFAULT_F)
CALL check("h5fopen_f",error,total_error)
!/* Open groups */
CALL H5Gopen_f(file_id, TIMESTAMP_GROUP_1, group_id, error) ! with no optional param.
CALL check("H5Gopen_f", error, total_error)
CALL H5Gopen_f(file_id, TIMESTAMP_GROUP_2, group_id2, error, H5P_DEFAULT_F) ! with optional param.
CALL check("H5Gopen_f", error, total_error)
! /* Retrieve the new groups' creation properties */
CALL H5Gget_create_plist_f(group_id, gcpl_id, error)
CALL check("H5Gget_create_plist", error, total_error)
CALL H5Gget_create_plist_f(group_id2, gcpl_id2, error)
CALL check("H5Gget_create_plist", error, total_error)
! /* Query & verify the object timestamp settings */
CALL H5Pget_obj_track_times_f(gcpl_id, track_times, error)
CALL check("H5Pget_obj_track_times_f", error, total_error)
CALL VerifyLogical("H5Pget_obj_track_times1",track_times,.FALSE.,total_error)
CALL H5Pget_obj_track_times_f(gcpl_id2, track_times, error)
CALL check("H5Pget_obj_track_times_f", error, total_error)
CALL VerifyLogical("H5Pget_obj_track_times2",track_times,.TRUE.,total_error)
!!$
!!$ /* Query the object information for each group */
!!$ if(H5Oget_info(group_id, &oinfo) < 0) TEST_ERROR
!!$ if(H5Oget_info(group_id2, &oinfo2) < 0) TEST_ERROR
!!$
!!$ /* Sanity check object information for each group */
!!$ if(oinfo.atime != 0) TEST_ERROR
!!$ if(oinfo.mtime != 0) TEST_ERROR
!!$ if(oinfo.ctime != 0) TEST_ERROR
!!$ if(oinfo.btime != 0) TEST_ERROR
!!$ if(oinfo.atime == oinfo2.atime) TEST_ERROR
!!$ if(oinfo.mtime == oinfo2.mtime) TEST_ERROR
!!$ if(oinfo.ctime == oinfo2.ctime) TEST_ERROR
!!$ if(oinfo.btime == oinfo2.btime) TEST_ERROR
!!$ if((oinfo.hdr.flags & H5O_HDR_STORE_TIMES) != 0) TEST_ERROR
!!$ if((oinfo2.hdr.flags & H5O_HDR_STORE_TIMES) == 0) TEST_ERROR
!!$ if(oinfo.hdr.space.total >= oinfo2.hdr.space.total) TEST_ERROR
!!$ if(oinfo.hdr.space.meta >= oinfo2.hdr.space.meta) TEST_ERROR
! /* Close the property lists */
CALL H5Pclose_f(gcpl_id, error)
CALL check("H5Pclose_f", error, total_error)
CALL H5Pclose_f(gcpl_id2, error)
CALL check("H5Pclose_f", error, total_error)
! /* Close the groups */
CALL H5Gclose_f(group_id, error)
CALL check("H5Gclose_f", error, total_error)
CALL H5Gclose_f(group_id2, error)
CALL check("H5Gclose_f", error, total_error)
!/* Close the file */
CALL H5Fclose_f(file_id, error)
CALL check("H5Fclose_f", error, total_error)
IF(cleanup) CALL h5_cleanup_f(prefix, H5P_DEFAULT_F, error)
CALL check("h5_cleanup_f", error, total_error)
END SUBROUTINE timestamps
!/*-------------------------------------------------------------------------
! * Function: mklinks
! *
! * Purpose: Build a file with assorted links.
! *
! *
! * Programmer: Adapted from C test by:
! * M.S. Breitenfeld
! *
! * Modifications:
! *
! *-------------------------------------------------------------------------
! */
SUBROUTINE mklinks(fapl, total_error)
USE HDF5 ! This module contains all necessary modules
IMPLICIT NONE
INTEGER, INTENT(OUT) :: total_error
INTEGER(HID_T), INTENT(IN) :: fapl
INTEGER(HID_T) :: file, scalar, grp, d1
CHARACTER(LEN=12), PARAMETER :: filename ='TestLinks.h5'
INTEGER(HSIZE_T), DIMENSION(1) :: adims2 = (/1/) ! Attribute dimension
INTEGER :: arank = 1 ! Attribure rank
INTEGER :: error
WRITE(*,*) "link creation (w/new group format)"
! /* Create a file */
CALL h5fcreate_f(FileName, H5F_ACC_TRUNC_F, file, error, H5P_DEFAULT_F, fapl)
CALL check("mklinks.h5fcreate_f",error,total_error)
CALL h5screate_simple_f(arank, adims2, scalar, error)
CALL check("mklinks.h5screate_simple_f",error,total_error)
!/* Create a group */
CALL H5Gcreate_f(file, "grp1", grp, error)
CALL check("H5Gcreate_f", error, total_error)
CALL H5Gclose_f(grp, error)
CALL check("h5gclose_f",error,total_error)
!/* Create a dataset */
CALL h5dcreate_f(file, "d1", H5T_NATIVE_INTEGER, scalar, d1, error)
CALL check("h5dcreate_f",error,total_error)
CALL h5dclose_f(d1, error)
CALL check("h5dclose_f",error,total_error)
!/* Create a hard link */
CALL H5Lcreate_hard_f(file, "d1", INT(H5L_SAME_LOC_F,HID_T), "grp1/hard", error)
CALL check("H5Lcreate_hard_f", error, total_error)
!/* Create a symbolic link */
CALL H5Lcreate_soft_f("/d1", file, "grp1/soft",error)
CALL check("H5Lcreate_soft_f", error, total_error)
!/* Create a symbolic link to something that doesn't exist */
CALL H5Lcreate_soft_f("foobar", file, "grp1/dangle",error)
!/* Create a recursive symbolic link */
CALL H5Lcreate_soft_f("/grp1/recursive", file, "/grp1/recursive",error)
!/* Close */
CALL h5sclose_f(scalar, error)
CALL check("h5sclose_f",error,total_error)
CALL h5fclose_f(file, error)
CALL check("h5fclose_f",error,total_error)
END SUBROUTINE mklinks
!/*-------------------------------------------------------------------------
! * Function: test_move_preserves
! *
! * Purpose: Tests that moving and renaming links preserves their
! * properties.
! *
! * Programmer: M.S. Breitenfeld
! * March 3, 2008
! *
! * Modifications:
! *
! *-------------------------------------------------------------------------
! */
SUBROUTINE test_move_preserves(fapl_id, total_error)
USE HDF5 ! This module contains all necessary modules
IMPLICIT NONE
INTEGER, INTENT(OUT) :: total_error
INTEGER(HID_T), INTENT(IN) :: fapl_id
INTEGER(HID_T):: file_id
INTEGER(HID_T):: group_id
INTEGER(HID_T):: fcpl_id ! /* Group creation property list ID */
INTEGER(HID_T):: lcpl_id
INTEGER(HID_T):: lcpl2_id
!H5O_info_t oinfo;
!H5L_info_t linfo;
INTEGER :: old_cset
INTEGER :: old_corder
!H5T_cset_t old_cset;
!int64_t old_corder; /* Creation order value of link */
!time_t old_modification_time;
!time_t curr_time;
!unsigned crt_order_flags; /* Status of creation order info for GCPL */
!char filename[1024];
INTEGER :: crt_order_flags ! /* Status of creation order info for GCPL */
CHARACTER(LEN=12), PARAMETER :: filename = 'TestLinks.h5'
INTEGER :: cset ! Indicates the character set used for the link’s name.
INTEGER :: corder ! Specifies the link’s creation order position.
LOGICAL :: f_corder_valid ! Indicates whether the value in corder is valid.
INTEGER :: 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
INTEGER :: address ! If the link is a hard link, address specifies the file address that the link points to
INTEGER(HSIZE_T) :: val_size ! If the link is a symbolic link, val_size will be the length of the link value
INTEGER :: error
WRITE(*,*) "moving and copying links preserves their properties (w/new group format)"
!/* Create a file creation property list with creation order stored for links
! * in the root group
! */
CALL H5Pcreate_f(H5P_FILE_CREATE_F, fcpl_id, error)
CALL check("H5Pcreate_f",error, total_error)
CALL H5Pget_link_creation_order_f(fcpl_id, crt_order_flags, error)
CALL check("H5Pget_link_creation_order_f",error, total_error)
CALL VERIFY("H5Pget_link_creation_order_f",crt_order_flags,0, total_error)
CALL H5Pset_link_creation_order_f(fcpl_id, H5P_CRT_ORDER_TRACKED_F, error)
CALL check("H5Pset_link_creation_order_f", error, total_error)
CALL H5Pget_link_creation_order_f(fcpl_id, crt_order_flags, error)
CALL check("H5Pget_link_creation_order_f",error, total_error)
CALL VERIFY("H5Pget_link_creation_order_f",crt_order_flags, H5P_CRT_ORDER_TRACKED_F, total_error)
!/* Create file */
!/* (with creation order tracking for the root group) */
CALL h5fcreate_f(FileName, H5F_ACC_TRUNC_F, file_id, error, fcpl_id, fapl_id)
CALL check("h5fcreate_f",error,total_error)
!/* Create a link creation property list with the UTF-8 character encoding */
CALL H5Pcreate_f(H5P_LINK_CREATE_F, lcpl_id, error)
CALL check("H5Pcreate_f",error, total_error)
CALL H5Pset_char_encoding_f(lcpl_id, H5T_CSET_UTF8_F, error)
CALL check("H5Pset_char_encoding_f",error, total_error)
!/* Create a group with that lcpl */
CALL H5Gcreate_f(file_id, "group", group_id, error,lcpl_id=lcpl_id, gcpl_id=H5P_DEFAULT_F, gapl_id=H5P_DEFAULT_F)
CALL check("H5Gcreate_f", error, total_error)
CALL H5Gclose_f(group_id, error)
CALL check("H5Gclose_f", error, total_error)
! /* Get the group's link's information */
CALL H5Lget_info_f(file_id, "group", &
cset, corder, f_corder_valid, link_type, address, val_size, &
error, H5P_DEFAULT_F)
CALL check("H5Lget_info_f",error,total_error)
! if(H5Oget_info_by_name(file_id, "group", &oinfo, H5P_DEFAULT) < 0) TEST_ERROR
old_cset = cset
CALL VERIFY("H5Lget_info_f",old_cset,H5T_CSET_UTF8_F,total_error)
CALL VerifyLogical("H5Lget_info_f",f_corder_valid,.TRUE.,total_error)
old_corder = corder;
CALL VERIFY("H5Lget_info_f",old_corder,0,total_error)
! old_modification_time = oinfo.mtime;
! /* If this test happens too quickly, the times will all be the same. Make sure the time changes. */
! curr_time = HDtime(NULL);
! while(HDtime(NULL) <= curr_time)
! ;
! /* Close the file and reopen it */
CALL H5Fclose_f(file_id, error)
CALL check("H5Fclose_f", error, total_error)
!!$ if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) TEST_ERROR
!!$
!!$ /* Get the link's character set & modification time . They should be unchanged */
!!$ if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(H5Oget_info_by_name(file_id, "group", &oinfo, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(old_modification_time != oinfo.mtime) TEST_ERROR
!!$ if(old_cset != linfo.cset) TEST_ERROR
!!$ if(linfo.corder_valid != TRUE) TEST_ERROR
!!$ if(old_corder != linfo.corder) TEST_ERROR
!!$
!!$ /* Create a new link to the group. It should have a different creation order value but the same modification time */
!!$ if(H5Lcreate_hard(file_id, "group", file_id, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(H5Oget_info_by_name(file_id, "group2", &oinfo, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(old_modification_time != oinfo.mtime) TEST_ERROR
!!$ if(H5Lget_info(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(old_corder == linfo.corder) TEST_ERROR
!!$ if(linfo.corder_valid != TRUE) TEST_ERROR
!!$ if(linfo.corder != 1) TEST_ERROR
!!$ if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR
!!$
!!$ /* Copy the first link to a UTF-8 name.
!!$ * Its creation order value should be different, but modification time
!!$ * should not change.
!!$ */
!!$ if(H5Lcopy(file_id, "group", file_id, "group_copied", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(H5Oget_info_by_name(file_id, "group_copied", &oinfo, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(old_modification_time != oinfo.mtime) TEST_ERROR
!!$ if(H5Lget_info(file_id, "group_copied", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(linfo.corder_valid != TRUE) TEST_ERROR
!!$ if(linfo.corder != 2) TEST_ERROR
!!$
!!$ /* Check that its character encoding is UTF-8 */
!!$ if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
!!$
!!$ /* Move the link with the default property list. */
!!$ if(H5Lmove(file_id, "group_copied", file_id, "group_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(H5Oget_info_by_name(file_id, "group_copied2", &oinfo, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(old_modification_time != oinfo.mtime) TEST_ERROR
!!$ if(H5Lget_info(file_id, "group_copied2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(linfo.corder_valid != TRUE) TEST_ERROR
!!$ if(linfo.corder != 3) TEST_ERROR
!!$
!!$ /* Check that its character encoding is not UTF-8 */
!!$ if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR
!!$
!!$ /* Check that the original link is unchanged */
!!$ if(H5Oget_info_by_name(file_id, "group", &oinfo, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(old_modification_time != oinfo.mtime) TEST_ERROR
!!$ if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(linfo.corder_valid != TRUE) TEST_ERROR
!!$ if(old_corder != linfo.corder) TEST_ERROR
!!$ if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
!!$
!!$ /* Move the first link to a UTF-8 name.
!!$ * Its creation order value will change, but modification time should not
!!$ * change. */
!!$ if(H5Lmove(file_id, "group", file_id, "group_moved", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(H5Oget_info_by_name(file_id, "group_moved", &oinfo, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(old_modification_time != oinfo.mtime) TEST_ERROR
!!$ if(H5Lget_info(file_id, "group_moved", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(linfo.corder_valid != TRUE) TEST_ERROR
!!$ if(linfo.corder != 4) TEST_ERROR
!!$
!!$ /* Check that its character encoding is UTF-8 */
!!$ if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
!!$
!!$ /* Move the link again using the default property list. */
!!$ if(H5Lmove(file_id, "group_moved", file_id, "group_moved_again", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(H5Oget_info_by_name(file_id, "group_moved_again", &oinfo, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(old_modification_time != oinfo.mtime) TEST_ERROR
!!$ if(H5Lget_info(file_id, "group_moved_again", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(linfo.corder_valid != TRUE) TEST_ERROR
!!$ if(linfo.corder != 5) TEST_ERROR
!!$
!!$ /* Check that its character encoding is not UTF-8 */
!!$ if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR
! /* Close open IDs */
CALL H5Pclose_f(fcpl_id, error)
CALL check("H5Pclose_f", error, total_error)
CALL H5Pclose_f(lcpl_id, error)
CALL check("H5Pclose_f", error, total_error)
! if(H5Fclose(file_id) < 0) TEST_ERROR
END SUBROUTINE test_move_preserves
!!$!/*-------------------------------------------------------------------------
!!$! * Function: ud_hard_links
!!$! *
!!$! * Purpose: Check that the functionality of hard links can be duplicated
!!$! * with user-defined links.
!!$! *
!!$! *
!!$! * Programmer: M.S. Breitenfeld
!!$! * February, 2008
!!$! *
!!$! *-------------------------------------------------------------------------
!!$! */
!!$!
!!$!/* Callback functions for UD hard links. */
!!$!/* UD_hard_create increments the object's reference count */
!!$
!!$ SUBROUTINE ud_hard_links(fapl, total_error)
!!$
!!$ USE HDF5 ! This module contains all necessary modules
!!$
!!$ IMPLICIT NONE
!!$ INTEGER, INTENT(OUT) :: total_error
!!$ INTEGER(HID_T), INTENT(IN) :: fapl
!!$
!!$ INTEGER(HID_T) :: fid ! /* File ID */
!!$ INTEGER(HID_T) :: gid ! /* Group IDs */
!!$
!!$ CHARACTER(LEN=10) :: objname = 'objname.h5' ! /* Object name */
!!$ CHARACTER(LEN=10), PARAMETER :: filename = 'filname.h5'
!!$
!!$ INTEGER(HSIZE_T) :: name_len ! /* Size of an empty file */
!!$
!!$ INTEGER, PARAMETER :: UD_HARD_TYPE=201
!!$ LOGICAL :: registered
!!$
!!$!/* Link information */
!!$
!!$! ssize_t name_len; /* Length of object name */
!!$! h5_stat_size_t empty_size; /* Size of an empty file */
!!$
!!$
!!$ WRITE(*,*) "user-defined hard link (w/new group format)"
!!$
!!$ ! /* Set up filename and create file*/
!!$
!!$ CALL h5fcreate_f(FileName, H5F_ACC_TRUNC_F, fid, error, H5P_DEFAULT_F, fapl)
!!$ CALL check("h5fcreate_f",error,total_error)
!!$
!!$ ! /* Close file */
!!$ CALL h5fclose_f(fid, error)
!!$ CALL check("h5fclose_f",error,total_error)
!!$
!!$ ! if((empty_size = h5_get_file_size(filename))<0) TEST_ERROR
!!$
!!$ ! /* Create file */
!!$ CALL h5fcreate_f(FileName, H5F_ACC_TRUNC_F, fid, error, H5P_DEFAULT_F, fapl)
!!$ CALL check("h5fcreate_f",error,total_error)
!!$
!!$ ! /* Check that external links are registered and UD hard links are not */
!!$
!!$ CALL H5Lis_registered(H5L_TYPE_EXTERNAL, registered, error)
!!$ CALL VerifyLogical("H5Lis_registered", registered, .TRUE., total_error)
!!$
!!$ CALL H5Lis_registered(UD_HARD_TYPE, registered, error)
!!$ CALL VerifyLogical("H5Lis_registered", registered, .FALSE., total_error)
!!$
!!$ !/* Register "user-defined hard links" with the library */
!!$! if(H5Lregister(UD_hard_class) < 0) TEST_ERROR
!!$
!!$ /* Check that UD hard links are now registered */
!!$ if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR
!!$ if(H5Lis_registered(UD_HARD_TYPE) != TRUE) TEST_ERROR
!!$
!!$ /* Create a group for the UD hard link to point to */
!!$ if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
!!$
!!$ /* Get address for the group to give to the hard link */
!!$ if(H5Lget_info(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR
!!$
!!$ if(H5Gclose(gid) < 0) TEST_ERROR
!!$
!!$
!!$ /* Create a user-defined "hard link" to the group using the address we got
!!$ * from H5Lget_info */
!!$ if(H5Lcreate_ud(fid, "ud_link", UD_HARD_TYPE, &(li.u.address), sizeof(haddr_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
!!$
!!$ /* Close and re-open file to ensure that data is written to disk */
!!$ if(H5Fclose(fid) < 0) TEST_ERROR
!!$ if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR
!!$
!!$ /* Open group through UD link */
!!$ if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
!!$
!!$ /* Check name */
!!$ if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR
!!$ if(HDstrcmp(objname, "/group")) TEST_ERROR
!!$
!!$ /* Create object in group */
!!$ if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
!!$
!!$ /* Close groups*/
!!$ if(H5Gclose(gid2) < 0) TEST_ERROR
!!$ if(H5Gclose(gid) < 0) TEST_ERROR
!!$
!!$ /* Re-open group without using ud link to check that it was created properly */
!!$ if((gid = H5Gopen2(fid, "group/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
!!$
!!$ /* Check name */
!!$ if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR
!!$ if(HDstrcmp(objname, "/group/new_group")) TEST_ERROR
!!$
!!$ /* Close opened object */
!!$ if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
!!$
!!$ /* Check that H5Lget_objinfo works on the hard link */
!!$ if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
!!$ /* UD hard links have no query function, thus return a "link length" of 0 */
!!$ if(li.u.val_size != 0) TEST_ERROR
!!$ if(UD_HARD_TYPE != li.type) {
!!$ H5_FAILED();
!!$ puts(" Unexpected link class - should have been a UD hard link");
!!$ goto error;
!!$ } /* end if */
!!$
!!$ /* Unlink the group pointed to by the UD link. It shouldn't be
!!$ * deleted because of the UD link. */
!!$ if(H5Ldelete(fid, "/group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
!!$
!!$ /* Ensure we can open the group through the UD link */
!!$ if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
!!$
!!$ /* Unlink the group contained within it. */
!!$ if(H5Ldelete(gid, "new_group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
!!$ if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
!!$
!!$ /* Now delete the UD link. This should cause the group to be
!!$ * deleted, too. */
!!$ if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
!!$
!!$ /* Close file */
!!$ if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
!!$
!!$ /* The file should be empty again. */
!!$ if(empty_size != h5_get_file_size(filename)) TEST_ERROR
!!$
!!$ if(H5Lunregister(UD_HARD_TYPE) < 0) FAIL_STACK_ERROR
!!$
!!$ PASSED();
!!$ return 0;
!!$
!!$ error:
!!$ H5E_BEGIN_TRY {
!!$ H5Gclose(gid2);
!!$ H5Gclose(gid);
!!$ H5Fclose(fid);
!!$ } H5E_END_TRY;
!!$ return -1;
!!$} /* end ud_hard_links() */
!/*-------------------------------------------------------------------------
! * Function: lifecycle
! *
! * Purpose: Test that adding links to a group follow proper "lifecycle"
! * of empty->compact->symbol table->compact->empty. (As group
! * is created, links are added, then links removed)
! *
! * Return: Success: 0
! *
! * Failure: -1
! *
! * Programmer: Quincey Koziol
! * Monday, October 17, 2005
! *
! *-------------------------------------------------------------------------
! */
SUBROUTINE lifecycle(cleanup, fapl2, total_error)
USE HDF5 ! This module contains all necessary modules
IMPLICIT NONE
INTEGER, INTENT(OUT) :: total_error
INTEGER(HID_T), INTENT(IN) :: fapl2
INTEGER :: error
INTEGER, PARAMETER :: NAME_BUF_SIZE =7
INTEGER(HID_T) :: fid !/* File ID */
INTEGER(HID_T) :: gid !/* Group ID */
INTEGER(HID_T) :: gid2 !/* Datatype ID */
INTEGER(HID_T) :: gcpl !/* Group creation property list ID */
INTEGER(size_t) :: lheap_size_hint !/* Local heap size hint */
INTEGER :: max_compact !/* Maximum # of links to store in group compactly */
INTEGER :: min_dense !/* Minimum # of links to store in group "densely" */
INTEGER :: est_num_entries !/* Estimated # of entries in group */
INTEGER :: est_name_len !/* Estimated length of entry name */
INTEGER :: nmsgs !/* Number of messages in group's header */
CHARACTER(LEN=NAME_BUF_SIZE) :: objname ! /* Object name */
CHARACTER(LEN=NAME_BUF_SIZE) :: filename = 'fixx.h5'
INTEGER :: empty_size ! /* Size of an empty file */
INTEGER :: u ! /* Local index variable */
INTEGER(SIZE_T) :: LIFECYCLE_LOCAL_HEAP_SIZE_HINT = 256
INTEGER :: LIFECYCLE_MAX_COMPACT = 4
INTEGER :: LIFECYCLE_MIN_DENSE = 3
INTEGER :: LIFECYCLE_EST_NUM_ENTRIES = 4
INTEGER :: LIFECYCLE_EST_NAME_LEN=8
CHARACTER(LEN=3) :: LIFECYCLE_TOP_GROUP="top"
! These value are taken from H5Gprivate.h
INTEGER :: H5G_CRT_GINFO_MAX_COMPACT = 8
INTEGER :: H5G_CRT_GINFO_MIN_DENSE = 6
INTEGER :: H5G_CRT_GINFO_EST_NUM_ENTRIES = 4
INTEGER :: H5G_CRT_GINFO_EST_NAME_LEN = 8
logical :: cleanup
WRITE(*,*) 'group lifecycle'
! /* Create file */
CALL H5Fcreate_f(filename, H5F_ACC_TRUNC_F, fid, error, access_prp=fapl2)
CALL check("H5Fcreate_f",error,total_error)
!/* Close file */
CALL H5Fclose_f(fid,error)
CALL check("H5Fclose_f",error,total_error)
! /* Get size of file as empty */
! if((empty_size = h5_get_file_size(filename)) < 0) TEST_ERROR
! /* Re-open file */
CALL H5Fopen_f(filename, H5F_ACC_RDWR_F, fid, error,access_prp=fapl2)
CALL check("H5Fopen_f",error,total_error)
! /* Set up group creation property list */
CALL H5Pcreate_f(H5P_GROUP_CREATE_F,gcpl,error)
CALL check("H5Pcreate_f",error,total_error)
! /* Query default group creation property settings */
CALL H5Pget_local_heap_size_hint_f(gcpl, lheap_size_hint, error)
CALL check("H5Pget_local_heap_size_hint_f",error,total_error)
CALL verify("H5Pget_local_heap_size_hint_f", lheap_size_hint,0,total_error)
CALL H5Pget_link_phase_change_f(gcpl, max_compact, min_dense, error)
CALL check("H5Pget_link_phase_change_f", error, total_error)
CALL verify("H5Pget_link_phase_change_f", max_compact, H5G_CRT_GINFO_MAX_COMPACT,total_error)
CALL verify("H5Pget_link_phase_change_f", min_dense, H5G_CRT_GINFO_MIN_DENSE,total_error)
CALL H5Pget_est_link_info_f(gcpl, est_num_entries, est_name_len, error)
CALL check("H5Pget_est_link_info_f", error, total_error)
CALL verify("H5Pget_est_link_info_f", est_num_entries, H5G_CRT_GINFO_EST_NUM_ENTRIES,total_error)
CALL verify("H5Pget_est_link_info_f", est_name_len, H5G_CRT_GINFO_EST_NAME_LEN,total_error)
!/* Set GCPL parameters */
CALL H5Pset_local_heap_size_hint_f(gcpl, LIFECYCLE_LOCAL_HEAP_SIZE_HINT, error)
CALL check("H5Pset_local_heap_size_hint_f", error, total_error)
CALL H5Pset_link_phase_change_f(gcpl, LIFECYCLE_MAX_COMPACT, LIFECYCLE_MIN_DENSE, error)
CALL check("H5Pset_link_phase_change_f", error, total_error)
CALL H5Pset_est_link_info_f(gcpl, LIFECYCLE_EST_NUM_ENTRIES, LIFECYCLE_EST_NAME_LEN, error)
CALL check("H5Pset_est_link_info_f", error, total_error)
! /* Create group for testing lifecycle */
CALL H5Gcreate_f(fid, LIFECYCLE_TOP_GROUP, gid, error, gcpl_id=gcpl)
CALL check("H5Gcreate_f", error, total_error)
! /* Query group creation property settings */
CALL H5Pget_local_heap_size_hint_f(gcpl, lheap_size_hint, error)
CALL check("H5Pget_local_heap_size_hint_f",error,total_error)
CALL verify("H5Pget_local_heap_size_hint_f", lheap_size_hint,LIFECYCLE_LOCAL_HEAP_SIZE_HINT,total_error)
CALL H5Pget_link_phase_change_f(gcpl, max_compact, min_dense, error)
CALL check("H5Pget_link_phase_change_f", error, total_error)
CALL verify("H5Pget_link_phase_change_f", max_compact, LIFECYCLE_MAX_COMPACT,total_error)
CALL verify("H5Pget_link_phase_change_f", min_dense, LIFECYCLE_MIN_DENSE,total_error)
CALL H5Pget_est_link_info_f(gcpl, est_num_entries, est_name_len, error)
CALL check("H5Pget_est_link_info_f", error, total_error)
CALL verify("H5Pget_est_link_info_f", est_num_entries, LIFECYCLE_EST_NUM_ENTRIES,total_error)
CALL verify("H5Pget_est_link_info_f", est_name_len, LIFECYCLE_EST_NAME_LEN,total_error)
! /* Use internal testing routine to check that the group has no links or symbol table */
! if(H5G_is_empty_test(gid) != TRUE) TEST_ERROR
!!$ /* Create first "bottom" group */
!!$ sprintf(objname, LIFECYCLE_BOTTOM_GROUP, (unsigned)0);
!!$ IF((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
!!$
!!$ /* Check on bottom group's status */
!!$ if(H5G_is_empty_test(gid2) != TRUE) TEST_ERROR
!!$
!!$ /* Close bottom group */
!!$ if(H5Gclose(gid2) < 0) TEST_ERROR
!!$
!!$ /* Check on top group's status */
!!$ if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR
!!$ if(H5G_has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR
!!$ if(nmsgs != 1) TEST_ERROR
!!$
!!$ /* Create several more bottom groups, to push the top group almost to a symbol table */
!!$ /* (Start counting at '1', since we've already created one bottom group */
!!$ for(u = 1; u < LIFECYCLE_MAX_COMPACT; u++) {
!!$ sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u);
!!$ if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
!!$
!!$ /* Check on bottom group's status */
!!$ if(H5G_is_empty_test(gid2) != TRUE) TEST_ERROR
!!$
!!$ /* Close bottom group */
!!$ if(H5Gclose(gid2) < 0) TEST_ERROR
!!$ } /* end for */
!!$
!!$ /* Check on top group's status */
!!$ if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR
!!$ if(H5G_has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR
!!$ if(nmsgs != LIFECYCLE_MAX_COMPACT) TEST_ERROR
!!$ if(H5G_is_new_dense_test(gid) != FALSE) TEST_ERROR
!!$
!!$ /* Check that the object header is only one chunk and the space has been allocated correctly */
!!$ if(H5Oget_info(gid, &oinfo) < 0) TEST_ERROR
!!$ if(oinfo.hdr.space.total != 151) TEST_ERROR
!!$ if(oinfo.hdr.space.free != 0) TEST_ERROR
!!$ if(oinfo.hdr.nmesgs != 6) TEST_ERROR
!!$ if(oinfo.hdr.nchunks != 1) TEST_ERROR
!!$
!!$ /* Create one more "bottom" group, which should push top group into using a symbol table */
!!$ sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u);
!!$ if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
!!$
!!$ /* Check on bottom group's status */
!!$ if(H5G_is_empty_test(gid2) != TRUE) TEST_ERROR
!!$
!!$ /* Close bottom group */
!!$ if(H5Gclose(gid2) < 0) TEST_ERROR
!!$
!!$ /* Check on top group's status */
!!$ if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR
!!$ if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR
!!$ if(H5G_is_new_dense_test(gid) != TRUE) TEST_ERROR
!!$
!!$ /* Check that the object header is still one chunk and the space has been allocated correctly */
!!$ if(H5Oget_info(gid, &oinfo) < 0) TEST_ERROR
!!$ if(oinfo.hdr.space.total != 151) TEST_ERROR
!!$ if(oinfo.hdr.space.free != 92) TEST_ERROR
!!$ if(oinfo.hdr.nmesgs != 3) TEST_ERROR
!!$ if(oinfo.hdr.nchunks != 1) TEST_ERROR
!!$
!!$ /* Unlink objects from top group */
!!$ while(u >= LIFECYCLE_MIN_DENSE) {
!!$ sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u);
!!$
!!$ if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
!!$
!!$ u--;
!!$ } /* end while */
!!$
!!$ /* Check on top group's status */
!!$ if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR
!!$ if(H5G_has_links_test(gid, NULL) == TRUE) TEST_ERROR
!!$ if(H5G_is_new_dense_test(gid) != TRUE) TEST_ERROR
!!$
!!$ /* Unlink one more object from the group, which should transform back to using links */
!!$ sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u);
!!$ if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
!!$ u--;
!!$
!!$ /* Check on top group's status */
!!$ if(H5G_is_empty_test(gid) == TRUE) TEST_ERROR
!!$ if(H5G_has_links_test(gid, &nmsgs) != TRUE) TEST_ERROR
!!$ if(nmsgs != (LIFECYCLE_MIN_DENSE - 1)) TEST_ERROR
!!$
!!$ /* Unlink last two objects from top group */
!!$ sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u);
!!$ if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
!!$ u--;
!!$ sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u);
!!$ if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
!!$
!!$ /* Check on top group's status */
!!$ if(H5G_is_empty_test(gid) != TRUE) TEST_ERROR
!/* Close top group */
CALL H5Gclose_f(gid, error)
CALL check("H5Gclose_f", error, total_error)
!/* Unlink top group */
CALL H5Ldelete_f(fid, LIFECYCLE_TOP_GROUP, error)
CALL check("H5Ldelete_f", error, total_error)
! /* Close GCPL */
CALL H5Pclose_f(gcpl, error)
CALL check("H5Pclose_f", error, total_error)
! /* Close file */
CALL H5Fclose_f(fid,error)
CALL check("H5Fclose_f",error,total_error)
!!$ /* Get size of file as empty */
!!$ if((file_size = h5_get_file_size(filename)) < 0) TEST_ERROR
!!$
!!$ /* Verify that file is correct size */
!!$ if(file_size != empty_size) TEST_ERROR
IF(cleanup) CALL h5_cleanup_f("fixx", H5P_DEFAULT_F, error)
CALL check("h5_cleanup_f", error, total_error)
END SUBROUTINE lifecycle
!/*-------------------------------------------------------------------------
! * Function: cklinks
! *
! * Purpose: Open the file created in the first step and check that the
! * links look correct.
! *
! * Return: Success: 0
! *
! * Failure: -1
! *
! * Programmer: M.S. Breitenfeld
! * April 14, 2008
! *
! * Modifications: Modified Original C code
! *
! *-------------------------------------------------------------------------
! */
SUBROUTINE cklinks(fapl, total_error)
! USE ISO_C_BINDING
USE HDF5 ! This module contains all necessary modules
IMPLICIT NONE
INTEGER, INTENT(OUT) :: total_error
INTEGER(HID_T), INTENT(IN) :: fapl
INTEGER :: error
INTEGER(HID_T) :: file
! H5O_info_t oinfo1, oinfo2;
! H5L_info_t linfo2;
CHARACTER(LEN=12), PARAMETER :: filename ='TestLinks.h5'
CHARACTER(LEN=12) :: linkval
! TYPE(C_PTR) :: linkval
LOGICAL :: Lexists
!!$ if(new_format)
!!$ TESTING("link queries (w/new group format)")
!!$ else
!!$ TESTING("link queries")
! /* Open the file */
CALL H5Fopen_f(filename, H5F_ACC_RDONLY_F, file, error,access_prp=fapl)
CALL check("H5Fopen_f",error,total_error)
! /* Hard link */
!!$ IF(H5Oget_info_by_name(file, "d1", &oinfo1, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
!!$ IF(H5Oget_info_by_name(file, "grp1/hard", &oinfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
!!$ IF(H5O_TYPE_DATASET != oinfo2.type) {
!!$ H5_FAILED();
!!$ printf(" %d: Unexpected object type should have been a dataset\n", __LINE__);
!!$ TEST_ERROR
!!$ } /* end if */
!!$ if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) {
!!$ H5_FAILED();
!!$ puts(" Hard link test failed. Link seems not to point to the ");
!!$ puts(" expected file location.");
!!$ TEST_ERROR
!!$ } /* end if */
CALL H5Lexists_f(file,"d1",Lexists, error)
CALL verifylogical("test_lcpl.H5Lexists", Lexists,.TRUE.,total_error)
CALL H5Lexists_f(file,"grp1/hard",Lexists, error)
CALL verifylogical("test_lcpl.H5Lexists", Lexists,.TRUE.,total_error)
!!$ /* Symbolic link */
!!$ if(H5Oget_info_by_name(file, "grp1/soft", &oinfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
!!$ if(H5O_TYPE_DATASET != oinfo2.type) {
!!$ H5_FAILED();
!!$ printf(" %d: Unexpected object type should have been a dataset\n", __LINE__);
!!$ TEST_ERROR
!!$ } /* end if */
!!$ if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) {
!!$ H5_FAILED();
!!$ puts(" Soft link test failed. Link seems not to point to the ");
!!$ puts(" expected file location.");
!!$ TEST_ERROR
!!$ } /* end if */
! CALL H5Lget_val(file, "grp1/soft", INT(LEN(linkval), SIZE_T), linkval, error)
!!$ if(H5Lget_val(file, "grp1/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
!!$ if(HDstrcmp(linkval, "/d1")) {
!!$ H5_FAILED();
!!$ puts(" Soft link test failed. Wrong link value");
!!$ TEST_ERROR
!!$ } /* end if */
!!$ if(H5Lexists(file, "grp1/soft", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
!!$
!!$ /* Dangling link */
!!$ H5E_BEGIN_TRY {
!!$ status = H5Oget_info_by_name(file, "grp1/dangle", &oinfo2, H5P_DEFAULT);
!!$ } H5E_END_TRY;
!!$ if(status >= 0) {
!!$ H5_FAILED();
!!$ puts(" H5Oget_info_by_name() should have failed for a dangling link.");
!!$ TEST_ERROR
!!$ } /* end if */
!!$ if(H5Lget_info(file, "grp1/dangle", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
!!$ if(H5L_TYPE_SOFT != linfo2.type) {
!!$ H5_FAILED();
!!$ printf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__);
!!$ TEST_ERROR
!!$ } /* end if */
!!$ if(H5Lget_val(file, "grp1/dangle", linkval, sizeof linkval, H5P_DEFAULT) < 0) {
!!$ H5_FAILED();
!!$ printf(" %d: Can't retrieve link value\n", __LINE__);
!!$ TEST_ERROR
!!$ } /* end if */
!!$ if(HDstrcmp(linkval, "foobar")) {
!!$ H5_FAILED();
!!$ puts(" Dangling link test failed. Wrong link value");
!!$ TEST_ERROR
!!$ } /* end if */
!!$ if(H5Lexists(file, "grp1/dangle", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
!!$
!!$ /* Recursive link */
!!$ H5E_BEGIN_TRY {
!!$ status = H5Oget_info_by_name(file, "grp1/recursive", &oinfo2, H5P_DEFAULT);
!!$ } H5E_END_TRY;
!!$ if(status >= 0) {
!!$ H5_FAILED();
!!$ puts(" H5Oget_info_by_name() should have failed for a recursive link.");
!!$ TEST_ERROR
!!$ } /* end if */
!!$ if(H5Lget_info(file, "grp1/recursive", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
!!$ if(H5L_TYPE_SOFT != linfo2.type) {
!!$ H5_FAILED();
!!$ printf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__);
!!$ TEST_ERROR
!!$ } /* end if */
!!$ if(H5Lget_val(file, "grp1/recursive", linkval, sizeof linkval, H5P_DEFAULT) < 0) {
!!$ H5_FAILED();
!!$ printf(" %d: Can't retrieve link value\n", __LINE__);
!!$ TEST_ERROR
!!$ } /* end if */
!!$ if(HDstrcmp(linkval, "/grp1/recursive")) {
!!$ H5_FAILED();
!!$ puts(" Recursive link test failed. Wrong link value");
!!$ TEST_ERROR
!!$ } /* end if */
!!$
!!$ /* Non-existant link */
!!$ if(H5Lexists(file, "foobar", H5P_DEFAULT) == TRUE) FAIL_STACK_ERROR
! /* Cleanup */
CALL H5Fclose_f(file,error)
CALL check("H5Fclose_f",error,total_error)
END SUBROUTINE cklinks
!/*-------------------------------------------------------------------------
! * Function: delete_by_idx
! *
! * Purpose: Create a group with creation order indices and test deleting
! * links by index.
! *
! * Return: Total error
! *
! * C Programmer: Quincey Koziol
! * Tuesday, November 14, 2006
! *
! * Adapted to FORTRAN: M.S. Breitenfeld
! * March 3, 2008
! *
! *-------------------------------------------------------------------------
! */
SUBROUTINE delete_by_idx(cleanup, fapl, total_error)
USE HDF5 ! This module contains all necessary modules
IMPLICIT NONE
INTEGER, INTENT(OUT) :: total_error
INTEGER(HID_T), INTENT(IN) :: fapl
INTEGER(HID_T) :: file_id ! /* File ID */
INTEGER(HID_T) :: group_id ! /* Group ID */
INTEGER(HID_T) :: gcpl_id ! /* Group creation property list ID */
INTEGER :: idx_type ! /* Type of index to operate on */
LOGICAL, DIMENSION(1:2) :: use_index = (/.FALSE.,.TRUE./)
! /* Use index on creation order values */
INTEGER :: max_compact ! /* Maximum # of links to store in group compactly */
INTEGER :: min_dense ! /* Minimum # of links to store in group "densely" */
CHARACTER(LEN=7) :: objname ! /* Object name */
CHARACTER(LEN=8) :: filename = 'file0.h5' ! /* File name */
CHARACTER(LEN=7) :: tmpname ! /* Temporary link name */
CHARACTER(LEN=12), PARAMETER :: CORDER_GROUP_NAME = "corder_group"
LOGICAL :: f_corder_valid ! Indicates whether the creation order data is valid for this attribute
INTEGER :: corder ! Is a positive integer containing the creation order of the attribute
INTEGER :: cset ! Indicates the character set used for the attribute’s name
INTEGER(HSIZE_T) :: data_size ! Indicates the size, in the number of characters, of the attribute
INTEGER :: u ! /* Local index variable */
INTEGER :: Input1, i
INTEGER(HID_T) :: group_id2
INTEGER :: iorder ! /* Order within in the index */
CHARACTER(LEN=2) :: chr2
INTEGER :: error
!
!
!
CHARACTER(LEN=6) :: filename1
CHARACTER(LEN=6) :: filename2
CHARACTER(LEN=80) :: fix_filename1
CHARACTER(LEN=80) :: fix_filename2
INTEGER(SIZE_T) :: size_tmp
LOGICAL :: cleanup
DO i = 1, 80
fix_filename1(i:i) = " "
fix_filename2(i:i) = " "
ENDDO
! /* Loop over operating on different indices on link fields */
DO idx_type = H5_INDEX_NAME_F, H5_INDEX_CRT_ORDER_F
! /* Loop over operating in different orders */
DO iorder = H5_ITER_INC_F, H5_ITER_DEC_F
! /* Loop over using index for creation order value */
DO i = 1, 2
! /* Print appropriate test message */
IF(idx_type == H5_INDEX_CRT_ORDER_F)THEN
IF(iorder == H5_ITER_INC_F)THEN
IF(use_index(i))THEN
WRITE(*,'(5x,A)')"deleting links by creation order index in increasing order w/creation order index"
ELSE
WRITE(*,'(5x,A)')"deleting links by creation order index in increasing order w/o creation order index"
ENDIF
ELSE
IF(use_index(i))THEN
WRITE(*,'(5x,A)')"deleting links by creation order index in decreasing order w/creation order index"
ELSE
WRITE(*,'(5x,A)')"deleting links by creation order index in decreasing order w/o creation order index"
ENDIF
ENDIF
ELSE
IF(iorder == H5_ITER_INC_F)THEN
IF(use_index(i))THEN
WRITE(*,'(5x,A)')"deleting links by name index in increasing order w/creation order index"
ELSE
WRITE(*,'(5x,A)')"deleting links by name index in increasing order w/o creation order index"
ENDIF
ELSE
IF(use_index(i))THEN
WRITE(*,'(5x,A)')"deleting links by name index in decreasing order w/creation order index"
ELSE
WRITE(*,'(5x,A)')"deleting links by name index in decreasing order w/o creation order index"
ENDIF
ENDIF
ENDIF
! CALL h5_fixname_f(filename1, fix_filename1, H5P_DEFAULT_F, error)
! IF(error .NE. 0) STOP
! /* Create file */
CALL H5Fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error, access_prp=fapl)
CALL check("delete_by_idx.H5Fcreate_f", error, total_error)
! /* Create group creation property list */
CALL H5Pcreate_f(H5P_GROUP_CREATE_F, gcpl_id, error )
CALL check("delete_by_idx.H5Pcreate_f", error, total_error)
! /* Set creation order tracking & indexing on group */
IF(use_index(i))THEN
Input1 = H5P_CRT_ORDER_INDEXED_F
ELSE
Input1 = 0
ENDIF
CALL H5Pset_link_creation_order_f(gcpl_id, IOR(H5P_CRT_ORDER_TRACKED_F, Input1), error)
CALL check("delete_by_idx.H5Pset_link_creation_order_f", error, total_error)
! /* Create group with creation order tracking on */
CALL H5Gcreate_f(file_id, CORDER_GROUP_NAME, group_id, error, gcpl_id=gcpl_id)
CALL check("delete_by_idx.H5Gcreate_f", error, total_error)
! /* Query the group creation properties */
CALL H5Pget_link_phase_change_f(gcpl_id, max_compact, min_dense, error)
CALL check("delete_by_idx.H5Pget_link_phase_change_f", error, total_error)
! /* Delete links from one end */
! /* Check for deletion on empty group */
CALL H5Ldelete_by_idx_f(group_id, ".", idx_type, iorder, INT(0,HSIZE_T), error)
CALL VERIFY("delete_by_idx.H5Ldelete_by_idx_f", error, -1, total_error) ! test should fail (error = -1)
! /* Create several links, up to limit of compact form */
DO u = 0, max_compact-1
! /* Make name for link */
WRITE(chr2,'(I2.2)') u
objname = 'fill '//chr2
! /* Create hard link, with group object */
CALL H5Gcreate_f(group_id, objname, group_id2, error)
CALL check("delete_by_idx.H5Gcreate_f", error, total_error)
CALL H5Gclose_f(group_id2, error)
CALL check("delete_by_idx.H5Gclose_f", error, total_error)
! /* Verify link information for new link */
CALL link_info_by_idx_check(group_id, objname, u, &
.TRUE., use_index, total_error)
ENDDO
! /* Verify state of group (compact) */
! IF(H5G_has_links_test(group_id, NULL) != TRUE) TEST_ERROR
! /* Check for out of bound deletion */
CALL H5Ldelete_by_idx_f(group_id, ".", idx_type, iorder, INT(u,HSIZE_T), error)
CALL VERIFY("delete_by_idx.H5Ldelete_by_idx_f", error, -1, total_error) ! test should fail (error = -1)
! /* Delete links from compact group */
DO u = 0, (max_compact - 1) -1
! /* Delete first link in appropriate order */
CALL H5Ldelete_by_idx_f(group_id, ".", idx_type, iorder, INT(0,HSIZE_T), error)
CALL check("delete_by_idx.H5Ldelete_by_idx_f", error, total_error)
! /* Verify the link information for first link in appropriate order */
! HDmemset(&linfo, 0, sizeof(linfo));
CALL H5Lget_info_by_idx_f(group_id, ".", idx_type, iorder, INT(0,HSIZE_T), &
f_corder_valid, corder, cset, data_size, error)
IF(iorder.EQ.H5_ITER_INC_F)THEN
CALL VERIFY("delete_by_idx.H5Lget_info_by_idx_f", corder, u+1, total_error)
ELSE
CALL VERIFY("delete_by_idx.H5Lget_info_by_idx_f", corder, (max_compact - (u + 2)), total_error)
ENDIF
! /* Verify the name for first link in appropriate order */
! HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
!!$ size_tmp = 20
!!$ CALL H5Lget_name_by_idx_f(group_id, ".", idx_type, order, INT(0,HSIZE_T), size_tmp, tmpname, error)
!!$ CALL check("delete_by_idx.H5Lget_name_by_idx_f", error, total_error)
!!$
!!$ IF(order .EQ. H5_ITER_INC_F)THEN
!!$ WRITE(chr2,'(I2.2)') u + 1
!!$ ELSE
!!$ WRITE(chr2,'(I2.2)') (max_compact - (u + 2))
!!$ ENDIF
!!$ objname = 'fill '//chr2
!!$ PRINT*,objname, tmpname
!!$ CALL verifyString("delete_by_idx.H5Lget_name_by_idx_f", objname, tmpname, total_error)
ENDDO
!!$
!!$ /* Delete last link */
!!$ if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
!!$
!!$ /* Verify state of group (empty) */
!!$ if(H5G_has_links_test(group_id, NULL) == TRUE) TEST_ERROR
!!$
!!$ /* Create more links, to push group into dense form */
!!$ for(u = 0; u < (max_compact * 2); u++) {
!!$ hid_t group_id2; /* Group ID */
!!$
!!$ /* Make name for link */
!!$ sprintf(objname, "filler %02u", u);
!!$
!!$ /* Create hard link, with group object */
!!$ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
!!$ if(H5Gclose(group_id2) < 0) TEST_ERROR
!!$
!!$ /* Verify state of group (dense) */
!!$ if(u >= max_compact)
!!$ if(H5G_is_new_dense_test(group_id) != TRUE) TEST_ERROR
!!$
!!$ /* Verify link information for new link */
!!$ if(link_info_by_idx_check(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR
!!$ } /* end for */
!!$
!!$ /* Check for out of bound deletion again */
!!$ H5E_BEGIN_TRY {
!!$ ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT);
!!$ } H5E_END_TRY;
!!$ if(ret >= 0) TEST_ERROR
!!$
!!$ /* Delete links from dense group, in appropriate order */
!!$ for(u = 0; u < ((max_compact * 2) - 1); u++) {
!!$ /* Delete first link in appropriate order */
!!$ if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
!!$
!!$ /* Verify the link information for first link in appropriate order */
!!$ HDmemset(&linfo, 0, sizeof(linfo));
!!$ if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(order == H5_ITER_INC) {
!!$ if(linfo.corder != (u + 1)) TEST_ERROR
!!$ } /* end if */
!!$ else {
!!$ if(linfo.corder != ((max_compact * 2) - (u + 2))) TEST_ERROR
!!$ } /* end else */
!!$
!!$ /* Verify the name for first link in appropriate order */
!!$ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
!!$ if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(order == H5_ITER_INC)
!!$ sprintf(objname, "filler %02u", (u + 1));
!!$ else
!!$ sprintf(objname, "filler %02u", ((max_compact * 2) - (u + 2)));
!!$ if(HDstrcmp(objname, tmpname)) TEST_ERROR
!!$ } /* end for */
!!$
!!$ /* Delete last link */
!!$ if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
!!$
!!$ /* Verify state of group (empty) */
!!$ if(H5G_has_links_test(group_id, NULL) == TRUE) TEST_ERROR
!!$ if(H5G_is_new_dense_test(group_id) == TRUE) TEST_ERROR
!!$
!!$ /* Check for deletion on empty group again */
!!$ H5E_BEGIN_TRY {
!!$ ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT);
!!$ } H5E_END_TRY;
!!$ if(ret >= 0) TEST_ERROR
!!$
!!$
!!$ /* Delete links in middle */
!!$
!!$
!!$ /* Create more links, to push group into dense form */
!!$ for(u = 0; u < (max_compact * 2); u++) {
!!$ hid_t group_id2; /* Group ID */
!!$
!!$ /* Make name for link */
!!$ sprintf(objname, "filler %02u", u);
!!$
!!$ /* Create hard link, with group object */
!!$ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
!!$ if(H5Gclose(group_id2) < 0) TEST_ERROR
!!$
!!$ /* Verify state of group (dense) */
!!$ if(u >= max_compact)
!!$ if(H5G_is_new_dense_test(group_id) != TRUE) TEST_ERROR
!!$
!!$ /* Verify link information for new link */
!!$ if(link_info_by_idx_check(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR
!!$ } /* end for */
!!$
!!$ /* Delete every other link from dense group, in appropriate order */
!!$ for(u = 0; u < max_compact; u++) {
!!$ /* Delete link */
!!$ if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT) < 0) TEST_ERROR
!!$
!!$ /* Verify the link information for current link in appropriate order */
!!$ HDmemset(&linfo, 0, sizeof(linfo));
!!$ if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(order == H5_ITER_INC) {
!!$ if(linfo.corder != ((u * 2) + 1)) TEST_ERROR
!!$ } /* end if */
!!$ else {
!!$ if(linfo.corder != ((max_compact * 2) - ((u * 2) + 2))) TEST_ERROR
!!$ } /* end else */
!!$
!!$ /* Verify the name for current link in appropriate order */
!!$ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
!!$ if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(order == H5_ITER_INC)
!!$ sprintf(objname, "filler %02u", ((u * 2) + 1));
!!$ else
!!$ sprintf(objname, "filler %02u", ((max_compact * 2) - ((u * 2) + 2)));
!!$ if(HDstrcmp(objname, tmpname)) TEST_ERROR
!!$ } /* end for */
!!$
!!$ /* Delete remaining links from dense group, in appropriate order */
!!$ for(u = 0; u < (max_compact - 1); u++) {
!!$ /* Delete link */
!!$ if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
!!$
!!$ /* Verify the link information for first link in appropriate order */
!!$ HDmemset(&linfo, 0, sizeof(linfo));
!!$ if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(order == H5_ITER_INC) {
!!$ if(linfo.corder != ((u * 2) + 3)) TEST_ERROR
!!$ } /* end if */
!!$ else {
!!$ if(linfo.corder != ((max_compact * 2) - ((u * 2) + 4))) TEST_ERROR
!!$ } /* end else */
!!$
!!$ /* Verify the name for first link in appropriate order */
!!$ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
!!$ if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(order == H5_ITER_INC)
!!$ sprintf(objname, "filler %02u", ((u * 2) + 3));
!!$ else
!!$ sprintf(objname, "filler %02u", ((max_compact * 2) - ((u * 2) + 4)));
!!$ if(HDstrcmp(objname, tmpname)) TEST_ERROR
!!$ } /* end for */
!!$
!!$ /* Delete last link */
!!$ if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
!!$
!!$ /* Verify state of group (empty) */
!!$ if(H5G_has_links_test(group_id, NULL) == TRUE) TEST_ERROR
!!$ if(H5G_is_new_dense_test(group_id) == TRUE) TEST_ERROR
!!$
!!$
!!$
! /* Close the group */
CALL H5Gclose_f(group_id, error)
CALL check("delete_by_idx.H5Gclose_f", error, total_error)
!/* Close the group creation property list */
CALL H5Pclose_f(gcpl_id, error)
CALL check("delete_by_idx.H5Gclose_f", error, total_error)
!/* Close the file */
CALL H5Fclose_f(file_id, error)
CALL check("delete_by_idx.H5Gclose_f", error, total_error)
IF(cleanup) CALL h5_cleanup_f("file0", H5P_DEFAULT_F, error)
CALL check("h5_cleanup_f", error, total_error)
ENDDO
ENDDO
ENDDO
!!$
!!$ return 0;
!!$
!!$error:
!!$ H5E_BEGIN_TRY {
!!$ H5Pclose(gcpl_id);
!!$ H5Gclose(group_id);
!!$ H5Fclose(file_id);
!!$ } H5E_END_TRY;
!!$ return -1;
!!$} /* end delete_by_idx() */
END SUBROUTINE delete_by_idx
!/*-------------------------------------------------------------------------
! * Function: link_info_by_idx_check
! *
! * Purpose: Support routine for link_info_by_idx, to verify the link
! * info is correct for a link
! *
! * Note: This routine assumes that the links have been inserted in the
! * group in alphabetical order.
! *
! * Return: Success: 0
! * Failure: -1
! *
! * Programmer: Quincey Koziol
! * Tuesday, November 7, 2006
! *
! *-------------------------------------------------------------------------
! */
SUBROUTINE link_info_by_idx_check(group_id, linkname, n, &
hard_link, use_index, total_error)
USE HDF5 ! This module contains all necessary modules
IMPLICIT NONE
INTEGER, INTENT(INOUT) :: total_error
INTEGER(HID_T), INTENT(IN) :: group_id
CHARACTER(LEN=*), INTENT(IN) :: linkname
INTEGER, INTENT(IN) :: n
LOGICAL, INTENT(IN) :: hard_link
LOGICAL, INTENT(IN) :: use_index
LOGICAL :: f_corder_valid ! Indicates whether the creation order data is valid for this attribute
INTEGER :: corder ! Is a positive integer containing the creation order of the attribute
INTEGER :: cset ! Indicates the character set used for the attribute’s name
INTEGER(HSIZE_T) :: data_size ! Indicates the size, in the number of characters, of the attribute
CHARACTER(LEN=7) :: tmpname !/* Temporary link name */
CHARACTER(LEN=3) :: tmpname_small !/* to small temporary link name */
CHARACTER(LEN=10) :: tmpname_big !/* to big temporary link name */
CHARACTER(LEN=7) :: valname !/* Link value name */
CHARACTER(LEN=7) :: tmpval !/* Temporary link value */
CHARACTER(LEN=2) :: chr2
INTEGER(SIZE_T) :: size_tmp
INTEGER :: error
! /* Make link value for increasing/native order queries */
WRITE(chr2,'(I2.2)') n
valname = 'valn.'//chr2
! /* Verify the link information for first link, in increasing creation order */
! HDmemset(&linfo, 0, sizeof(linfo));
CALL H5Lget_info_by_idx_f(group_id, ".", H5_INDEX_CRT_ORDER_F, H5_ITER_INC_F, INT(0,HSIZE_T), &
f_corder_valid, corder, cset, data_size, error)
CALL check("H5Lget_info_by_idx_f", error, total_error)
CALL VERIFY("H5Lget_info_by_idx_f", corder, 0, total_error)
! /* Verify the link information for new link, in increasing creation order */
! HDmemset(&linfo, 0, sizeof(linfo));
CALL H5Lget_info_by_idx_f(group_id, ".", H5_INDEX_CRT_ORDER_F, H5_ITER_INC_F, INT(n,HSIZE_T), &
f_corder_valid, corder, cset, data_size, error)
CALL check("H5Lget_info_by_idx_f", error, total_error)
CALL VERIFY("H5Lget_info_by_idx_f", corder, n, total_error)
! /* Verify value for new soft link, in increasing creation order */
!!$ IF(hard_link)THEN
!!$ ! HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE);
!!$
!!$ CALL H5Lget_val_by_idx_f(group_id, ".", H5_INDEX_CRT_ORDER_F, H5_ITER_INC_F, n, tmpval, INT(7,SIZE_T),error)
!!$ CALL check("H5Lget_val_by_idx",error,total_error)
!!$
!!$! IF(HDstrcmp(valname, tmpval)) TEST_ERROR
!!$ ENDIF
! /* Verify the name for new link, in increasing creation order */
! HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
! The actual size of tmpname should be 7
size_tmp = INT(3,SIZE_T)
CALL H5Lget_name_by_idx_f(group_id, ".", H5_INDEX_CRT_ORDER_F, H5_ITER_INC_F, INT(n,HSIZE_T), size_tmp, tmpname_small, error)
CALL check("link_info_by_idx_check.H5Lget_name_by_idx_f", error, total_error)
CALL verifyString("link_info_by_idx_check.H5Lget_name_by_idx_f", &
linkname(1:LEN(tmpname_small)), tmpname_small(1:LEN(tmpname_small)), total_error)
CALL VERIFY("link_info_by_idx_check.H5Lget_name_by_idx_f", INT(size_tmp), 7, total_error)
! try it with the correct size
size_tmp = INT(LEN(tmpname),SIZE_T)
CALL H5Lget_name_by_idx_f(group_id, ".", H5_INDEX_CRT_ORDER_F, H5_ITER_INC_F, INT(n,HSIZE_T), size_tmp, tmpname, error)
CALL check("link_info_by_idx_check.H5Lget_name_by_idx_f", error, total_error)
CALL verifyString("link_info_by_idx_check.H5Lget_name_by_idx_f", &
linkname(1:LEN(tmpname)), tmpname(1:LEN(tmpname)), total_error)
CALL VERIFY("link_info_by_idx_check.H5Lget_name_by_idx_f", INT(size_tmp), 7, total_error)
size_tmp = INT(LEN(tmpname_big),SIZE_T)
CALL H5Lget_name_by_idx_f(group_id, ".", H5_INDEX_CRT_ORDER_F, H5_ITER_INC_F, INT(n,HSIZE_T), size_tmp, tmpname_big, error)
CALL check("link_info_by_idx_check.H5Lget_name_by_idx_f", error, total_error)
CALL verifyString("link_info_by_idx_check.H5Lget_name_by_idx_f", &
linkname(1:7), tmpname_big(1:7), total_error)
CALL VERIFY("link_info_by_idx_check.H5Lget_name_by_idx_f", INT(size_tmp), 7, total_error)
! Try with a buffer set to small
!!$ size_tmp = INT(4,SIZE_T)
!!$ CALL H5Lget_name_by_idx_f(group_id, ".", H5_INDEX_CRT_ORDER_F, H5_ITER_INC_F, INT(n,HSIZE_T), size_tmp, tmpname, error)
!!$ CALL check("H5Lget_name_by_idx_f", error, total_error)
!!$ CALL verifyString("H5Lget_name_by_idx_f", linkname, tmpname, total_error)
!!$
!!$ if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(HDstrcmp(linkname, tmpname)) TEST_ERROR
!!$ /* Don't test "native" order if there is no creation order index, since
!!$ * there's not a good way to easily predict the link's order in the name
!!$ * index.
!!$ */
!!$ if(use_index) {
!!$ /* Verify the link information for first link, in native creation order (which is increasing) */
!!$ HDmemset(&linfo, 0, sizeof(linfo));
!!$ if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(linfo.corder != 0) TEST_ERROR
!!$
!!$ /* Verify the link information for new link, in native creation order (which is increasing) */
!!$ HDmemset(&linfo, 0, sizeof(linfo));
!!$ if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(linfo.corder != (int64_t)n) TEST_ERROR
!!$
!!$ /* Verify value for new soft link, in native creation order (which is increasing) */
!!$ if(!hard_link) {
!!$ HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE);
!!$ if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(HDstrcmp(valname, tmpval)) TEST_ERROR
!!$ } /* end if */
!!$
!!$ /* Verify the name for new link, in native creation order (which is increasing) */
!!$ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
!!$ if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(HDstrcmp(linkname, tmpname)) TEST_ERROR
!!$ } /* end if */
!!$
!!$ /* Verify the link information for first link, in decreasing creation order */
!!$ HDmemset(&linfo, 0, sizeof(linfo));
!!$ if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(linfo.corder != 0) TEST_ERROR
!!$
!!$ /* Verify the link information for new link, in decreasing creation order */
!!$ HDmemset(&linfo, 0, sizeof(linfo));
!!$ if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(linfo.corder != (int64_t)n) TEST_ERROR
!!$
!!$ /* Verify value for new soft link, in decreasing creation order */
!!$ if(!hard_link) {
!!$ HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE);
!!$ if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(HDstrcmp(valname, tmpval)) TEST_ERROR
!!$ } /* end if */
!!$
!!$ /* Verify the name for new link, in decreasing creation order */
!!$ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
!!$ if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(HDstrcmp(linkname, tmpname)) TEST_ERROR
!!$
!!$
!!$ /* Verify the link information for first link, in increasing link name order */
!!$ HDmemset(&linfo, 0, sizeof(linfo));
!!$ if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(linfo.corder != 0) TEST_ERROR
!!$
!!$ /* Verify the link information for new link, in increasing link name order */
!!$ HDmemset(&linfo, 0, sizeof(linfo));
!!$ if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(linfo.corder != (int64_t)n) TEST_ERROR
!!$
!!$ /* Verify value for new soft link, in increasing link name order */
!!$ if(!hard_link) {
!!$ HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE);
!!$ if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(HDstrcmp(valname, tmpval)) TEST_ERROR
!!$ } /* end if */
!!$
!!$ /* Verify the name for new link, in increasing link name order */
!!$ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
!!$ if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(HDstrcmp(linkname, tmpname)) TEST_ERROR
!!$
!!$ /* Don't test "native" order queries on link name order, since there's not
!!$ * a good way to easily predict the order of the links in the name index.
!!$ */
!!$
!!$ /* Verify the link information for first link, in decreasing link name order */
!!$ HDmemset(&linfo, 0, sizeof(linfo));
!!$ if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(linfo.corder != 0) TEST_ERROR
!!$
!!$ /* Verify the link information for new link, in decreasing link name order */
!!$ HDmemset(&linfo, 0, sizeof(linfo));
!!$ if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(linfo.corder != (int64_t)n) TEST_ERROR
!!$
!!$ /* Verify value for new soft link, in decreasing link name order */
!!$ if(!hard_link) {
!!$ HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE);
!!$ if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(HDstrcmp(valname, tmpval)) TEST_ERROR
!!$ } /* end if */
!!$
!!$ /* Verify the name for new link, in decreasing link name order */
!!$ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
!!$ if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
!!$ if(HDstrcmp(linkname, tmpname)) TEST_ERROR
!!$
!!$ /* Success */
!!$ return(0);
!!$
!!$error:
!!$ /* Failure */
!!$ return(-1);
!!$} /* end link_info_by_idx_check() */
END SUBROUTINE link_info_by_idx_check
!/*-------------------------------------------------------------------------
! * Function: test_lcpl
! *
! * Purpose: Tests Link Creation Property Lists
! *
! * Return: Success: 0
! * Failure: number of errors
! *
! * Programmer: M.S. Breitenfeld
! * Modified C routine
! * March 12, 2008
! *
! * Modifications:
! *
! *-------------------------------------------------------------------------
! */
SUBROUTINE test_lcpl(cleanup, fapl, total_error)
USE HDF5 ! This module contains all necessary modules
IMPLICIT NONE
INTEGER, INTENT(INOUT) :: total_error
INTEGER(HID_T), INTENT(IN) :: fapl
LOGICAL :: cleanup
INTEGER(HID_T) :: file_id
INTEGER(HID_T) :: group_id
INTEGER(HID_T) :: space_id, data_space
INTEGER(HID_T) :: dset_id
INTEGER(HID_T) :: type_id
INTEGER(HID_T) :: lcpl_id
INTEGER :: cset ! Indicates the character set used for the link’s name.
INTEGER :: corder ! Specifies the link’s creation order position.
LOGICAL :: f_corder_valid ! Indicates whether the value in corder is valid.
INTEGER :: 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
INTEGER :: address ! If the link is a hard link, address specifies the file address that the link points to
INTEGER(HSIZE_T) :: val_size ! If the link is a symbolic link, val_size will be the length of the link value
INTEGER(HSIZE_T) :: data_size ! Indicates the size, in the number of characters, of the attribute
CHARACTER(LEN=1024) :: filename = 'tempfile.h5'
INTEGER, PARAMETER :: TEST6_DIM1 = 8, TEST6_DIM2 = 7
INTEGER(HSIZE_T), DIMENSION(1:2), PARAMETER :: dims = (/TEST6_DIM1,TEST6_DIM2/)
INTEGER :: encoding
INTEGER :: error
LOGICAL :: Lexists
INTEGER(HSIZE_T), DIMENSION(1:2), PARAMETER :: extend_dim = (/TEST6_DIM1-2,TEST6_DIM2-3/)
INTEGER(HSIZE_T), DIMENSION(1:2) :: dimsout, maxdimsout ! dimensions
INTEGER :: i
WRITE(*,*) "link creation property lists (w/new group format)"
!/* Actually, intermediate group creation is tested elsewhere (tmisc).
! * Here we only need to test the character encoding property */
!/* Create file */
! h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
CALL H5Fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error, H5P_DEFAULT_F, fapl)
CALL check("test_lcpl.H5Fcreate_f", error, total_error)
! /* Create and link a group with the default LCPL */
CALL H5Gcreate_f(file_id, "/group", group_id, error)
CALL check("test_lcpl.H5Gcreate_f", error, total_error)
! /* Check that its character encoding is the default */
CALL H5Lget_info_f(file_id, "group", &
cset, corder, f_corder_valid, link_type, address, val_size, &
error, H5P_DEFAULT_F)
!/* File-wide default character encoding can not yet be set via the file
! * creation property list and is always ASCII. */
!#define H5F_DEFAULT_CSET H5T_CSET_ASCII -- FROM H5Fprivate.h --
CALL VERIFY("test_lcpl.H5Lget_info_f",cset, H5T_CSET_ASCII_F,total_error)
! /* Create and commit a datatype with the default LCPL */
CALL h5tcopy_f(H5T_NATIVE_INTEGER, type_id, error)
CALL check("test_lcpl.h5tcopy_f",error,total_error)
CALL h5tcommit_f(file_id, "/type", type_id, error)
CALL check("test_lcpl.h5tcommit_f", error, total_error)
CALL h5tclose_f(type_id, error)
CALL check("test_lcpl.h5tclose_f", error, total_error)
! /* Check that its character encoding is the default */
CALL H5Lget_info_f(file_id, "type", &
cset, corder, f_corder_valid, link_type, address, val_size, &
error)
CALL check("test_lcpl.h5tclose_f", error, total_error)
!/* File-wide default character encoding can not yet be set via the file
! * creation property list and is always ASCII. */
!#define H5F_DEFAULT_CSET H5T_CSET_ASCII -- FROM H5Fprivate.h --
CALL verify("test_lcpl.H5Lget_info_f",cset, H5T_CSET_ASCII_F,total_error)
!/* Create a dataspace */
CALL h5screate_simple_f(2, dims, space_id, error)
CALL check("test_lcpl.h5screate_simple_f",error,total_error)
! /* Create a dataset using the default LCPL */
CALL h5dcreate_f(file_id, "/dataset", H5T_NATIVE_INTEGER, space_id, dset_id, error)
CALL check("test_lcpl.h5dcreate_f", error, total_error)
CALL h5dclose_f(dset_id, error)
CALL check("test_lcpl.h5dclose_f", error, total_error)
! Reopen
CALL H5Dopen_f(file_id, "/dataset", dset_id, error)
CALL check("test_lcpl.h5dopen_f", error, total_error)
! /* Extend the dataset */
CALL H5Dset_extent_f(dset_id, extend_dim, error)
CALL check("test_lcpl.H5Dset_extent_f", error, total_error)
! /* Verify the dataspaces */
!
!Get dataset's dataspace handle.
!
CALL h5dget_space_f(dset_id, data_space, error)
CALL check("h5dget_space_f",error,total_error)
CALL h5sget_simple_extent_dims_f(data_space, dimsout, maxdimsout, error)
CALL check("test_lcpl.h5sget_simple_extent_dims_f",error, total_error)
DO i = 1, 2
CALL VERIFY("H5Sget_simple_extent_dims", dimsout(i), extend_dim(i), total_error)
CALL VERIFY("H5Sget_simple_extent_dims", maxdimsout(i), dims(i), total_error)
ENDDO
! /* close data set */
CALL h5dclose_f(dset_id, error)
CALL check("test_lcpl.h5dclose_f", error, total_error)
! /* Check that its character encoding is the default */
CALL H5Lget_info_f(file_id, "dataset", &
cset, corder, f_corder_valid, link_type, address, val_size, &
error)
CALL check("test_lcpl.H5Lget_info_f", error, total_error)
!/* File-wide default character encoding can not yet be set via the file
! * creation property list and is always ASCII. */
!#define H5F_DEFAULT_CSET H5T_CSET_ASCII -- FROM H5Fprivate.h --
CALL verify("test_lcpl.h5tclose_f",cset, H5T_CSET_ASCII_F,total_error)
!/* Create a link creation property list with the UTF-8 character encoding */
CALL H5Pcreate_f(H5P_LINK_CREATE_F,lcpl_id,error)
CALL check("test_lcpl.h5Pcreate_f",error,total_error)
CALL H5Pset_char_encoding_f(lcpl_id, H5T_CSET_UTF8_F, error)
CALL check("test_lcpl.H5Pset_char_encoding_f",error, total_error)
! /* Create and link a group with the new LCPL */
CALL H5Gcreate_f(file_id, "/group2", group_id, error,lcpl_id=lcpl_id)
CALL check("test_lcpl.test_lcpl.H5Gcreate_f", error, total_error)
CALL H5Gclose_f(group_id, error)
CALL check("test_lcpl.test_lcpl.H5Gclose_f", error, total_error)
!/* Check that its character encoding is UTF-8 */
CALL H5Lget_info_f(file_id, "group2", &
cset, corder, f_corder_valid, link_type, address, val_size, &
error)
CALL check("test_lcpl.H5Lget_info_f", error, total_error)
CALL verify("test_lcpl.H5Lget_info_f",cset, H5T_CSET_UTF8_F,total_error)
! /* Create and commit a datatype with the new LCPL */
CALL h5tcopy_f(H5T_NATIVE_INTEGER, type_id, error)
CALL check("test_lcpl.h5tcopy_f",error,total_error)
CALL h5tcommit_f(file_id, "/type2", type_id, error, lcpl_id=lcpl_id)
CALL check("test_lcpl.h5tcommit_f", error, total_error)
CALL h5tclose_f(type_id, error)
CALL check("test_lcpl.h5tclose_f", error, total_error)
!/* Check that its character encoding is UTF-8 */
CALL H5Lget_info_f(file_id, "type2", &
cset, corder, f_corder_valid, link_type, address, val_size, &
error)
CALL check("test_lcpl.H5Lget_info_f", error, total_error)
CALL verify("test_lcpl.H5Lget_info_f",cset, H5T_CSET_UTF8_F,total_error)
! /* Create a dataset using the new LCPL */
CALL h5dcreate_f(file_id, "/dataset2", H5T_NATIVE_INTEGER, space_id, dset_id, error,lcpl_id=lcpl_id)
CALL check("test_lcpl.h5dcreate_f", error, total_error)
CALL h5dclose_f(dset_id, error)
CALL check("test_lcpl.h5dclose_f", error, total_error)
CALL H5Pget_char_encoding_f(lcpl_id, encoding, error)
CALL check("test_lcpl.H5Pget_char_encoding_f", error, total_error)
CALL VERIFY("test_lcpl.H5Pget_char_encoding_f", encoding, H5T_CSET_UTF8_F, total_error)
! /* Check that its character encoding is UTF-8 */
CALL H5Lget_info_f(file_id, "dataset2", &
cset, corder, f_corder_valid, link_type, address, val_size, &
error)
CALL check("test_lcpl.H5Lget_info_f", error, total_error)
CALL verify("test_lcpl.H5Lget_info_f2",cset, H5T_CSET_UTF8_F,total_error)
! /* Create a new link to the dataset with a different character encoding. */
CALL H5Pclose_f(lcpl_id, error)
CALL check("test_lcpl.H5Pclose_f", error, total_error)
CALL H5Pcreate_f(H5P_LINK_CREATE_F,lcpl_id,error)
CALL check("test_lcpl.h5Pcreate_f",error,total_error)
CALL H5Pset_char_encoding_f(lcpl_id, H5T_CSET_ASCII_F, error)
CALL check("test_lcpl.H5Pset_char_encoding_f",error, total_error)
CALL H5Lcreate_hard_f(file_id, "/dataset2", file_id, "/dataset2_link", error, lcpl_id)
CALL check("test_lcpl.H5Lcreate_hard_f",error, total_error)
CALL H5Lexists_f(file_id,"/dataset2_link",Lexists, error)
CALL check("test_lcpl.H5Lexists",error, total_error)
CALL verifylogical("test_lcpl.H5Lexists", Lexists,.TRUE.,total_error)
! /* Check that its character encoding is ASCII */
CALL H5Lget_info_f(file_id, "/dataset2_link", &
cset, corder, f_corder_valid, link_type, address, val_size, &
error)
CALL check("test_lcpl.H5Lget_info_f", error, total_error)
CALL verify("test_lcpl.H5Lget_info_f",cset, H5T_CSET_ASCII_F,total_error)
! /* Check that the first link's encoding hasn't changed */
CALL H5Lget_info_f(file_id, "/dataset2", &
cset, corder, f_corder_valid, link_type, address, val_size, &
error)
CALL check("test_lcpl.H5Lget_info_f", error, total_error)
CALL verify("test_lcpl.H5Lget_info_f3",cset, H5T_CSET_UTF8_F,total_error)
!/* Make sure that LCPLs work properly for other API calls: */
!/* H5Lcreate_soft */
CALL H5Pset_char_encoding_f(lcpl_id, H5T_CSET_UTF8_F, error)
CALL check("test_lcpl.H5Pset_char_encoding_f",error, total_error)
CALL H5Lcreate_soft_f("dataset2", file_id, "slink_to_dset2",error,lcpl_id)
CALL check("H5Lcreate_soft_f", error, total_error)
CALL H5Lget_info_f(file_id, "slink_to_dset2", &
cset, corder, f_corder_valid, link_type, address, val_size, &
error)
CALL check("test_lcpl.H5Lget_info_f", error, total_error)
CALL verify("test_lcpl.H5Lget_info_f",cset, H5T_CSET_UTF8_F,total_error)
! /* H5Lmove */
CALL H5Pset_char_encoding_f(lcpl_id, H5T_CSET_ASCII_F, error)
CALL check("test_lcpl.H5Pset_char_encoding_f",error, total_error)
CALL H5Lmove_f(file_id, "slink_to_dset2", file_id, "moved_slink", error, lcpl_id, H5P_DEFAULT_F)
CALL check("test_lcpl.H5Lmove_f",error, total_error)
CALL H5Lget_info_f(file_id, "moved_slink", &
cset, corder, f_corder_valid, link_type, address, val_size, &
error)
CALL check("test_lcpl.H5Lget_info_f", error, total_error)
CALL verify("test_lcpl.H5Lget_info_f",cset, H5T_CSET_ASCII_F,total_error)
! /* H5Lcopy */
CALL H5Pset_char_encoding_f(lcpl_id, H5T_CSET_UTF8_F, error)
CALL check("test_lcpl.H5Pset_char_encoding_f",error, total_error)
CALL H5Lcopy_f(file_id, "moved_slink", file_id, "copied_slink", error, lcpl_id)
CALL H5Lget_info_f(file_id, "copied_slink", &
cset, corder, f_corder_valid, link_type, address, val_size, &
error)
CALL check("test_lcpl.H5Lget_info_f", error, total_error)
CALL verify("test_lcpl.H5Lget_info_f",cset, H5T_CSET_UTF8_F,total_error)
! /* H5Lcreate_external */
CALL H5Lcreate_external_f("test_lcpl.filename", "path", file_id, "extlink", error, lcpl_id)
CALL check("test_lcpl.H5Lcreate_external_f", error, total_error)
CALL H5Lget_info_f(file_id, "extlink", &
cset, corder, f_corder_valid, link_type, address, val_size, &
error)
CALL check("test_lcpl.H5Lget_info_f", error, total_error)
CALL verify("test_lcpl.H5Lget_info_f",cset, H5T_CSET_UTF8_F,total_error)
! /* Close open IDs */
CALL H5Pclose_f(lcpl_id, error)
CALL check("test_lcpl.H5Pclose_f", error, total_error)
CALL H5Sclose_f(space_id, error)
CALL check("test_lcpl.h5Sclose_f",error,total_error)
CALL H5Fclose_f(file_id, error)
CALL check("test_lcpl.H5Fclose_f", error, total_error)
IF(cleanup) CALL h5_cleanup_f("tempfile", H5P_DEFAULT_F, error)
CALL check("h5_cleanup_f", error, total_error)
END SUBROUTINE test_lcpl
SUBROUTINE objcopy(fapl, total_error)
USE HDF5 ! This module contains all necessary modules
IMPLICIT NONE
INTEGER, INTENT(INOUT) :: total_error
INTEGER(HID_T), INTENT(IN) :: fapl
INTEGER(HID_T) :: fapl2, pid
INTEGER :: flag, cpy_flags
INTEGER :: error
flag = H5O_COPY_SHALLOW_HIERARCHY_F
!/* Copy the file access property list */
CALL H5Pcopy_f(fapl, fapl2, error)
CALL check("H5Pcopy_f", error, total_error)
!/* Set the "use the latest version of the format" bounds for creating objects in the file */
CALL H5Pset_libver_bounds_f(fapl2, H5F_LIBVER_LATEST_F, H5F_LIBVER_LATEST_F, error)
! /* create property to pass copy options */
CALL h5pcreate_f(H5P_OBJECT_COPY_F, pid, error)
CALL check("h5pcreate_f",error, total_error)
! /* set options for object copy */
CALL H5Pset_copy_object_f(pid, flag, error)
CALL check("H5Pset_copy_object_f",error, total_error)
! /* Verify object copy flags */
CALL H5Pget_copy_object_f(pid, cpy_flags, error)
CALL check("H5Pget_copy_object_f",error, total_error)
CALL VERIFY("H5Pget_copy_object_f", cpy_flags, flag, total_error)
!!$
!!$ CALL test_copy_option(fcpl_src, fcpl_dst, my_fapl, H5O_COPY_WITHOUT_ATTR_FLAG,
!!$ FALSE, "H5Ocopy(): without attributes");
CALL lapl_nlinks(fapl2, total_error)
END SUBROUTINE objcopy
!/*-------------------------------------------------------------------------
! * Function: lapl_nlinks
! *
! * Purpose: Check that the maximum number of soft links can be adjusted
! * by the user using the Link Access Property List.
! *
! * Return: Success: 0
! *
! * Failure: -1
! *
! * Programmer: James Laird
! * Tuesday, June 6, 2006
! *
! * Modifications:
! *
! *-------------------------------------------------------------------------
! */
SUBROUTINE lapl_nlinks( fapl, total_error)
USE HDF5
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: fapl
INTEGER, INTENT(INOUT) :: total_error
INTEGER :: error
INTEGER(HID_T) :: fid = (-1) !/* File ID */
INTEGER(HID_T) :: gid = (-1), gid2 = (-1) !/* Group IDs */
INTEGER(HID_T) :: plist = (-1) ! /* lapl ID */
INTEGER(HID_T) :: tid = (-1), sid = (-1), did = (-1) ! /* Other IDs */
INTEGER(HID_T) :: gapl = (-1), dapl = (-1), tapl = (-1) ! /* Other property lists */
CHARACTER(LEN=7) :: objname ! /* Object name */
INTEGER(size_t) :: name_len ! /* Length of object name */
CHARACTER(LEN=12) :: filename = 'TestLinks.h5'
INTEGER(size_t) :: nlinks ! /* nlinks for H5Pset_nlinks */
INTEGER(hsize_t), DIMENSION(2) :: dims
INTEGER(size_t) :: buf_size = 7
WRITE(*,*) "adjusting nlinks with LAPL (w/new group format)"
!!$ /* Make certain test is valid */
!!$ /* XXX: should probably make a "generic" test that creates the proper
!!$ * # of links based on this value - QAK
!!$ */
!!$ HDassert(H5L_NUM_LINKS == 16);
! /* Create file */
CALL h5fcreate_f(FileName, H5F_ACC_TRUNC_F, fid, error, access_prp=fapl)
CALL check(" lapl_nlinks.h5fcreate_f",error,total_error)
! /* Create group with short name in file (used as target for links) */
CALL H5Gcreate_f(fid, "final", gid, error)
CALL check(" lapl_nlinks.H5Gcreate_f", error, total_error)
!/* Create chain of soft links to existing object (limited) */
CALL H5Lcreate_soft_f("final", fid, "soft1", error)
CALL H5Lcreate_soft_f("soft1", fid, "soft2", error)
CALL H5Lcreate_soft_f("soft2", fid, "soft3", error)
CALL H5Lcreate_soft_f("soft3", fid, "soft4", error)
CALL H5Lcreate_soft_f("soft4", fid, "soft5", error)
CALL H5Lcreate_soft_f("soft5", fid, "soft6", error)
CALL H5Lcreate_soft_f("soft6", fid, "soft7", error)
CALL H5Lcreate_soft_f("soft7", fid, "soft8", error)
CALL H5Lcreate_soft_f("soft8", fid, "soft9", error)
CALL H5Lcreate_soft_f("soft9", fid, "soft10", error)
CALL H5Lcreate_soft_f("soft10", fid, "soft11", error)
CALL H5Lcreate_soft_f("soft11", fid, "soft12", error)
CALL H5Lcreate_soft_f("soft12", fid, "soft13", error)
CALL H5Lcreate_soft_f("soft13", fid, "soft14", error)
CALL H5Lcreate_soft_f("soft14", fid, "soft15", error)
CALL H5Lcreate_soft_f("soft15", fid, "soft16", error)
CALL H5Lcreate_soft_f("soft16", fid, "soft17", error)
!/* Close objects */
CALL H5Gclose_f(gid, error)
CALL check("h5gclose_f",error,total_error)
CALL h5fclose_f(fid, error)
CALL check("h5fclose_f",error,total_error)
!/* Open file */
CALL h5fopen_f(FileName, H5F_ACC_RDWR_F, fid, error, fapl)
CALL check("h5open_f",error,total_error)
!/* Create LAPL with higher-than-usual nlinks value */
!/* Create a non-default lapl with udata set to point to the first group */
CALL H5Pcreate_f(H5P_LINK_ACCESS_F,plist,error)
CALL check("h5Pcreate_f",error,total_error)
nlinks = 20
CALL H5Pset_nlinks_f(plist, nlinks, error)
CALL check("H5Pset_nlinks_f",error,total_error)
!/* Ensure that nlinks was set successfully */
nlinks = 0
CALL H5Pget_nlinks_f(plist, nlinks, error)
CALL check("H5Pset_nlinks_f",error,total_error)
CALL VERIFY("H5Pset_nlinks_f",INT(nlinks), 20, total_error)
!/* Open object through what is normally too many soft links using
! * new property list */
CALL H5Oopen_f(fid,"soft17",gid,error,plist)
CALL check("H5Oopen_f",error,total_error)
!/* Check name */
CALL h5iget_name_f(gid, objname, buf_size, name_len, error)
CALL check("h5iget_name_f",error,total_error)
CALL VerifyString("h5iget_name_f", TRIM(objname),"/soft17", total_error)
!/* Create group using soft link */
CALL H5Gcreate_f(gid, "new_soft", gid2, error)
CALL check("H5Gcreate_f", error, total_error)
! /* Close groups */
CALL H5Gclose_f(gid2, error)
CALL check("H5Gclose_f", error, total_error)
CALL H5Gclose_f(gid, error)
CALL check("H5Gclose_f", error, total_error)
!/* Set nlinks to a smaller number */
nlinks = 4
CALL H5Pset_nlinks_f(plist, nlinks, error)
CALL check("H5Pset_nlinks_f", error, total_error)
!/* Ensure that nlinks was set successfully */
nlinks = 0
CALL H5Pget_nlinks_f(plist, nlinks, error)
CALL check("H5Pget_nlinks_f",error,total_error)
CALL VERIFY("H5Pget_nlinks_f", INT(nlinks), 4, total_error)
! /* Try opening through what is now too many soft links */
CALL H5Oopen_f(fid,"soft5",gid,error,plist)
CALL VERIFY("H5Oopen_f", error, -1, total_error) ! should fail
! /* Open object through lesser soft link */
CALL H5Oopen_f(fid,"soft4",gid,error,plist)
CALL check("H5Oopen_",error,total_error)
! /* Check name */
CALL h5iget_name_f(gid, objname, buf_size, name_len, error)
CALL check("h5iget_name_f",error,total_error)
CALL VerifyString("h5iget_name_f", TRIM(objname),"/soft4", total_error)
! /* Test other functions that should use a LAPL */
nlinks = 20
CALL H5Pset_nlinks_f(plist, nlinks, error)
CALL check("H5Pset_nlinks_f", error, total_error)
!/* Try copying and moving when both src and dst contain many soft links
! * using a non-default LAPL
! */
CALL H5Lcopy_f(fid, "soft17", fid, "soft17/newer_soft", error, H5P_DEFAULT_F, plist)
CALL check("H5Lcopy_f",error,total_error)
CALL H5Lmove_f(fid, "soft17/newer_soft", fid, "soft17/newest_soft", error, lapl_id=plist)
CALL check("H5Lmove_f",error, total_error)
! /* H5Olink */
CALL H5Olink_f(gid, fid, "soft17/link_to_group", error, H5P_DEFAULT_F, plist)
CALL check("H5Olink_f", error, total_error)
! /* H5Lcreate_hard and H5Lcreate_soft */
CALL H5Lcreate_hard_f(fid, "soft17", fid, "soft17/link2_to_group", error, H5P_DEFAULT_F, plist)
CALL check("H5Lcreate_hard_f", error, total_error)
CALL H5Lcreate_soft_f("/soft4", fid, "soft17/soft_link",error, H5P_DEFAULT_F, plist)
CALL check("H5Lcreate_soft_f", error, total_error)
! /* H5Ldelete */
CALL h5ldelete_f(fid, "soft17/soft_link", error, plist)
CALL check("H5Ldelete_f", error, total_error)
!!$ /* H5Lget_val and H5Lget_info */
!!$ if(H5Lget_val(fid, "soft17", NULL, (size_t)0, plist) < 0) TEST_ERROR
!!$ if(H5Lget_info(fid, "soft17", NULL, plist) < 0) TEST_ERROR
!!$
! /* H5Lcreate_external and H5Lcreate_ud */
CALL H5Lcreate_external_f("filename", "path", fid, "soft17/extlink", error, H5P_DEFAULT_F, plist)
CALL check("H5Lcreate_external_f", error, total_error)
!!$ if(H5Lregister(UD_rereg_class) < 0) TEST_ERROR
!!$ if(H5Lcreate_ud(fid, "soft17/udlink", UD_HARD_TYPE, NULL, (size_t)0, H5P_DEFAULT, plist) < 0) TEST_ERROR
!!$
! /* Close plist */
CALL h5pclose_f(plist, error)
CALL check("h5pclose_f", error, total_error)
! /* Create a datatype and dataset as targets inside the group */
CALL h5tcopy_f(H5T_NATIVE_INTEGER, tid, error)
CALL check("h5tcopy_f",error,total_error)
CALL h5tcommit_f(gid, "datatype", tid, error)
CALL check("h5tcommit_f", error, total_error)
CALL h5tclose_f(tid, error)
CALL check("h5tclose_f", error, total_error)
!!$
!!$ dims[0] = 2;
!!$ dims[1] = 2;
!!$ if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR
!!$ if((did = H5Dcreate2(gid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
!!$ if(H5Dclose(did) < 0) TEST_ERROR
!!$
!/* Close group */
CALL h5gclose_f(gid, error)
CALL check("h5gclose_f",error,total_error)
!!$
!!$ /* Try to open the objects using too many symlinks with default *APLs */
!!$ H5E_BEGIN_TRY {
!!$ if((gid = H5Gopen2(fid, "soft17", H5P_DEFAULT)) >= 0)
!!$ FAIL_PUTS_ERROR(" Should have failed for too many nested links.")
!!$ if((tid = H5Topen2(fid, "soft17/datatype", H5P_DEFAULT)) >= 0)
!!$ FAIL_PUTS_ERROR(" Should have failed for too many nested links.")
!!$ if((did = H5Dopen2(fid, "soft17/dataset", H5P_DEFAULT)) >= 0)
!!$ FAIL_PUTS_ERROR(" Should have failed for too many nested links.")
!!$ } H5E_END_TRY
!!$
! /* Create property lists with nlinks set */
CALL H5Pcreate_f(H5P_GROUP_ACCESS_F,gapl,error)
CALL check("h5Pcreate_f",error,total_error)
CALL H5Pcreate_f(H5P_DATATYPE_ACCESS_F,tapl,error)
CALL check("h5Pcreate_f",error,total_error)
CALL H5Pcreate_f(H5P_DATASET_ACCESS_F,dapl,error)
CALL check("h5Pcreate_f",error,total_error)
nlinks = 20
CALL H5Pset_nlinks_f(gapl, nlinks, error)
CALL check("H5Pset_nlinks_f", error, total_error)
CALL H5Pset_nlinks_f(tapl, nlinks, error)
CALL check("H5Pset_nlinks_f", error, total_error)
CALL H5Pset_nlinks_f(dapl, nlinks, error)
CALL check("H5Pset_nlinks_f", error, total_error)
!/* We should now be able to use these property lists to open each kind
! * of object.
! */
CALL H5Gopen_f(fid, "soft17", gid, error, gapl)
CALL check("H5Gopen_f",error,total_error)
CALL H5Topen_f(fid, "soft17/datatype", tid, error, tapl)
CALL check("H5Gopen_f",error,total_error)
!!$ if((did = H5Dopen2(fid, "soft17/dataset", dapl)) < 0) TEST_ERROR
! /* Close objects */
CALL h5gclose_f(gid, error)
CALL check("h5gclose_f",error,total_error)
CALL h5tclose_f(tid, error)
CALL check("h5tclose_f", error, total_error)
!!$ if(H5Dclose(did) < 0) TEST_ERROR
!!$
! /* Close plists */
CALL h5pclose_f(gapl, error)
CALL check("h5pclose_f", error, total_error)
CALL h5pclose_f(tapl, error)
CALL check("h5pclose_f", error, total_error)
!!$ if(H5Pclose(dapl) < 0) TEST_ERROR
!!$
!!$ /* Unregister UD hard link class */
!!$ if(H5Lunregister(UD_HARD_TYPE) < 0) TEST_ERROR
!!$
! /* Close file */
CALL H5Fclose_f(fid, error)
CALL check("H5Fclose_f", error, total_error)
END SUBROUTINE lapl_nlinks
|