File: pdb5.doc.html

package info (click to toggle)
pact 980714-3
  • links: PTS
  • area: main
  • in suites: slink
  • size: 13,096 kB
  • ctags: 26,034
  • sloc: ansic: 109,076; lisp: 9,645; csh: 7,147; fortran: 1,050; makefile: 136; lex: 95; sh: 32
file content (7805 lines) | stat: -rw-r--r-- 398,132 bytes parent folder | download
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
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
<html><head><title></title></head>

<body>

<a name="932498">
<h1>1.0   </a>Introduction</h1>
</a>
<a name="936795">
</a>PDBLib is a small </a>library of </a>file management routines useful for storing and retrieving binary data in a portable format. It is intended to supply a flexible means of managing </a>binary databases without the user having to be concerned with the machines on which they are written or read.<p>
</a>
<a name="932499">
The specific goals for this library are:<p>
</a>
<ul><a name="932502">
<li>The </a>data files are portable. Using only simple binary file transfers, these files may be passed to any machine supporting an implementation of this library and the data in them immediately read.
</a>
<a name="932507">
<li>The </a>library routines are portable. The library is written in </a>C which is the most standardized language which also enjoys a broad range of implementations. In fact, a C compiler is probably the easiest piece of software to find for any given machine.
</a>
<a name="932511">
<li>The library will support </a>call-by-reference or </a>call-by-value interfaces. In this way the library can be used from </a>FORTRAN (a call-by-reference language) or C (a call-by-value language) programs.
</a>
<a name="932516">
<li> &#145;Arbitrary&#146; </a>data structures may be defined to the PDB system so that there is maximum flexibility and ease of use for application programming. C </a>structs or FORTRAN </a>common blocks may be written or read as a whole. </a>Record structured variables are thus supported.
</a>
<a name="932522">
<li>Data files may be generated for a particular machine type. By default when files are created they are written with the format of the machine that does so. However, they can be written in the format of a designated machine. Thus a more powerful machine can prepare files for a less powerful one.
</a>
<a name="932525">
<li>The library will be small so that machines with as little memory as about 512 Kbytes will be able to profitably use the PDB system.
</a>
<a name="932536">
The binary data format of the files is not machine independent, but it is </a>portable. For the sake of efficiency, the data in any file is expressed in terms of some data format, e.g.</a> IEEE format with 32 bit integers and floats. When PDB files are passed around on machines with the same data format, the data reads and writes involve no </a>conversions. Only when one of these files is read on a machine with a different data format are conversions performed on the data it contains.<p>
</a>
<a name="932549">
This document is divided into several sections. The next section gives an overview of the use of </a>PDBLib and describes some programming practices which are necessary to the successful use of the library. It is followed by a section summarizing the C interface routines in PDBLib and a section giving a more formal and complete description of the C interface with information about normal and error return values, functionality, and rationale. Next are similar sections for the </a>FORTRAN interface routines. Subsequent sections discuss PDBLib design philosophy, data structures, examples, and related documentation.<p>
</a>
</ul><a name="932558">
<h1>2.0   </a>Overview of PDBLib</h1>
</a>
<a name="932569">
The functional PDBLib interface was designed as a minimal extension of the standard C library binary I/O interface. The relevant </a>C library functions are </a>fopen, </a>fclose, </a>fwrite, and </a>fread. The extensions are driven mainly by some missing features in C. Because C doesn&#146;t handle data types as types, PDBLib must be told the type of a variable when it is written to a file. Because C variables don&#146;t know about their dimensions, PDBLib must be given the dimensions when a variable is written out. On the other hand, because PDBLib knows both type and </a>dimension information about file variables, PDBLib requires less information from the programmer when reads are done.<p>
</a>
<a name="932575">
Since C doesn&#146;t have the needed type handling facilities, data structures must be described to PDBLib. Therefore, in addition to the basic </a>I/O functions mentioned above, there is a function in PDBLib to be used when a C data structure or a FORTRAN common block must be described in a file.<p>
</a>
<a name="932585">
Next, to give the user the most flexibility and efficiency regarding </a>data conversions, PDBLib has a function which lets the user specify the binary data format of the file. In this way, a file can be targeted for a particular machine type. A common use for this might be when a powerful machine produces some data which is going to be reprocessed on a less powerful machine. The more powerful machine which writes the file might target the file for the less powerful one so that the conversions are done by the faster machine and not the slower one.<p>
</a>
<a name="932591">
Finally, in some applications with structures, some members of a structure may be pointers, and the actual type to which a pointer points may be changed by a cast depending on some other member&#146;s value. PDBLib supports the notion of a &#145;</a>cast&#146; in that it can be told to ignore the type of a structure member and get the actual type from another member when it writes out the structure.<p>
</a>
<a name="932599">
Because all of the information about files and their contents is contained in PDBLib structures and </a>hash tables, the </a>C API (Application Program Interface) has no inquiry functions. Users can extract information directly from the </a>PDBfile structure and they can use the hash table lookup function, </a>SC_def_lookup, to get access to the </a>syment and </a>defstr structures which describe variables and types, respectively.<p>
</a>
<a name="932605">
The </a>FORTRAN API to PDBLib has many of the same functions as the C API plus several more inquiry functions. These functions are necessary because FORTRAN cannot easily work with structures.<p>
</a>
<a name="932619">
There are also routines to manage </a>data </a>attributes. An </a>attribute table will be created for a PDB file the first time </a>PD_def_attribute is called. The attribute table is kept in the </a>PDBfile structure. Variables can be added to PDB files solely for their attribute values. Attributes can be given to entire variables or any part of them. This works because the attribute table is a separate hash table, like the symbol table, which associates names with attribute values. It also is used to manage the attributes themselves. It is not exactly clear why one should use these attributes. Most of the utility of attributes is already inherent in the structures or records which can by built with PDBLib&#146;s mechanism for defining derived types. Since the structure handling mechanisms are much more efficient, the reason for using attributes instead of structures should be very clear in the mind of the application programmer.<p>
</a>
<a name="934624">
<h2>2.1   </a></a>Compiling and Loading</h2>
</a>
<a name="934626">
To compile your C programs you must use<p>
</a>
<A NAME="934702"><PRE> #include &lt;pdb.h&gt;
</PRE><a name="934721">
in the source files which deal with the interpreter.<p>
</a>
<a name="934723">
To link your application you must use the following libraries in the order specified.<p>
</a>
<dl>
<a name="934729">
<dt>-lpdb -lpml -lscore [-lm ...]
</a>
<a name="935243">
Although this is expressed as if for a UNIX linker, the order would be the same for any system with a single pass linker. The items in [] are optional or system dependent.<p>
</a>
<a name="935318">
Each system has different naming conventions for its libraries and the reader is assumed to understand the appropriate naming conventions as well as knowing how to tell the linker to find the installed PACT libraries on each system that they use.<p>
</a>
</dl>
<a name="934623">
<h2>2.2   </a>Memory Management Considerations</h2>
</a>
<a name="932632">
PDBLib is capable of correctly handling data that is indirectly referenced through arbitrary levels of </a>pointers. In order to do this it is necessary to put an extra layer of memory management over the standard C library routines. The basic requirement is that given a pointer, one would like to know how many bytes of data it points to. The functions, </a>SC_alloc, </a>SC_realloc, </a>SC_strsave, </a>SC_free, and </a>SC_arrlen, built on top of the standard C library functions, </a>malloc and </a>free, provide this capability. For C programmers, </a>macros are provided which offer a nice and intuitive way of using these functions (they also provide an </a>abstraction barrier against the details of any memory management scheme). These functions and macros are documented in the </a>SCORE User&#146;s Manual.<p>
</a>
<a name="932638">
A brief discussion of the procedure for </a>writing and </a>reading </a>indirectly referenced data follows. Although the discussion will use integers as an example, the ideas apply to all data types, primitive or derived.<p>
</a>
<a name="932640">
Consider the following:<p>
</a>
<a name="932435">
<dd> int a[10], *b;<P>
</a>
<a name="932646">
<dd> b = MAKE_N(int, 10);<P>
</a>
<a name="932661">
Both a and b are pointers to 10 integers (</a>macro </a>MAKE_N is used to allocate the necessary space). The difference as far as an application is concerned is that the space that a points to was set aside by the compiler at compile time (for all practical purposes) while the space the b points to is created at run time. There is no possibility, given the definition of the C language, of asking the pointer a how many bytes it points to. On the other hand, since b is dynamically allocated, an extra layer of memory management could be provided so that a function, </a>SC_arrlen, could be defined to return the number of bytes that a dynamically allocated space has. In particular,<p>
</a>
<a name="932662">
<dd> SC_arrlen(a) =&gt; -1 (indicating an error)<P>
</a>
<a name="932664">
<dd> SC_arrlen(b) =&gt; 10<P>
</a>
<a name="932666">
<dd> SC_arrlen(b+5) =&gt; -1 (indicating an error)<P>
</a>
<a name="932673">
These functions and macros can be found in </a>SCORE. The general utility of something like </a>SC_arrlen made it desirable to put it in the lowest possible level library. This could be used for example, to implement some </a>dynamic </a>array </a>bound checking.<p>
</a>
<a name="932679">
PDBLib uses this idea to be able to trace down arbitrary layers of </a>indirection and obtain at each level the exact number of bytes to write out to a file. Of course, it also writes this information out so that the correct amount of space can be allocated by read operations as well as re-creating the correct </a>connectivity of </a>data structures.<p>
</a>
<a name="932691">
Great care must be taken that pointers to fixed arrays not be imbedded in a chain of indirects unless their dimension specifications are included either in the I/O request or the definition of a structure. This point cannot be over-emphasized! The extra memory management layer may fail to detect a </a>statically allocated array and return an erroneous byte count. This in turn will cause very obscure incorrect behavior (in the worst of circumstances) or a direct crash (the best outcome possible).<p>
</a>
<a name="932645">
Also, note that </a>subsets of </a>dynamically allocated arrays cannot know how many bytes they contain and hence care should be taken in their use. <p>
</a>
<a name="932697">
The example on the following page shows the different ways that </a>statically allocated arrays, </a>dynamically allocated arrays, </a>statically allocated </a>arrays of pointers, and </a>dynamically allocated arrays of pointers are handled by PDBLib. Note: The function </a>SC_strsave invokes the </a>MAKE_N </a>macro.<p>
</a>
<A NAME="932694"><PRE> /* define variables in pairs - one to write and one to read into */
</PRE><A NAME="932703"><PRE>     PDBfile *strm;
</PRE><A NAME="932704"><PRE>     char *a, *b;
</PRE><A NAME="932705"><PRE>     char c[10], d[10];
</PRE><A NAME="932706"><PRE>     char *e[3], *f[3];
</PRE><A NAME="932707"><PRE>     char **s, **t;
</PRE><A NAME="932708"><PRE> 
</PRE><A NAME="932709"><PRE>     s = </a>MAKE_N(char *, 2);
</PRE><A NAME="932710"><PRE> 
</PRE><A NAME="932711"><PRE> /* fill </a>statically and </a>dynamically allocated arrays */
</PRE><A NAME="932713"><PRE>     strcpy(c, &#147;bar&#148;);
</PRE><A NAME="932546"><PRE>     a = </a>SC_strsave(&#147;foo&#148;);
</PRE><A NAME="932714"><PRE> 
</PRE><A NAME="932717"><PRE> /* fill </a>statically and </a>dynamically allocated arrays of pointers */
</PRE><A NAME="932720"><PRE>     e[0] = SC_strsave(&#147;Foo&#148;);
</PRE><A NAME="932721"><PRE>     e[1] = NULL;
</PRE><A NAME="932722"><PRE>     e[2] = SC_strsave(&#147;Bar&#148;);
</PRE><A NAME="932712"><PRE>     s[0] = SC_strsave(&#147;Hello&#148;);
</PRE><A NAME="932718"><PRE>     s[1] = SC_strsave(&#147;world&#148;);
</PRE><A NAME="932723"><PRE> 
</PRE><A NAME="932724"><PRE> /* write these variables out
</PRE><A NAME="932725"><PRE>  * note the dimension specifications and the type
</PRE><A NAME="932726"><PRE>  */
</PRE><A NAME="932727"><PRE>     </a>PD_write(strm, &#147;c(10)&#148;, &#147;char&#148;, c);
</PRE><A NAME="932728"><PRE>     PD_write(strm, &#147;a&#148;, &#147;char *&#148;, &amp;a);
</PRE><A NAME="932729"><PRE>     PD_write(strm, &#147;e(3)&#148;, &#147;char *&#148;, e);
</PRE><A NAME="932730"><PRE>     PD_write(strm, &#147;s&#148;, &#147;char **&#148;, &amp;s);
</PRE><A NAME="932731"><PRE> 
</PRE><A NAME="932732"><PRE> /* read the file variables into fresh memory spaces
</PRE><A NAME="932733"><PRE>  * note that the pointers to the pointers are passed in since the
</PRE><A NAME="932734"><PRE>  * space is to be allocated and the value of the pointer here must
</PRE><A NAME="932735"><PRE>  * be set to point to the new space
</PRE><A NAME="932736"><PRE>  */
</PRE><A NAME="932737"><PRE>     </a>PD_read(strm, &#147;c&#148;, d);
</PRE><A NAME="932738"><PRE>     PD_read(strm, &#147;a&#148;, &amp;b);
</PRE><A NAME="932739"><PRE>     PD_read(strm, &#147;e&#148;, f);
</PRE><A NAME="932740"><PRE>     PD_read(strm, &#147;s&#148;, &amp;t);
</PRE><a name="933055">
<h2>2.3   PDB Syntax</h2>
</a>
<a name="933058">
This section contains discussion of some PDB concepts that are used elsewhere in this manual.<p>
</a>
<a name="934301">
In the following discussion and elsewhere in the manual a BNF style notation is used. In such places the following constructs are used:<p>
</a>
<dl>
<a name="934302">
<dt>|	or
</a>
<a name="934311">
<dt>[]	items between the brackets are optional
</a>
<a name="934303">
<dt>[]*	zero or more instances of the items between the brackets
</a>
<a name="934309">
<dt>[]+	one or more instances of the items between the brackets
</a>
<a name="934310">
<dt>&#147;x&#148;	literal x
</a>
<a name="933464">
Since a data entry can be of a structured type, in general, a data entry is a tree. A part of the data tree is specified by a path to that part. A path specification is of the form:<p>
</a>
<a name="933060">
<dt>path		:= node_spec | path.node_spec
</a>
<a name="933061">
<dt>node_spec		:= name[&#147;[&#147; index_expr &#147;]&#148;]* | name[&#147;(&#147; index_expr &#147;)&#148;]*
</a>
<a name="933926">
<dt>name		:= entry-name | member-name
</a>
<a name="933062">
The last node specified is referred to as the terminal node.<p>
</a>
<a name="933056">
<p>
</a>
</dl>
<a name="932745">
<h2>2.4   </a>PDBLib </a>Rules</h2>
</a>
<a name="932749">
There are a few crucial rules to be followed with PDBLib. If they are not obeyed, PDBLib may crash or the results desired will not occur.<p>
</a>
<A NAME="932755">The following </a>reserved characters are not allowed in variable names or </a>defstr </a>member 
names: &#145;</a>.&#146;, &#145;</a>(&#145;, &#145;</a>)&#146;, &#145;</a>[&#145;, and &#145;</a>]&#146;. They are reserved by the grammar of the </a>data description 
language which follows some C and some FORTRAN conventions.
<BR><A NAME="933265">In each read and write operation, the type of the argument corresponding to the variable 
to be written or read must be a pointer to an object of the type specified for the entry. 
For example,
<BR><A NAME="932759"><PRE>     int *a, *b;
</PRE><A NAME="932762"><PRE>            .
</PRE><A NAME="932763"><PRE>            .
</PRE><A NAME="932765"><PRE>     </a>PD_write(strm, &#147;a&#148;, &#147;integer *&#148;, &amp;a);
</PRE><A NAME="932767"><PRE>     </a>PD_read(strm, &#147;a&#148;, &amp;b);
</PRE><A NAME="932768"><PRE>            .
</PRE><A NAME="932770"><PRE>            .
</PRE><A NAME="932776">When using </a>pointers and </a>dynamically </a>allocated memory with PDBLib, use </a>SC_alloc, 
</a>SC_realloc, </a>SC_strsave, </a>MAKE, </a>MAKE_N, </a>REMAKE, or </a>REMAKE_N to allocate 
memory. These functions and macros are documented in the </a>SCORE User&#146;s Manual.
<BR><A NAME="934312">When </a>reading or </a>writing part of a variable, especially a structured variable, the terminal 
node must be of primitive type or a structure containing no indirections and whose 
descendant members contain no indirections. Furthermore, the path to the desired part 
must contain one array reference for each level of </a>indirection traversed. For example,
<BR><A NAME="932784"><PRE>     char **s, c;
</PRE><A NAME="932785"><PRE> 
</PRE><A NAME="932786"><PRE> /* fill s so that s[0] = &#147;Hello&#148; and s[1] = &#147;World&#148; */
</PRE><A NAME="932787"><PRE>            .
</PRE><A NAME="932788"><PRE>            .
</PRE><A NAME="932790"><PRE>     </a>PD_write(strm, &#147;s&#148;, &#147;char **&#148;, &amp;s);
</PRE><A NAME="932791"><PRE> 
</PRE><A NAME="932792"><PRE> /* read the &#145;o&#146; in &#147;Hello&#148; */
</PRE><A NAME="932793"><PRE>     </a>PD_read(strm, &#147;s[0][4]&#148;, &amp;c);
</PRE><A NAME="932794"><PRE> 
</PRE><A NAME="932795"><PRE> /* read the &#145;o&#146; in &#147;World&#148; */
</PRE><A NAME="932796"><PRE>     PD_read(strm, &#147;s[1][1]&#148;, &amp;c);
</PRE><A NAME="932780"><PRE>            .
</PRE><A NAME="932797"><PRE>            .
</PRE><a name="932799">
<h1>3.0   </a>Summary of the </a>C </a>API</h1>
</a>
<a name="932821">
There is a hierarchy of routines in PDBLib from high to low level. The high level routines form the API while the lower level routines are modularized to perform the actual work. It should be noted that the lower level routines are sufficiently well modularized so as to make it possible to build entirely different API&#146;s for PDBLib. <p>
</a>
<a name="932588">
The </a>high level PDBLib routines have a strict </a>naming convention. All high level routines begin with &#145;</a>PD_&#146;. Some routines have several related forms. These are referred to as families of functions. For example the PD_write family.<p>
</a>
<a name="932477">
Most of these routines put an </a>error message into a global variable called </a>PD_err. The error messages include the name of the routine in which they are made thus eliminating the need for error codes which must be cross referenced with some other document. In this way application programs can check for error conditions themselves and decide in what manner to use the PDBLib error messages instead of having error messages printed by the system routines. Error messages are not stacked and must be processed by the application before any other PDBLib calls are made in order to avoid potential overwrites. See the descriptions of individual routines for more information about error handling and messages. <p>
</a>
<a name="933585">
Programs written in C must include a </a>header which makes certain declarations and definitions needed to use the library. Much in the same spirit as one includes </a>stdio.h to use </a>printf and others, include </a>pdb.h as follows:<p>
</a>
<A NAME="932478"><PRE>  </a>#</a>include &#147;pdb.h&#148;
</PRE><a name="932702">
The file </a>pdb.h </a>#</a>include&#146;s some other files which must either be in your directory space or pointed to in some manner which your compiler can recognize. The auxiliary #include files are </a>schash.c, </a>scstd.h, and </a>score.h. These files are a part of the </a>SCORE package which you must have to use PDBLib.<p>
</a>
<a name="932446">
<h2>3.1   Some Guidance in Using the C API to PDBLib</h2>
</a>
<a name="932447">
PDBLib offers a great deal of flexibility to its users. In some cases the flexibility results in a bewildering assortment of function calls from which the application developer must choose. This section is intended to offer some guidance and enable developers to home in on the functions they need to use.<p>
</a>
<a name="932448">
<h3>3.1.1   Opening, Creating and Closing PDB Files</h3>
</a>
<a name="932450">
These are the most fundamental operations involving PDBLib. The function </a>PD_open is used to either open an existing file or create a new one. </a>PD_close is used to close a PDB file so that it can be recognized by PDBLib for future operations.<p>
</a>
<a name="932451">
PDBLib allows applications to specify the binary format in which a newly created file will be written. </a>PD_target does this work. It is not necessary to invoke </a>PD_target before creating a new PDB file. In this case the binary format is that appropriate for the host system.<p>
</a>
<a name="932452">
During the run of an application code, PDBLib can complete the information in an open PDB file so that in the event of a code crash, the file will be a valid PDB file. This functionality is provided by </a>PD_flush.<p>
</a>
<a name="932453">
<h3>3.1.2   Writing Data to PDB Files</h3>
</a>
<a name="932456">
The following paragraphs describe a sequence of increasingly more elaborate output operations for PDB files. They are all compatible with one another so users can select the ones which match their needs best. The most straightforward operations are first.<p>
</a>
<a name="932457">
There are two forms for the most basic data writing operations. These have to do with how the application wants to handle the dimension specifications. The two functions are </a>PD_write and </a>PD_write_alt.<p>
</a>
<a name="932461">
PDBLib supports the notion of writing data of one type out into a file as another type. More precisely, an integer type of data can be written to a file in the format of any other integer type, and similarly for floating point types. The application must take all responsibility for ensuring the appropriateness of this type of conversion (e.g. underflows and overflows). The functions which support this are </a>PD_write_as and </a>PD_write_as_alt.<p>
</a>
<a name="932462">
PDBLib allows applications to append data to existing entries. This is handy in situations where the total amount of data is not known in advance, but a logical ordering of the data is apparent which matches the order in which data will be written. The functions which do this are the </a>PD_append family of functions.<p>
</a>
<a name="932463">
Finally, PDBLib allows applications to reserve space on disk and then let subsequent writes fill in that space with values. This is handy in instances where an application knows a logical structure for a data set but needs to write it out in smaller pieces and not necessarily in the order implied by its logical structure. The functions which let applications reserve space are </a>PD_defent and </a>PD_defent_alt. Reserved spaces may be written to with any of the </a>PD_write family of commands.<p>
</a>
<a name="932464">
<h3>3.1.3   Reading Data from PDB Files</h3>
</a>
<a name="932465">
Since data in a file has a definite size and shape, the reading operations in PDBLib are somewhat simpler than the writing operation. The </a>PD_read family of operations which is the counterpart of the </a>PD_write family does all of the work in reading data from files.<p>
</a>
<a name="932466">
<h3>3.1.4   Defining New Data Types</h3>
</a>
<a name="932490">
To aid application developers in using structured data PDBLib lets applications define new data types in a PDBfile. New data types may either be derived from other existing data types or they may be primitive (integer types, floating point types, or byte sequences). To define derived types applications should use </a>PD_defstr or </a>PD_defstr_alt. To define primitive types use </a>PD_defix, </a>PD_defloat, or </a>PD_defncv.<p>
</a>
<a name="933004">
Since PDBLib supports pointered data types, it is often the case that a pointer in a derived type may point to data of any kind. In C, casts are used to control this behavior. PDBLib permits a member of a struct which is of type &#147;char *&#148; specify the actual type of another pointered member. The function </a>PD_cast is used to set up this behavior.<p>
</a>
<a name="934414">
<h3>3.1.5   Defining Attributes</h3>
</a>
<a name="934652">
PDBLib supports a general mechanism for managing a class of data which is variously referred to as attributes or meta data. In a great many cases, the careful design of data structures obviates the need for this kind of data. Nevertheless, PDBLib supplies four functions to manage attributive data: </a>PD_def_attribute, </a>PD_rem_attribute, </a>PD_get_attribute, </a>PD_set_attribute.<p>
</a>
<a name="932444">
<h3>3.1.6   Using Pointers</h3>
</a>
<a name="936787">
The ability to use pointers with PDBLib is very powerful.  It is unfortunate perhaps that it can also be a little bit tricky. Application developers should be aware of a key issue when using pointers with PDBLib. In general, when you want to write a data tree, you want to faithfully reproduce the connectivity of the tree.  That means that if many pointers refer to the same chunk of memory then the file will exhibit that same pattern. To do this, PDBLib remembers the pointers that it has written and if handed a pointer that it has already written it does NOT write that memory into the file again.  It instead makes note of the connection to an already existing region of disk.  These same considerations apply to reading with the requisite changes in sense.<p>
</a>
<a name="936831">
The difference between files and memory is that data trees may be created, destroyed, and pointers recycled.  For instance, an application may wish to allocate an array, write it as an indirect, change it contents in memory, and write it out again under another name.  This is a very common pattern of usage.  If PDBLib remembers the pointers, only the first write will put any data on disk. Now PDBLib has no way of knowing what the application wants.  The control that applications have is to remove the list of pointers that PDBLib knows about. This accomplished with the PD_reset_ptr_list command.<p>
</a>
<a name="936838">
<h2>3.2   Terms </h2>
</a>
<a name="932687">
A few </a>definitions must be given first to keep the following summary concise. Some of these will be elaborated upon in the next section.<p>
</a>
<A NAME="932824">
<BR><A NAME="932831"></a>PDBfile: for the purposes of a program this is a collection of all the relevant information about one of these data files (in the actual coding it is a C struct). See the section on 
Data Structures for more information.
<BR><A NAME="932470">
<BR><A NAME="932835"></a>ASCII: a string
<BR><A NAME="932471">
<BR><A NAME="932839"></a>TRUE: a value of 1 (defined by PDBLib)
<BR><A NAME="932472">
<BR><A NAME="932843"></a>FALSE: a value of 0 (defined by PDBLib)
<BR><A NAME="932473">
<BR><A NAME="933465"></a>VOID: any C data type
<BR><A NAME="933616">
<BR><A NAME="932474"></a>LAST: a pointer to 0 (declared and defined by PDBLib)
<BR><A NAME="932476">
<BR><A NAME="932853"></a>ENTRY: for the purposes of a program this is a collection of all the relevant information about a variable written to a PDB file (in the actual coding it is a C struct). See the 
discussion of </a>syment in the section on Data Structures.
<BR><A NAME="932475">
<BR><A NAME="932825"> </a>DEFSTR: for the purposes of a program this is a collection of all the relevant information about a data type in a PDB file (in the actual coding it is a C struct). See the discussion of defstr in the section on Data Structures.
<BR><a name="932892">
<h2>3.3   </a>Function Summary</h2>
</a>
<a name="932904">
These routines form the </a>interface between C application programs and the PDBLib system.<p>
</a>
<A NAME="934994"><P><B></a>PD_append(file, name, var)
</B><BR><A NAME="934995"></a>Append the data pointed to by <em>var</em> to an existing entry under <em>name</em> in PDB file <em>file</em>.
<BR><dl>
<a name="935016">
<dt>Input:	<em>file</em>, a pointer to a PDBfile,
</a>
<a name="935017">
<dd><em>name</em>, an ASCII string containing the name of the variable in the PDB file and any dimension information,<P>
</a>
<a name="935020">
<dd><em>var</em>, a pointer to the location where the data is stored in memory.<P>
</a>
<a name="935021">
<dt>Output:	TRUE if successful, and NULL otherwise.
</a>
<A NAME="935018"><P><B></a>PD_append_alt(file, name, var, nd, ind)
</B><BR><A NAME="935022"></a>Append the data pointed to by <em>var</em> to an existing entry <em>name</em> in PDB file <em>file</em>. In this 
alternate to </a>PD_append dimension information is provided in arguments nd and ind.
<BR><a name="935024">
<dt>Input:	<em>file</em>, a pointer to a PDBfile,
</a>
<a name="935025">
<dd><em>name</em>, an ASCII string containing the name of the variable in the PDB file,<P>
</a>
<a name="935027">
<dd><em>var</em>, a pointer to the location where the data is stored in memory.<P>
</a>
<a name="935028">
<dd><em>nd</em>, an integer containing the number of dimensions,<P>
</a>
<a name="935029">
<dd><em>ind</em>, an array of long integers containing (min, max, stride) triples for each dimension.<P>
</a>
<a name="935031">
<dt>Output:	TRUE if successful, and NULL otherwise.
</a>
<A NAME="935032"><P><B></a>PD_append_as(file, name, intype, var)
</B><BR><A NAME="935033"></a>Append the data pointed to by <em>var</em> with type <em>intype</em> to an existing entry <em>name</em> in PDB 
file <em>file</em>.
<BR><a name="935034">
<dt>Input:	<em>file</em>, a pointer to a PDBfile,
</a>
<a name="935035">
<dd><em>name</em>, an ASCII string containing the name of the variable in the PDB file and any dimension information,<P>
</a>
<a name="935036">
<dd><em>intype</em>, an ASCII string containing the type of the data pointed to by var,<P>
</a>
<a name="935039">
<dd><em>var</em>, a pointer to the location where the data is stored in memory.<P>
</a>
<a name="935040">
<dt>Output:	TRUE if successful, and NULL otherwise.
</a>
<A NAME="935041"><P><B></a>PD_append_as_alt(file, name, intype, var, nd, ind)
</B><BR><A NAME="935042"></a>Append the data pointed to by <em>var</em> with type <em>intype</em> to the entry <em>name</em> in PDB file <em>file</em>. In 
this alternate to </a>PD_append_as dimension information is provided in arguments nd 
and ind.
<BR><a name="935044">
<dt>Input:	<em>file</em>, a pointer to a PDBfile,
</a>
<a name="935046">
<dd><em>name</em>, an ASCII string containing the name of the variable in the PDB file,<P>
</a>
<a name="935047">
<dd><em>intype</em>, an ASCII string containing the type of the data pointed to by var,<P>
</a>
<a name="935049">
<dd><em>var</em>, a pointer to the location where the data is stored in memory.<P>
</a>
<a name="935055">
<dd><em>nd</em>, an integer containing the number of dimensions,<P>
</a>
<a name="935056">
<dd><em>ind</em>, an array of long integers containing (min, max, stride) triples for each dimension.<P>
</a>
<a name="935057">
<dt>Output:	TRUE if successful, and NULL otherwise.
</a>
<A NAME="934665"><P><B></a>PD_cast(file, type, memb, contr)
</B><BR><A NAME="934673">This function tells PDBLib to </a>substitute the type specified by the ASCII string in the 
member <em>contr</em> for the type of member, <em>memb</em>, in the structure, <em>type</em>. 
<BR><a name="934678">
<dt>Input:	<em>file,</em> a pointer to a PDBfile,
</a>
<a name="934680">
<dd><em>	type</em>, an ASCII string containing the name of the data type in the PDB file,<P>
</a>
<a name="934682">
<dd><em>	memb</em>, an ASCII string containing the name of the member of t<em>ype</em> whose type is to be replaced,<P>
</a>
<a name="934684">
<dd>	contr, an ASCII string containing the name of the member of <em>type</em> whose ASCII string value is to replace the type of the member, <em>memb</em>.<P>
</a>
<a name="934686">
<dt>Output:	TRUE if successful, FALSE otherwise.
</a>
<A NAME="935288"><P><B></a>PD_cd(file, dirname)
</B><BR><A NAME="935289"></a>Change the </a>current </a>directory in file file to dirname. 
<BR><a name="935290">
<dt>Input:	<em>file,</em> a pointer to a PDBfile,
</a>
<a name="935291">
<dd><em>	dirname</em>, an ASCII string containing the path name of the directory to change to.<P>
</a>
<a name="935294">
<dt>Output:	TRUE if successful, FALSE otherwise.
</a>
<A NAME="932927"><P><B></a>PD_close(file)
</B><BR><A NAME="932930"></a>Close the <em>file</em> <em>file</em>. This function is used to complete and close a PDB file.
<BR><a name="932931">
<dt>Input:	<em>file</em>, a pointer to a PDBfile.
</a>
<a name="932932">
<dt>Output:	TRUE if successful, FALSE otherwise.
</a>
<A NAME="932482"><P><B></a>PD_def_attribute(file, attr, type)
</B><BR><A NAME="932881"></a>Define an attribute named <em>attr</em> of type <em>type</em> in PDB file <em>file</em>.
<BR><a name="932884">
<dt>Input:	<em>file</em>, a pointer to a PDBfile,
</a>
<a name="932891">
<dd><em>attr</em>, an ASCII string containing the name of the attribute to be added to the PDB file </a>attribute table,<P>
</a>
<a name="933097">
<dd><em>type</em>, an ASCII string containing the type of the attribute.<P>
</a>
<a name="933102">
<dt>Output:	TRUE if successful, FALSE otherwise.
</a>
<A NAME="932665"><P><B></a>PD_defent(file, name, outtype)
</B><BR><A NAME="932667"></a>Define an entry in the symbol table of the PDB file <em>file</em>. This function </a>reserves space on 
disk but writes no data. The data can be written with later PDBLib calls.
<BR><a name="932668">
<dt>Input:	<em>file</em>, a pointer to a PDBfile,
</a>
<a name="932669">
<dd>	name, an ASCII string containing the name of the variable and any dimensional information,<P>
</a>
<a name="932689">
<dd>	outtype, an ASCII string specifying the type of data in the file.<P>
</a>
<a name="932690">
<dt>Output:	a pointer to the syment for the entry, if successful, and NULL otherwise.
</a>
<A NAME="932592"><P><B></a>PD_defent_alt(file, name, outtype, nd, ind)
</B><BR><A NAME="932655"></a>Define an entry in the symbol table of the PDB file <em>file</em>. This function </a>reserves space on 
disk but writes no data. The data can be written with later calls.
<BR><a name="932656">
<dt>Input:	<em>file</em>, a pointer to a PDBfile,
</a>
<a name="932657">
<dd>	name, an ASCII string containing the name of the variable (no dimensional information can be supplied with the name),<P>
</a>
<a name="932658">
<dd>	outtype, an ASCII string specifying the type of data in the file,<P>
</a>
<a name="932659">
<dd>	nd, the number of dimensions of the entry,<P>
</a>
<a name="932660">
<dd>	find, an array of long integers containing (min, max) index range pairs for each dimension.<P>
</a>
<a name="932663">
<dt>Output:	a pointer to the syment for the entry, if successful, and NULL otherwise.
</a>
<A NAME="933112"><P><B></a>PD_defix(file, name, bytespitem, align, flg)
</B><BR><A NAME="933113"></a>Define a </a>primitive integral type (</a>fixed point type) in the PDB file <em>file</em>. 
<BR><a name="933114">
<dt>Input:	<em>file</em>, a pointer to a PDBfile,
</a>
<a name="933124">
<dd>	name, an ASCII string containing the name of the new data type,<P>
</a>
<a name="933125">
<dd>	bytespitem, the number of bytes required for 1 item of the new type,<P>
</a>
<a name="933128">
<dd>	align, the byte alignment for the type,<P>
</a>
<a name="933129">
<dd>	flg, a flag indicating whether the byte ordering of the type is normal or reverse ordered (</a>NORMAL_ORDER or </a>REVERSE_ORDER).<P>
</a>
<a name="933117">
<dt>Output:	a pointer to the defstr for the type, if successful, and NULL otherwise.
</a>
<A NAME="933119"><P><B></a>PD_defloat(file, name, bytespitem, align, ordr, expb, mantb, sbs, sbe, sbm, hmb, 
bias)
</B><BR><A NAME="933120"></a>Define a new </a>floating point type to the PDB file <em>file</em>.
<BR><a name="933121">
<dt>Input:	<em>file</em>, a pointer to a PDBfile,
</a>
<a name="933132">
<dd>	<em>name</em>, an ASCII string containing the name of the data type in the PDB file,<P>
</a>
<a name="933134">
<dd><em>	bytespitem, the number of bytes required for an item of the new type,</em><P>
</a>
<a name="933136">
<dd>	align, the byte alignment for this type,<P>
</a>
<a name="933137">
<dd>	ordr, an array of bytespitem integers specifying the byte order,<P>
</a>
<a name="933138">
<dd>	expb, the number of exponent bits,<P>
</a>
<a name="933140">
<dd>	mantb, the number of mantissa bits,<P>
</a>
<a name="933141">
<dd>	sbs, the position of the sign bit,<P>
</a>
<a name="933142">
<dd>	sbe, the starting bit of the exponent,<P>
</a>
<a name="933143">
<dd>	sbm, the starting bit of the mantissa,<P>
</a>
<a name="933144">
<dd>	hmb, the value of the high order mantissa bit,<P>
</a>
<a name="933145">
<dd>	bias, the bias of the exponent.<P>
</a>
<a name="933123">
<dt>Output:	a pointer to the defstr for the type, if successful, and NULL otherwise.
</a>
<A NAME="933552"><P><B></a>PD_defncv(file, name, bytespitem, align)
</B><BR><A NAME="933553"></a>Define a </a>primitive type that will not undergo format conversion from platform to platform in the PDB file <em>file</em>. 
<BR><a name="933556">
<dt>Input:	<em>file</em>, a pointer to a PDBfile,
</a>
<a name="933557">
<dd>	name, an ASCII string containing the name of the new data type,<P>
</a>
<a name="933558">
<dd>	bytespitem, the number of bytes required for 1 item of the new type,<P>
</a>
<a name="933560">
<dd>	align, the byte alignment for the type.<P>
</a>
<a name="933561">
<dt>Output:	a pointer to the defstr for the type, if successful, and NULL otherwise.
</a>
<A NAME="933332"><P><B></a>PD_defstr(file, name, mem1, ..., memn, LAST)
</B><BR><A NAME="933847"></a>Define a </a>data structure called <em>name</em> with members <em>mem</em>1, ..., <em>mem</em>n. LAST <em>must</em> terminate the list of members. This uses a C-like syntax for the member definition and <em>name</em> 
is used in subsequent writes to refer to this type of data structure.
<BR><a name="933908">
<dt>Input:	<em>file</em>, a pointer to a PDBfile,
</a>
<a name="933928">
<dd>	<em>name</em>, an ASCII string containing the name of the data structure type in the PDB file,<P>
</a>
<a name="933961">
<dd><em>memi</em>, an ASCII string representing the declaration of a member of a data structure.<P>
</a>
<a name="933974">
<dt>Output:	a pointer to the defstr for the data structure, if successful, and NULL otherwise.
</a>
<A NAME="932936"><P><B></a>PD_defstr_alt(file, name, nmemb, memb)
</B><BR><A NAME="932942"></a>Define a </a>data structure called <em>name</em> with members specified by memb.. This uses a C-
like syntax for the member definition and <em>name</em> is used in subsequent writes to refer to 
this type of data structure.
<BR><a name="932943">
<dt>Input:	<em>file</em>, a pointer to a PDBfile,
</a>
<a name="932947">
<dd><em>name</em>, an ASCII string containing the name of the data structure type in the PDB file,<P>
</a>
<a name="934021">
<dd><em>nmemb</em>, an integer number of members in the data structure and the length of memb,<P>
</a>
<a name="932949">
<dd><em>memb</em>, an array of ASCII string representing the declarations of the members of a data structure.<P>
</a>
<a name="932951">
<dt>Output:	a pointer to the defstr for the data structure, if successful, and NULL otherwise.
</a>
<A NAME="932621"><P><B></a>PD_family(file, flag)
</B><BR><A NAME="934719">If the <em>file,</em> <em>file</em>, has exceeded its size limit, open and return a new member of the </a>file 
family. If flag is TRUE close the old file.
<BR><a name="934768">
<dt>Input:	<em>file</em>, a pointer to a PDBfile.
</a>
<a name="937456">
<dd>flag, an integer flag.<P>
</a>
<a name="937477">
<dt>Output:	a pointer to a PDBfile.
</a>
<A NAME="937434"><P><B></a>PD_flush(file)
</B><BR><A NAME="937436"></a>Flush the <em>file</em> <em>file</em>. This function is used to write the descriptive information of a PDB 
file to disk.
<BR><a name="934296">
<dt>Input:	<em>file</em>, a pointer to a PDBfile.
</a>
<a name="934297">
<dt>Output:	TRUE if successful, FALSE otherwise.
</a>
<A NAME="933103"><P><B></a>PD_get_attribute(file, var, attr)
</B><BR><A NAME="933107">Get the value of the <em>attr</em> attribute of variable <em>var</em> in PDB file <em>file</em>. Variables only have 
values for attributes which are explicitly given.
<BR><a name="933110">
<dt>Input:	<em>file</em>, a pointer to a PDBfile,
</a>
<a name="933111">
<dd><em>var</em>, an ASCII string containing the name of the variable in the PDB file,<P>
</a>
<a name="933115">
<dd><em>attr</em>, an ASCII string containing the name of the attribute in the PDB file attribute table.<P>
</a>
<a name="933116">
<dt>Output:	a pointer to the attribute value, if successful, and NULL otherwise.
</a>
<A NAME="937491"><P><B><strong></a>PD_get_max_file_size(file)
</strong></B><BR><a name="937492">
<dt>Get the current maximum size for PDB file <em>file</em>.
</a>
<a name="937493">
<dt>Input:	<em>file</em>, a pointer to a <strong>PDBfile</strong>.
</a>
<a name="937494">
<dt>Output:	Return the integer value of the current maximum file size.
</a>
<A NAME="932761"><P><B></a>PD_get_mode(file)
</B><BR><A NAME="932769"></a>Get the current mode of PDB file<em> file</em>: 2 (append - &#146;a&#146;), 3 (open - &#146;r&#146;), 4 (create - &#146;w&#146;).
<BR><a name="932798">
<dt>Input:	<em>file</em>, a pointer to a PDBfile.
</a>
<a name="933127">
<dt>Output:	Return the integer value of the current mode.
</a>
<A NAME="933266"><P><B></a>PD_get_offset(file)
</B><BR><A NAME="934191"></a>Get the current default offset for PDB file<em> file</em>.
<BR><a name="934192">
<dt>Input:	<em>file</em>, a pointer to a PDBfile.
</a>
<a name="934193">
<dt>Output:	Return the integer value of the default offset.
</a>
<A NAME="935292"><P><B></a>PD_ln(file, var, link)
</B><BR><A NAME="935293"></a>Create a </a>link to a variable in PDB file file. 
<BR><a name="935296">
<dt>Input:	<em>file,</em> a pointer to a PDBfile,
</a>
<a name="935299">
<dd><em>	var</em>, an ASCII string containing the path name of the variable to link to,<P>
</a>
<a name="935297">
<dd><em>	link</em>, an ASCII string containing the path name of the link.<P>
</a>
<a name="935298">
<dt>Output:	TRUE if successful, FALSE otherwise.
</a>
<A NAME="934172"><P><B></a>PD_ls(file, path, type, num)
</B><BR><A NAME="935304"></a>Return a list of names of entries (variables and/or directories) in PDB file file that are of 
a type type and that are in the </a>directory and match the variable name pattern specified 
by path. 
<BR><a name="935305">
<dt>Input:	<em>file,</em> a pointer to a PDBfile,
</a>
<a name="935307">
<dd><em>	path</em>, an ASCII string containing the path name of the directory to search and/or the variable name pattern to match,<P>
</a>
<a name="935308">
<dd><em>	type</em>, an ASCII string containing the type of variables to return,<P>
</a>
<a name="935309">
<dd><em>	num</em>, the number of entries returned.<P>
</a>
<a name="935311">
<dt>Output:	a pointer to an array of pointers to entry names, if successful, and NULL otherwise.
</a>
<A NAME="935312"><P><B></a>PD_make_image(name, type, data, dx, dy, bpp, xmin, xmax, ymin, ymax, zmin, 
zmax)
</B><BR><A NAME="932955">Create and initialize a PD_image data structure.
<BR><a name="932480">
<dt>Input: <em>	name</em>, an ASCII string containing the name of the image,
</a>
<a name="934173">
<dd>type, an ASCII string containing the data type of the image elements (e.g. &#147;char&#148;, &#147;float&#148;, &#147;complex&#148;),<P>
</a>
<a name="934176">
<dd>data, pointer to array of image data of type type,<P>
</a>
<a name="934177">
<dd>dx, width of image,<P>
</a>
<a name="934178">
<dd>dy, height of image,<P>
</a>
<a name="934179">
<dd>bpp, bits per pixel of the image,<P>
</a>
<a name="934180">
<dd>xmin, minimum value of coordinate associated with image x direction,<P>
</a>
<a name="934181">
<dd>xmax, maximum value of coordinate associated with image x direction,<P>
</a>
<a name="934182">
<dd>ymin, minimum value of coordinate associated with image y direction,<P>
</a>
<a name="934183">
<dd>ymax, maximum value of coordinate associated with image y direction,<P>
</a>
<a name="932961">
<dd>zmin, minimum value of image data (for palette labelling),<P>
</a>
<a name="932965">
<dd><em>zmax</em>, maximum value of image data (for palette labelling).<P>
</a>
<a name="932967">
<dt>Output:	a pointer to a PD_image.
</a>
<A NAME="935313"><P><B></a>PD_mkdir(file, dirname)
</B><BR><A NAME="935315"></a>Create a </a>directory dirname in PDB file file. 
<BR><a name="935317">
<dt>Input:	<em>file,</em> a pointer to a PDBfile,
</a>
<a name="933186">
<dd><em>	dirname</em>, an ASCII string containing the new directory path name.<P>
</a>
<a name="935320">
<dt>Output:	TRUE if successful, FALSE otherwise.
</a>
<A NAME="935319"><P><B>PD_open(filename, mode)
</B><BR><A NAME="934168"> </a>Open a PDB file on disk named <em>filename</em> in one of three modes: &#147;</a>w&#148; for </a>create, &#147;</a>r&#148; for 
</a>read-only, or &#147;a&#148; for </a>append. This function is used to </a>create a new PDB file or to open 
an existing PDB file for reading or for adding new entries.
<BR><a name="934169">
<dt>Input: <em>	filename</em>, an ASCII string,
</a>
<a name="934170">
<dd><em>mode</em>, an ASCII string, either &#147;w&#148; for create, &#147;r&#148; for read, or &#147;a&#148; for append.<P>
</a>
<a name="934171">
<dt>Output:	a pointer to a PDBfile, if successful, and NULL otherwise.
</a>
<A NAME="932972"><P><B></a>PD_put_image(file, image, index)
</B><BR><A NAME="932974"></a>Write image image to file file with index index.
<BR><a name="932975">
<dt>Input:	<em>file</em>, a pointer to a PDBfile,
</a>
<a name="932979">
<dd><em>image</em>, a pointer to the </a>image data structure to be written,<P>
</a>
<a name="932980">
<dd><em>index</em>, an unique integer ordinal index.<P>
</a>
<a name="932982">
<dt>Output:	TRUE if successful, FALSE otherwise.
</a>
<A NAME="933159"><P><B></a>PD_put_mapping(file, mapping, index)
</B><BR><A NAME="933163"></a>Write mapping mapping to file file with index index.
<BR><a name="933164">
<dt>Input:	<em>file</em>, a pointer to a PDBfile,
</a>
<a name="933168">
<dd><em>mapping</em>, a pointer to the </a>mapping data structure to be written,<P>
</a>
<a name="933170">
<dd><em>index</em>, an unique integer ordinal index.<P>
</a>
<a name="933174">
<dt>Output:	TRUE if successful, FALSE otherwise.
</a>
<A NAME="933179"><P><B></a>PD_put_set(file, set)
</B><BR><A NAME="933180"></a>Write set set to file file.
<BR><a name="933184">
<dt>Input:	<em>file</em>, a pointer to a PDBfile,
</a>
<a name="933188">
<dd><em>set</em>, a pointer to the </a>set data structure to be written.<P>
</a>
<a name="933190">
<dt>Output:	TRUE if successful, FALSE otherwise.
</a>
<A NAME="935300"><P><B></a>PD_pwd(file)
</B><BR><A NAME="935301"></a>Return the </a>current </a>directory in PDB file file. 
<BR><a name="935302">
<dt>Input:	<em>file,</em> a pointer to a PDBfile.
</a>
<a name="935306">
<dt>Output	a pointer to the path name of the current directory, if successful, and NULL otherwise.
</a>
<A NAME="934162"><P><B></a>PD_read(file, name, var)
</B><BR><A NAME="934163"></a>Read a variable <em>name</em> from PDB file <em>file</em> and put it in <em>var</em>.
<BR><a name="934164">
<dt>Input:	<em>file</em>, a pointer to a PDBfile,
</a>
<a name="934165">
<dd><em>name</em>, an ASCII string containing the name of the variable in the PDB file,<P>
</a>
<a name="934166">
<dd><em>var</em>, a pointer to the location where the data is to be placed.<P>
</a>
<a name="934167">
<dt>Output:	TRUE if successful, FALSE otherwise.
</a>
<A NAME="932506"><P><B></a>PD_read_alt(file, name, var, ind)
</B><BR><A NAME="932508"></a>Read part of a variable <em>name</em> from PDB file <em>file</em> and put it in <em>var</em>.
<BR><a name="932509">
<dt>Input:	<em>file</em>, a pointer to a PDBfile,
</a>
<a name="932510">
<dd><em>name</em>, an ASCII string containing the name of the variable in the PDB file,<P>
</a>
<a name="932512">
<dd><em>var</em>, a pointer to the location where the data is to be placed.<P>
</a>
<a name="932513">
<dd><em>ind</em>, an array of integer triples specifying a start, stop, and step index for each dimension of the entry.<P>
</a>
<a name="932644">
<dt>Output:	TRUE if successful, FALSE otherwise.
</a>
<A NAME="933100"><P><B></a>PD_read_as(file, name, type, var)
</B><BR><A NAME="933101"></a>Read a variable <em>name</em> from PDB file <em>file</em> and put it in <em>var</em> as data of type type.
<BR><a name="933104">
<dt>Input:	<em>file</em>, a pointer to a PDBfile,
</a>
<a name="933105">
<dd><em>name</em>, an ASCII string containing the name of the variable in the PDB file,<P>
</a>
<a name="933109">
<dd><em>type</em>, an ASCII string containing the type of the data desired,<P>
</a>
<a name="933106">
<dd><em>var</em>, a pointer to the location where the data is to be placed.<P>
</a>
<a name="933108">
<dt>Output:	TRUE if successful, FALSE otherwise.
</a>
<A NAME="932514"><P><B></a>PD_read_as_alt(file, name, type, var, ind)
</B><BR><A NAME="932515"></a>Read part of a variable <em>name</em> from PDB file <em>file</em> and put it in <em>var</em> as data of type type.
<BR><a name="932517">
<dt>Input:	<em>file</em>, a pointer to a PDBfile,
</a>
<a name="932518">
<dd><em>name</em>, an ASCII string containing the name of the variable in the PDB file,<P>
</a>
<a name="932519">
<dd><em>type</em>, an ASCII string containing the type of the data desired,<P>
</a>
<a name="932520">
<dd><em>var</em>, a pointer to the location where the data is to be placed.<P>
</a>
<a name="932643">
<dd><em>ind</em>, an array of integer triples specifying a start, stop, and step index for each dimension of the entry.<P>
</a>
<a name="932647">
<dt>Output:	TRUE if successful, FALSE otherwise.
</a>
<A NAME="933118"><P><B></a>PD_rel_image(image)
</B><BR><A NAME="933122">Release the space associated with a PD_image data structure.
<BR><a name="933126">
<dt>Input:	<em>image, a pointer to a PD_image.</em>
</a>
<a name="933131">
<dt>Output:	None.
</a>
<A NAME="936739"><P><B></a>PD_rem_attribute(file, attr)
</B><BR><A NAME="936793"></a>Remove an attribute named attr from the attribute table in PDB file <em>file</em>. All attribute 
values are removed simultaneously with the attribute.
<BR><a name="936800">
<dt>Input:	<em>file</em>, a pointer to a PDBfile,
</a>
<a name="936818">
<dd><em>attr</em>, an ASCII string containing the name of the attribute in the PDB file attribute table.<P>
</a>
<a name="936819">
<dt>Output:	TRUE if successful, FALSE otherwise.
</a>
<A NAME="934184"><P><B></a>PD_reset_ptr_list(file)
</B><BR><a name="934185">
Free the list of pointers which the PDB file <em>file</em> knows about. This includes both pointers in memory acquired during write operations and pointers in the file acquired during read operations.<p>
</a>
<a name="934187">
<dt>Input:	<em>file</em>, a pointer to a PDBfile,
</a>
<a name="934189">
<dt>Output:	TRUE if successful, FALSE otherwise.
</a>
<A NAME="933133"><P><B></a>PD_set_attribute(file, var, attr, val)
</B><BR><A NAME="933135"></a>Set the value of an attribute attr of the <em>var</em> in PDB file <em>file</em> to <em>val</em>. Variables can be added 
to PDB files solely for their attributes; that is, <em>var</em> need not be a variable in <em>file</em>.
<BR><a name="933139">
<dt>Input:	<em>file</em>, a pointer to a PDBfile,
</a>
<a name="933146">
<dd><em>var</em>, an ASCII string containing the name of the variable in the PDB file,<P>
</a>
<a name="933147">
<dd><em>attr</em>, an ASCII string containing the name of the attribute in the PDB file attribute table,<P>
</a>
<a name="933151">
<dd><em>val</em>, a pointer to the value of the attribute <em>attr</em> to be associated with <em>var</em>.<P>
</a>
<a name="933153">
<dt>Output:	TRUE if successful, FALSE otherwise.
</a>
<A NAME="934194"><P><B></a>PD_set_max_file_size(file, v)
</B><BR><a name="937508">
<dt>Set the maximum size for PDB file <em>file</em>.
</a>
<a name="937531">
<dt>Input:	<em>file</em>, a pointer to a PDBfile.
</a>
<a name="937536">
<dd><em>v</em>, an integer value for the maximum file size<P>
</a>
<a name="937532">
<dt>Output:	Return the new integer value of the maximum file size.
</a>
<A NAME="937560"><P><B></a>PD_set_offset(file, v)
</B><BR><A NAME="937562"></a>Set the default offset for PDB file<em> file</em>.
<BR><a name="937563">
<dt>Input:	<em>file</em>, a pointer to a PDBfile,
</a>
<a name="934220">
<dd>v, an integer value for the default offset.<P>
</a>
<a name="934199">
<dt>Output:	Return the new integer value of the default offset.
</a>
<A NAME="933025"><P><B></a>PD_target(std, align)
</B><BR><A NAME="933029">Set up the next PDB file as if written by a machine of type defined by the given 
</a>data_standard and </a>data_alignment information. This <em>function must</em> be called before 
the </a><em>PD_open</em> call which creates the file.
<BR><a name="933030">
<dt>Input:	<em>std</em>, a pointer to a data_standard structure,
</a>
<a name="933033">
<dd><em>align</em>, a pointer to a data_alignment structure.<P>
</a>
<a name="933036">
<dt>Output:	TRUE if successful, FALSE otherwise.
</a>
<A NAME="933548"><P><B></a>PD_typedef(file, oname, tname)
</B><BR><A NAME="933549"></a>Define an alias for an existing type in the specified file.
<BR><a name="933550">
<dt>Input:	<em>file</em>, a pointer to a PDBfile,
</a>
<a name="933551">
<dd>	oname, an ASCII string containing the name of the old data type,<P>
</a>
<a name="933554">
<dd>	tname, an ASCII string containing the name of the new data type.<P>
</a>
<a name="933555">
<dt>Output:	a pointer to the defstr for the type, if successful, and NULL otherwise.
</a>
<A NAME="932481"><P><B></a>PD_write(file, name, type, var)
</B><BR><A NAME="933080"></a>Write the data pointed to by <em>var</em> under <em>name</em> and with <em>type</em> to PDB file <em>file</em>.
<BR><a name="933084">
<dt>Input:	<em>file</em>, a pointer to a PDBfile,
</a>
<a name="933088">
<dd><em>name</em>, an ASCII string containing the name of the variable in the PDB file,<P>
</a>
<a name="933089">
<dd><em>type</em>, an ASCII string containing the type of the variable,<P>
</a>
<a name="933091">
<dd><em>var</em>, a pointer to the location where the data is stored in memory.<P>
</a>
<a name="933093">
<dt>Output:	TRUE if successful, and NULL otherwise.
</a>
<A NAME="933315"><P><B></a>PD_write_alt(file, name, type, var, nd, ind)
</B><BR><A NAME="933316"></a>Write the data pointed to by <em>var</em> under <em>name</em> and with <em>type</em> to PDB file <em>file</em>. In this alternate to </a>PD_write </a>dimension information is provided in arguments nd and ind.
<BR><a name="933317">
<dt>Input:	<em>file</em>, a pointer to a PDBfile,
</a>
<a name="933318">
<dd><em>name</em>, an ASCII string containing the name of the variable in the PDB file,<P>
</a>
<a name="933594">
<dd><em>type</em>, an ASCII string containing the type of the variable,<P>
</a>
<a name="933595">
<dd><em>var</em>, a pointer to the location where the data is stored in memory.<P>
</a>
<a name="933598">
<dd><em>nd</em>, an integer containing the number of dimensions,<P>
</a>
<a name="933599">
<dd><em>ind</em>, an array of long integers containing (min, max, stride) triples for each dimension.<P>
</a>
<a name="933596">
<dt>Output:	TRUE if successful, and NULL otherwise.
</a>
<A NAME="933130"><P><B></a>PD_write_as(file, name, intype, outtype, var)
</B><BR><A NAME="933148"></a>Write the data pointed to by <em>var</em> under <em>name</em> and with <em>intype</em> to PDB file <em>file</em> as data of 
outtype.
<BR><a name="933149">
<dt>Input:	<em>file</em>, a pointer to a PDBfile,
</a>
<a name="933150">
<dd><em>name</em>, an ASCII string containing the name of the variable in the PDB file,<P>
</a>
<a name="933152">
<dd><em>intype</em>, an ASCII string containing the type of the variable,<P>
</a>
<a name="933154">
<dd><em>outtype</em>, an ASCII string containing the output type of the variable,<P>
</a>
<a name="933155">
<dd><em>var</em>, a pointer to the location where the data is stored in memory.<P>
</a>
<a name="933156">
<dt>Output:	TRUE if successful, and NULL otherwise.
</a>
<A NAME="933600"><P><B></a>PD_write_as_alt(file, name, intype, outtype, var, nd, ind)
</B><BR><A NAME="933601"></a>Write the data pointed to by <em>var</em> under <em>name</em> and with <em>intype</em> to PDB file <em>file</em> as data of 
outtype. In this alternate to </a>PD_write_as </a>dimension information is provided in arguments nd and ind.
<BR><a name="933602">
<dt>Input:	<em>file</em>, a pointer to a PDBfile,
</a>
<a name="933603">
<dd><em>name</em>, an ASCII string containing the name of the variable in the PDB file,<P>
</a>
<a name="933604">
<dd><em>intype</em>, an ASCII string containing the type of the variable,<P>
</a>
<a name="933606">
<dd><em>outtype</em>, an ASCII string containing the output type of the variable,<P>
</a>
<a name="933607">
<dd><em>var</em>, a pointer to the location where the data is stored in memory.<P>
</a>
<a name="933609">
<dd><em>nd</em>, an integer containing the number of dimensions,<P>
</a>
<a name="933610">
<dd><em>ind</em>, an array of long integers containing (min, max, stride) triples for each dimension.<P>
</a>
<a name="933608">
<dt>Output:	TRUE if successful, and NULL otherwise.
</a>
</dl>
<a name="933564">
<h1>4.0   The </a>C </a>API</h1>
</a>
<a name="933568">
In this section a more </a>formal description of the C API for PDBLib is given including a more detailed account of their workings.<p>
</a>
<a name="933015">
<h2>4.1   PD_APPEND</h2>
</a>
<A NAME="933016"><PRE><B>
</B></PRE><A NAME="933018"><PRE><B>int </a>PD_append(PDBfile *file
</B></PRE><A NAME="933019"><PRE><B>              char *name,
</B></PRE><A NAME="933021"><PRE><B>              void *vr)
</B></PRE><a name="933059">
</a>Append data to an entry in the specified file. The type is assumed to be the same as for the original entry. The dimensions of the appended data are specified in name. They must match the original entry except for the most slowly varying one. The specification of the most slowly varying dimension must be one of the following:<p>
</a>
<dl>
<a name="934730">
<dt>min:max		 =&gt; new dimension is old_min:old_max+(max-min+1)
</a>
<a name="934732">
<dt>		 if min is the default_offset for the file
</a>
<a name="934733">
<dt>		or
</a>
<a name="934735">
<dt>min:max		 =&gt; new dimension is old_min:max
</a>
<a name="935249">
<dt>		if min is old_max+1
</a>
<a name="933065">
The rationale for this function is that some data sets are of unknown size until they are completely written. PDBLib permits any entry to reside in </a>discontiguous blocks of disk space. The library is responsible for reading and writing data correctly across these blocks.<p>
</a>
<a name="933066">
The shape or dimensional information of the entry is a part of the name string. In this respect </a>PD_append behaves just like </a>PD_write.<p>
</a>
<a name="933070">
Input to this function is: <em>file</em>, a pointer to a PDBfile, name, an ASCII string containing the name of the variable and any dimensional information, and vr, a pointer to the data to be appended.<p>
</a>
<a name="933071">
This function returns TRUE, if successful; otherwise, FALSE.<p>
</a>
<a name="933073">
See also </a>PD_append_alt, </a>PD_append_as, </a>PD_append_as_alt, </a>PD_defent, </a>PD_defent_alt, </a>PD_write, </a>PD_write_alt, </a>PD_write_as, </a>PD_write_as_alt.<p>
</a>
<a name="933074">
<p>
</a>
<A NAME="933639"><PRE><B>int </a>PD_append(PDBfile *file
</B></PRE><A NAME="933682"><PRE><B>              char *name,
</B></PRE><A NAME="933684"><PRE><B>              void *vr)
</B></PRE><A NAME="933198"><B>
</B><HR><A NAME="933199"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="933202"><PRE> 
</PRE><A NAME="933203"><PRE>     PDBfile *file;
</PRE><A NAME="933076"><PRE>     float *fv;
</PRE><A NAME="933205"><PRE> 
</PRE><A NAME="933206"><PRE>           .
</PRE><A NAME="933208"><PRE>           .
</PRE><A NAME="933630"><PRE>           .
</PRE><A NAME="933631"><PRE>     if (</a>PD_append(file, &#147;x(20)&#148;, fv)) == FALSE)
</PRE><A NAME="933632"><PRE>        printf(&#147;%s&#148;, PD_err);
</PRE><A NAME="933634"><PRE>           .
</PRE><A NAME="933636"><PRE>           .
</PRE><A NAME="933637"><PRE>           .
</PRE><a name="933638">
Compare this with the example of </a>PD_write.<p>
</a>
</dl>
<a name="933177">
<h2>4.2   PD_APPEND_ALT</h2>
</a>
<A NAME="933194"><PRE><B>
</B></PRE><A NAME="934356"><PRE><B>int </a>PD_append_alt(PDBfile *file
</B></PRE><A NAME="934357"><PRE><B>                  char *name,
</B></PRE><A NAME="934358"><PRE><B>                  void *vr,
</B></PRE><A NAME="934359"><PRE><B>                  int nd,
</B></PRE><A NAME="934360"><PRE><B>                  long *ind)
</B></PRE><a name="934061">
</a>Append data to an entry in the specified file. The type is assumed to be the same as for the original entry. The dimensions of the appended data are specified in the ind array. They must match the original entry except for the most slowly varying one. The specification of the most slowly varying dimension must be one of the following;<p>
</a>
<dl>
<a name="933642">
<dt>min:max	:stride	 =&gt; new dimension is old_min:old_max+(max-min+1)
</a>
<a name="933643">
<dt>		 if min is the default_offset for the file
</a>
<a name="933644">
<dt>		or
</a>
<a name="933645">
<dt>min:max	:stride	 =&gt; new dimension is old_min:max
</a>
<a name="935250">
<dt>		if min is old_max+1
</a>
<a name="934067">
The rationale for this function is that some data sets are of unknown size until they are completely written. PDBLib permits any entry to reside in </a>discontiguous blocks of disk space. The library is responsible for reading and writing data correctly across these blocks.<p>
</a>
<a name="934069">
Input to this function is: <em>file</em>, a pointer to a PDBfile, name, an ASCII string containing the name of the variable; vr, a pointer to the data to be appended; nd, an integer number of dimensions; and ind, an array of longs with triples (start, stop, step) defining dimension information.<p>
</a>
<a name="934070">
This function returns TRUE, if successful; otherwise, FALSE.<p>
</a>
<a name="934330">
See also </a>PD_append, </a>PD_append_as, </a>PD_append_as_alt, </a>PD_defent, </a>PD_defent_alt, </a>PD_write, </a>PD_write_alt, </a>PD_write_as, </a>PD_write_as_alt.<p>
</a>
<a name="934331">
<p>
</a>
<A NAME="934332"><PRE><B>int </a>PD_append_alt(PDBfile *file
</B></PRE><A NAME="934333"><PRE><B>                  char *name,
</B></PRE><A NAME="934334"><PRE><B>                  void *vr,
</B></PRE><A NAME="934354"><PRE><B>                  int nd,
</B></PRE><A NAME="934355"><PRE><B>                  long *ind)
</B></PRE><A NAME="934335"><B>
</B><HR><A NAME="934336"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="934337"><PRE> 
</PRE><A NAME="934338"><PRE>     PDBfile *file;
</PRE><A NAME="934339"><PRE>     float *fv;
</PRE><A NAME="934350"><PRE>     long ind[3]
</PRE><A NAME="934340"><PRE> 
</PRE><A NAME="934341"><PRE>           .
</PRE><A NAME="934342"><PRE>           .
</PRE><A NAME="934343"><PRE>           .
</PRE><A NAME="934344"><PRE>     ind[0] = 0L;
</PRE><A NAME="934352"><PRE>     ind[1] = 20L;
</PRE><A NAME="934353"><PRE>     ind[2] = 1L;
</PRE><A NAME="934351"><PRE>     if (</a>PD_append_alt(file, &#147;x&#148;, fv, 1, ind)) == FALSE)
</PRE><A NAME="934345"><PRE>        printf(&#147;%s&#148;, PD_err);
</PRE><A NAME="934346"><PRE>           .
</PRE><A NAME="934347"><PRE>           .
</PRE><A NAME="934348"><PRE>           .
</PRE><a name="934349">
Compare this with the example of </a>PD_write_alt.<p>
</a>
</dl>
<a name="933204">
<h2>4.3   PD_APPEND_AS</h2>
</a>
<A NAME="933685"><PRE><B>
</B></PRE><A NAME="933687"><PRE><B>int </a>PD_append_as(PDBfile *file
</B></PRE><A NAME="934361"><PRE><B>                 char *name,
</B></PRE><A NAME="934436"><PRE><B>                 char *intype,
</B></PRE><A NAME="934362"><PRE><B>                 void *vr)
</B></PRE><a name="934363">
</a>Append data to an entry in the specified file. The output type is assumed to be the same as for the original entry. The dimensions of the appended data are specified in the name. They must match the original entry except for the most slowly varying one. The specification of the most slowly varying dimension must be one of the following;<p>
</a>
<dl>
<a name="934063">
<dt>min:max		 =&gt; new dimension is old_min:old_max+(max-min+1)
</a>
<a name="934064">
<dt>		 if min is the default_offset for the file
</a>
<a name="934065">
<dt>		or
</a>
<a name="934066">
<dt>min:max		 =&gt; new dimension is old_min:max
</a>
<a name="935251">
<dt>		if min is old_max+1
</a>
<a name="934369">
The rationale for this function is that some data sets are of unknown size until they are completely written. PDBLib permits any entry to reside in </a>discontiguous blocks of disk space. The library is responsible for reading and writing data correctly across these blocks.<p>
</a>
<a name="934370">
The shape or dimensional information of the entry is a part of the name string. In this respect</a> PD_append_as behaves just like </a>PD_write_as.<p>
</a>
<a name="934371">
Input to this function is: <em>file</em>, a pointer to a PDBfile, name, an ASCII string containing the name of the variable and any dimensional information, intype, an ASCII string specifying the type of the data to which vr points; and vr, a pointer to the data to be appended.<p>
</a>
<a name="934372">
This function returns TRUE, if successful; otherwise, FALSE.<p>
</a>
<a name="934373">
See also </a>PD_append, </a>PD_append_alt, </a>PD_append_as_alt, </a>PD_defent, </a>PD_defent_alt, </a>PD_write, </a>PD_write_alt, </a>PD_write_as, </a>PD_write_as_alt.<p>
</a>
<a name="934374">
<p>
</a>
<A NAME="934437"><PRE><B>int </a>PD_append_as(PDBfile *file
</B></PRE><A NAME="934438"><PRE><B>                 char *name,
</B></PRE><A NAME="934439"><PRE><B>                 char *intype,
</B></PRE><A NAME="934440"><PRE><B>                 void *vr)
</B></PRE><A NAME="934378"><B>
</B><HR><A NAME="934379"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="934380"><PRE> 
</PRE><A NAME="934381"><PRE>     PDBfile *file;
</PRE><A NAME="934382"><PRE>     double *dv;
</PRE><A NAME="934383"><PRE> 
</PRE><A NAME="934384"><PRE>           .
</PRE><A NAME="934385"><PRE>           .
</PRE><A NAME="934386"><PRE>           .
</PRE><A NAME="934387"><PRE>     if (</a>PD_append_as(file, &#147;x(20)&#148;, &#147;float&#148;, dv)) == FALSE)
</PRE><A NAME="934388"><PRE>        printf(&#147;%s&#148;, PD_err);
</PRE><A NAME="934389"><PRE>           .
</PRE><A NAME="934390"><PRE>           .
</PRE><A NAME="934391"><PRE>           .
</PRE><a name="934392">
Compare this with the example of </a>PD_write_as.<p>
</a>
</dl>
<a name="934393">
<h2>4.4   PD_APPEND_AS_ALT</h2>
</a>
<A NAME="934394"><PRE><B>
</B></PRE><A NAME="934395"><PRE><B>int PD_append_as_alt(PDBfile *file
</B></PRE><A NAME="934396"><PRE><B>                     char *name,
</B></PRE><A NAME="934375"><PRE><B>                     char *intype,
</B></PRE><A NAME="934397"><PRE><B>                     void *vr,
</B></PRE><A NAME="934398"><PRE><B>                     int nd,
</B></PRE><A NAME="934399"><PRE><B>                     long *ind)
</B></PRE><a name="934400">
</a>Append data to an entry in the specified file. The output type is assumed to be the same as for the original entry. The dimensions of the appended data are specified in the ind array. They must match the original entry except for the most slowly varying one. The specification of the most slowly varying dimension must be one of the following;<p>
</a>
<dl>
<a name="934365">
<dt>min:max	:stride	 =&gt; new dimension is old_min:old_max+(max-min+1)
</a>
<a name="934366">
<dt>		 if min is the default_offset for the file
</a>
<a name="934367">
<dt>		or
</a>
<a name="934368">
<dt>min:max	:stride	 =&gt; new dimension is old_min:max
</a>
<a name="935252">
<dt>		if min is old_max+1
</a>
<a name="934406">
The rationale for this function is that some data sets are of unknown size until they are completely written. PDBLib permits any entry to reside in </a>discontiguous blocks of disk space. The library is responsible for reading and writing data correctly across these blocks.<p>
</a>
<a name="934408">
Input to this function is: <em>file</em>, a pointer to a PDBfile, name, an ASCII string containing the name of the variable; intype, an ASCII string specifying the type of data to which vr points; vr, a pointer to the data to be appended; nd, an integer number of dimensions; and ind, an array of longs with triples (start, stop, step) defining dimension information.<p>
</a>
<a name="934409">
This function returns TRUE, if successful; otherwise, FALSE.<p>
</a>
<a name="934410">
See also </a>PD_append, </a>PD_append_alt, </a>PD_append_as, </a>PD_defent, </a>PD_defent_alt, </a>PD_write, </a>PD_write_alt, </a>PD_write_as, </a>PD_write_as_alt.<p>
</a>
<a name="934411">
<p>
</a>
<A NAME="934376"><PRE><B>int PD_append_as_alt(PDBfile *file
</B></PRE><A NAME="934377"><PRE><B>                     char *name,
</B></PRE><A NAME="934441"><PRE><B>                     char *intype,
</B></PRE><A NAME="934442"><PRE><B>                     void *vr,
</B></PRE><A NAME="934443"><PRE><B>                     int nd,
</B></PRE><A NAME="934444"><PRE><B>                     long *ind)
</B></PRE><A NAME="934417"><B>
</B><HR><A NAME="934418"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="934419"><PRE> 
</PRE><A NAME="934420"><PRE>     PDBfile *file;
</PRE><A NAME="934421"><PRE>     float *fv;
</PRE><A NAME="934422"><PRE>     long ind[3]
</PRE><A NAME="934423"><PRE> 
</PRE><A NAME="934424"><PRE>           .
</PRE><A NAME="934425"><PRE>           .
</PRE><A NAME="934426"><PRE>           .
</PRE><A NAME="934427"><PRE>     ind[0] = 0L;
</PRE><A NAME="934428"><PRE>     ind[1] = 20L;
</PRE><A NAME="934429"><PRE>     ind[2] = 1L;
</PRE><A NAME="934430"><PRE>     if (</a>PD_append_as_alt(file, &#147;x&#148;, &#147;double&#148;, fv, 1, ind)) == FALSE)
</PRE><A NAME="934431"><PRE>        printf(&#147;%s&#148;, PD_err);
</PRE><A NAME="934432"><PRE>           .
</PRE><A NAME="934433"><PRE>           .
</PRE><A NAME="934434"><PRE>           .
</PRE><a name="934435">
Compare this with the example of </a>PD_write_as_alt.<p>
</a>
</dl>
<a name="933597">
<h2>4.5   PD_CAST</h2>
</a>
<A NAME="932614"><PRE><B>
</B></PRE><A NAME="932613"><PRE><B>int </a>PD_cast(PDBfile *file,
</B></PRE><A NAME="932579"><PRE><B>            char *type,
</B></PRE><A NAME="932611"><PRE><B>            char *memb,
</B></PRE><A NAME="932612"><PRE><B>            char *contr)
</B></PRE><a name="933605">
</a>Dynamically change the type of a structure member. PDBLib supports an extended data typing mechanism called a structure. A </a>structure is a set of declarations of members. Each </a>member is in turn a data type known to the system. In some applications, a structure member is used to point to data of a type which is specified by another member. In the C coding a </a>cast is used to obtain a pointer to the desired data type.<p>
</a>
<a name="933611">
PDBLib supports this same practice by allowing the programmer to override the type of a member as given in the structure definition (see </a>PD_defstr) by supplying the name of a member, whose type must be &#147;char *&#148;, which will contain an ASCII string specifying the actual type of the data to which the first member points.<p>
</a>
<a name="933633">
The arguments to </a>PD_cast are: file, a pointer to a PDBfile; type, an ASCII string containing the name of the data structure type in the PDB file; memb, an ASCII string containing the name of the member whose type is to be overridden; and contr, an ASCII string containing the name of the member (whose type must be &#147;char *&#148;) which will provide the actual type for memb.<p>
</a>
<a name="933635">
The return value is a TRUE if the cast is successful; otherwise, FALSE is returned and the ASCII string PD_err contains any error message that was generated.<p>
</a>
<a name="933641">
<p>
</a>
<a name="932521">
int </a>PD_cast(PDBfile *file,<p>
</a>
<a name="932615">
            char *type,<p>
</a>
<a name="932617">
            char *memb,<p>
</a>
<a name="932616">
            char *contr)<p>
</a>
<A NAME="933647"><B>
</B><HR><A NAME="933650"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="933651"><PRE> 
</PRE><A NAME="933652"><PRE>    PDBfile *file;
</PRE><A NAME="933654"><PRE>    struct sample
</PRE><A NAME="933655"><PRE>       {char *type;
</PRE><A NAME="933656"><PRE>        int *a;};
</PRE><A NAME="933657"><PRE>          .
</PRE><A NAME="933658"><PRE>          .
</PRE><A NAME="933659"><PRE>          .
</PRE><A NAME="933660"><PRE>     </a>PD_defstr(file, &#147;sample&#148;, &#147;char *type&#148;, &#147;int *a&#148;, LAST);
</PRE><A NAME="933661"><PRE>     </a>PD_cast(file, &#147;sample&#148;, &#147;a&#148;, &#147;type&#148;);
</PRE><A NAME="933662"><PRE>          .
</PRE><A NAME="933663"><PRE>          .
</PRE><A NAME="933664"><PRE>          .
</PRE><a name="935411">
<h2>4.6   PD_CD</h2>
</a>
<A NAME="935412"><PRE><B>
</B></PRE><A NAME="935415"><PRE><B>int </a>PD_cd(PDBfile *file,
</B></PRE><A NAME="935428"><PRE><B>          char *dirname)
</B></PRE><a name="935430">
</a>Change the </a>current </a>directory in the specified PDB file.<p>
</a>
<a name="935431">
PDBLib supports an optional </a>hierarchical </a>directory structure inside PDB files. A directory or a variable in a directory may be specified by either a </a>relative path or an </a>absolute path. Slashes separate nodes in a </a>path name. Absolute paths begin with a slash. Nodes consisting of two periods, &#147;..&#148;, refer to the next higher level directory.<p>
</a>
<a name="935432">
The arguments to </a>PD_cd are: file, a pointer to a PDBfile; and dirname, an ASCII string containing the path name of the directory to change to.<p>
</a>
<a name="935529">
If dirname is NULL or an empty string or a slash, it refers to the top level or </a>root directory.<p>
</a>
<a name="935433">
The return value is a TRUE if successful; otherwise, FALSE is returned and the ASCII string PD_err contains any error message that was generated.<p>
</a>
<a name="935416">
See also </a>PD_ln, </a>PD_ls, </a>PD_mkdir, and </a>PD_pwd.<p>
</a>
<a name="935434">
<p>
</a>
<a name="935435">
int </a>PD_cd(PDBfile *file,<p>
</a>
<a name="935438">
          char *dirname)<p>
</a>
<A NAME="935439"><B>
</B><HR><A NAME="935440"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="935446"><PRE> 
</PRE><A NAME="935447"><PRE>    PDBfile *file;
</PRE><A NAME="935451"><PRE>          .
</PRE><A NAME="935452"><PRE>          .
</PRE><A NAME="935453"><PRE>          .
</PRE><A NAME="935427"><PRE>     if (</a>PD_cd(file, &#147;/animals/mammals&#148;) == FALSE)
</PRE><A NAME="935457"><PRE>        printf(&#147;%s&#148;, PD_err);
</PRE><A NAME="935436"><PRE>          .
</PRE><A NAME="935437"><PRE>          .
</PRE><A NAME="935448"><PRE>          .
</PRE><A NAME="935449"><PRE>     if (</a>PD_cd(file, &#147;../reptiles&#148;) == FALSE)
</PRE><A NAME="935458"><PRE>        printf(&#147;%s&#148;, PD_err);
</PRE><A NAME="935450"><PRE>          .
</PRE><A NAME="935454"><PRE>          .
</PRE><A NAME="935456"><PRE>          .
</PRE><a name="933672">
<h2>4.7   PD_CLOSE</h2>
</a>
<A NAME="933677"><PRE><B>
</B></PRE><A NAME="932618"><PRE><B>int </a>PD_close(PDBfile *file)
</B></PRE><a name="933683">
</a>Close a PDB file. After all data is written to the PDB file, the structure chart and symbol table must be written out to the file and their disk addresses recorded in the file header. Without these operations the file cannot be read back in by PDBLib and all data is lost. All open PDB files must be </a>PD_close&#146;d before exiting the program.<p>
</a>
<a name="933686">
A pointer, file, to the PDBfile associated with the PDB file must be passed to </a>PD_close.<p>
</a>
<a name="933690">
The function returns TRUE if the PDB file is correctly written and closed; otherwise, FALSE is returned and the ASCII string PD_err contains any error message that was generated.<p>
</a>
<a name="933693">
<p>
</a>
<a name="932620">
int </a>PD_close(PDBfile *file)<p>
</a>
<A NAME="933698"><B>
</B><HR><A NAME="933702"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="933703"><PRE> 
</PRE><A NAME="933704"><PRE>    PDBfile *file;
</PRE><A NAME="933705"><PRE>            .
</PRE><A NAME="933706"><PRE>            .
</PRE><A NAME="933707"><PRE>            .
</PRE><A NAME="933708"><PRE>     if (</a>PD_close(file) == FALSE)
</PRE><A NAME="933709"><PRE>        printf(&#147;%s&#148;, PD_err);
</PRE><A NAME="933710"><PRE>            .
</PRE><A NAME="933711"><PRE>            .
</PRE><A NAME="933712"><PRE>            .
</PRE><a name="932688">
<h2>4.8   PD_DEF_ATTRIBUTE</h2>
</a>
<A NAME="933508"><PRE><B>
</B></PRE><A NAME="934550"><PRE><B>int </a>PD_def_attribute(PDBfile *file,
</B></PRE><A NAME="934551"><PRE><B>                     char *attr,
</B></PRE><A NAME="934555"><PRE><B>                     char *type)
</B></PRE><a name="933499">
</a>Define an </a>attribute to the given PDB file. The </a>model of an attribute in PDBLib is an entity that has a name and type. The two supported operations on attributes are to create them and to remove them. An entity in a PDB file can be assigned an </a>attribute value simply by making a call which specifies the entity name, the attribute name, and the attribute value (which is determined by the type). The only association between an entry in a PDB file and any attribute is made by the name in the attribute table and the entry in the symbol table. In particular, this mechanism allows the application developer to define and use entities in a PDB file solely in terms of attributes.<p>
</a>
<a name="934556">
The arguments to this function are: file, a pointer to a PDBfile; name, an ASCII string containing the name of the attribute being defined; and type, an ASCII string containing the name of the data type in the PDB file.<p>
</a>
<a name="934576">
The return value is TRUE if successful, and FALSE otherwise.<p>
</a>
<a name="934558">
See also </a>PD_rem_attribute, </a>PD_set_attribute, and </a>PD_get_attribute.<p>
</a>
<a name="934923">
<p>
</a>
<A NAME="934922"><PRE><B>int </a>PD_def_attribute(PDBfile *file,
</B></PRE><A NAME="934943"><PRE><B>                     char *attr,
</B></PRE><A NAME="934944"><PRE><B>                     char *type)
</B></PRE><A NAME="934928"><B>
</B><HR><A NAME="934929"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="934930"><PRE> 
</PRE><A NAME="934932"><PRE>    PDBfile *file;
</PRE><A NAME="934933"><PRE>            .
</PRE><A NAME="934934"><PRE>            .
</PRE><A NAME="934936"><PRE>            .
</PRE><A NAME="934937"><PRE>     if (</a>PD_def_attribute(file, &#147;date&#148;, &#147;char *&#148;) == FALSE)
</PRE><A NAME="934938"><PRE>        printf(&#147;%s&#148;, PD_err);
</PRE><A NAME="934939"><PRE>            .
</PRE><A NAME="934940"><PRE>            .
</PRE><A NAME="934942"><PRE>            .
</PRE><a name="933498">
<h2>4.9   PD_DEFENT</h2>
</a>
<A NAME="933352"><PRE><B>
</B></PRE><A NAME="932695"><PRE><B>syment *</a>PD_defent(PDBfile *file,
</B></PRE><A NAME="933355"><PRE><B>                  char *name,
</B></PRE><A NAME="933356"><PRE><B>                  char *outtype)
</B></PRE><a name="932692">
</a>Define an entry in the </a>symbol table of the PDB file specified by <em>file</em>. This function </a>reserves space on disk but writes no data. The data can be written with later calls to </a>PD_write, </a>PD_write_alt, </a>PD_write_as, or </a>PD_write_as_alt.<p>
</a>
<a name="933353">
The rationale for this function is to </a>block out space in a PDB file corresponding to some logical layout of a piece of data. The data may not exist at the time the space is reserved or for some reason it may be desirable to write out the data in pieces. In any case if the type and shape of a variable is known at some point, an entry may be made in the PDB file without writing any data. The space may filled with other PDBLib calls at some later time.<p>
</a>
<a name="933354">
The shape or dimensional information of the entry is a part of the name string. In this respect </a>PD_defent behaves just like </a>PD_write.<p>
</a>
<a name="932696">
Input to this function is: <em>file</em>, a pointer to a PDBfile, name, an ASCII string containing the name of the variable and any dimensional information, and outtype, an ASCII string specifying the type of data in the file.<p>
</a>
<a name="932698">
This function returns a symbol table entry (syment) pointer, if successful; otherwise, NULL is returned and the ASCII string PD_err contains any error message that was generated.<p>
</a>
<a name="934227">
See also </a>PD_defent_alt, </a>PD_write, </a>PD_write_alt, </a>PD_write_as, </a>PD_write_as_alt.<p>
</a>
<a name="932700">
<p>
</a>
<a name="932701">
syment *</a>PD_defent(PDBfile *file,<p>
</a>
<a name="932715">
                  char *name,<p>
</a>
<a name="933348">
                  char *outtype)<p>
</a>
<A NAME="933349"><B>
</B><HR><A NAME="933350"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="933351"><PRE> 
</PRE><A NAME="933362"><PRE>     PDBfile *file;
</PRE><A NAME="933365"><PRE>     syment *ep;
</PRE><A NAME="933369"><PRE> 
</PRE><A NAME="933370"><PRE>           .
</PRE><A NAME="933371"><PRE>           .
</PRE><A NAME="933372"><PRE>           .
</PRE><A NAME="933373"><PRE>     if ((ep = </a>PD_defent(file, &#147;x(20)&#148;, &#147;float&#148;)) == NULL)
</PRE><A NAME="933374"><PRE>        printf(&#147;%s&#148;, PD_err);
</PRE><A NAME="933375"><PRE>           .
</PRE><A NAME="933376"><PRE>           .
</PRE><A NAME="932670"><PRE>           .
</PRE><a name="933438">
Compare this with the example of </a>PD_write.<p>
</a>
<a name="932699">
<h2>4.10   PD_DEFENT_ALT</h2>
</a>
<A NAME="932693"><PRE><B>	
</B></PRE><A NAME="933357"><PRE><B>syment *</a>PD_defent_alt(PDBfile *file,
</B></PRE><A NAME="933358"><PRE><B>                      char *name,
</B></PRE><A NAME="933361"><PRE><B>                      char *outtype,
</B></PRE><A NAME="933360"><PRE><B>                      int nd,
</B></PRE><A NAME="933359"><PRE><B>                      long *ind)
</B></PRE><a name="933363">
</a>Define an entry in the </a>symbol table of the PDB file specified by <em>file</em>. This function </a>reserves space on disk but writes no data. The data can be written with later calls to </a>PD_write, </a>PD_write_alt, </a>PD_write_as, or </a>PD_write_as_alt.<p>
</a>
<a name="933368">
This is an alternate form of </a>PD_defent. The difference is that the </a>dimension information is supplied via the nd and ind arguments instead of being a part of the name string. In this respect it behaves as </a>PD_write_alt does.<p>
</a>
<a name="933364">
The rationale for this function is to </a>block out space in a PDB file corresponding to some logical layout of a piece of data. The data may not exist at the time the space is reserved or for some reason it may be desirable to write out the data in pieces. In any case if the type and shape of a variable is known at some point, an entry may be made in the PDB file without writing any data. The space may filled with other PDBLib calls at some later time.<p>
</a>
<a name="933366">
Input to this function is: <em>file</em>, a pointer to a PDBfile, name, an ASCII string containing the name of the variable only, outtype, an ASCII string specifying the type of data in the file; nd, an integer specifying the number of dimensions; and ind, an array of long integers containing the minimum and maximum values of the index for each dimension pairwise.<p>
</a>
<a name="933367">
This function returns a symbol table entry (syment) pointer, if successful; otherwise, NULL is returned and the ASCII string PD_err contains any error message that was generated.<p>
</a>
<a name="934228">
See also </a>PD_defent, </a>PD_write, </a>PD_write_alt, </a>PD_write_as, </a>PD_write_as_alt.<p>
</a>
<a name="933425">
<p>
</a>
<a name="933426">
syment *</a>PD_defent_alt(PDBfile *file,<p>
</a>
<a name="933427">
                      char *name,<p>
</a>
<a name="933428">
                      char *outtype,<p>
</a>
<a name="933430">
                      int nd,<p>
</a>
<a name="933431">
                      long *ind)<p>
</a>
<A NAME="933432"><B>
</B><HR><A NAME="933433"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="933434"><PRE> 
</PRE><A NAME="933435"><PRE>     PDBfile *file;
</PRE><A NAME="933436"><PRE>     syment *ep;
</PRE><A NAME="933437"><PRE>     long ind[4];
</PRE><A NAME="933439"><PRE>           .
</PRE><A NAME="933440"><PRE>           .
</PRE><A NAME="933441"><PRE>           .
</PRE><A NAME="933442"><PRE>     ind[0] = 0L;
</PRE><A NAME="933443"><PRE>     ind[1] = 19L;
</PRE><A NAME="933444"><PRE>     ind[2] = -2L;
</PRE><A NAME="933445"><PRE>     ind[3] = 2L;
</PRE><A NAME="933446"><PRE>     if ((ep = </a>PD_defent_alt(file, &#147;x&#148;, &#147;float&#148;, 2, ind)) == NULL)
</PRE><A NAME="933447"><PRE>        printf(&#147;%s&#148;, PD_err);
</PRE><A NAME="933448"><PRE>           .
</PRE><A NAME="933449"><PRE>           .
</PRE><A NAME="933394"><PRE>           .
</PRE><a name="933429">
Compare this with the example of </a>PD_write_alt and note the absence of a two dimensional array in this call.<p>
</a>
<a name="933157">
<h2>4.11   PD_DEFIX</h2>
</a>
<A NAME="933197"><PRE><B>
</B></PRE><A NAME="933158"><PRE><B>defstr *</a>PD_defix(PDBfile *file,
</B></PRE><A NAME="933193"><PRE><B>                 char *name,
</B></PRE><A NAME="933543"><PRE><B>                 long bytespitem,
</B></PRE><A NAME="933542"><PRE><B>                 int align,
</B></PRE><A NAME="933541"><PRE><B>                 int flg)
</B></PRE><a name="933200">
</a>Define a primitive integral type (</a>fixed point type) in the PDB file specified by <em>file</em>. <p>
</a>
<a name="933166">
Input to PD_defix is: <em>file</em>, a pointer to a PDBfile; name, an ASCII string containing the name of the new data type; bytespitem, the number of bytes required for 1 item of the new type; align, the byte alignment for the type; and flg, a flag indicating whether the byte ordering of the type is normal or reverse ordered.<p>
</a>
<a name="933160">
PDBLib supplies two </a>#</a>define&#146;d constants which define the two ordering schemes used for fixed point types: </a>NORMAL_ORDER and </a>REVERSE_ORDER. NORMAL_ORDER means that the byte ordering from lowest to highest address as occurs on most CPU&#146;s. REVERSE_ORDER means that the byte order goes from highest to lowest address as happens with INTEL and other CPU&#146;s.<p>
</a>
<a name="933161">
Compare this information with that found in the discussion of data conversion later in this manual.<p>
</a>
<a name="933209">
A pointer to the new type&#146;s defstr is returned if the call is successful; otherwise, NULL is returned and the ASCII string PD_err contains any error message that was generated.<p>
</a>
<a name="933201">
<p>
</a>
<A NAME="933544"><PRE><B>defstr *</a>PD_defix(PDBfile *file,
</B></PRE><A NAME="933545"><PRE><B>                 char *name,
</B></PRE><A NAME="933546"><PRE><B>                 long bytespitem,
</B></PRE><A NAME="933547"><PRE><B>                 int align,
</B></PRE><a name="933207">
                 int flg)<p>
</a>
<A NAME="933231"><B>
</B><HR><A NAME="933232"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="933233"><PRE> 
</PRE><A NAME="933234"><PRE>    PDBfile *file;
</PRE><A NAME="933239"><PRE>    defstr *ptr;
</PRE><A NAME="933240"><PRE>           .
</PRE><A NAME="933241"><PRE>           .
</PRE><A NAME="933242"><PRE>           .
</PRE><A NAME="933244"><PRE>     ptr = </a>PD_defix(file, &#147;int40&#148;, 5, 1, </a>NORMAL_ORDER);
</PRE><A NAME="933245"><PRE>           .
</PRE><A NAME="933246"><PRE>           .
</PRE><A NAME="933210"><PRE>           .
</PRE><a name="933169">
<h2>4.12   PD_DEFLOAT</h2>
</a>
<A NAME="933192"><PRE><B>
</B></PRE><A NAME="933530"><PRE><B>defstr *</a>PD_defloat(PDBfile *file,
</B></PRE><A NAME="933531"><PRE><B>                   char *name,
</B></PRE><A NAME="933532"><PRE><B>                   long bytespitem,
</B></PRE><A NAME="933533"><PRE><B>                   int align,
</B></PRE><A NAME="933534"><PRE><B>                   int *ordr,
</B></PRE><A NAME="933535"><PRE><B>                   long expb,
</B></PRE><A NAME="933536"><PRE><B>                   long mantb,
</B></PRE><A NAME="933537"><PRE><B>                   long sbs,
</B></PRE><A NAME="933538"><PRE><B>                   long sbe,
</B></PRE><A NAME="933539"><PRE><B>                   long sbm,
</B></PRE><A NAME="933540"><PRE><B>                   long hmb,
</B></PRE><A NAME="933196"><PRE><B>                   long bias)
</B></PRE><a name="933171">
</a>Define a new floating point type to the PDB file specified by <em>file</em>.<p>
</a>
<a name="933187">
Input to </a>PD_defloat is: <em>file</em>, a pointer to a PDBfile; n<em>ame</em>, an ASCII string containing the name of the variable in the PDB file; b<em>ytespitem, the number of bytes required for an item of the new type; </em>align, the byte alignment for this type; ordr, an array of bytespitem integers specifying the byte order; expb, the number of exponent bits; mantb, the number of mantissa bits; sbs, the position of the sign bit; sbe, the starting bit of the exponent; sbm, the starting bit of the mantissa; hmb, the value of the high order mantissa bit; and bias, the bias of the exponent.<p>
</a>
<a name="933167">
Compare this information with that found in the discussion of data conversion later in this manual.<p>
</a>
<a name="933217">
A pointer to the new type&#146;s defstr is returned if the call is successful; otherwise, NULL is returned and the ASCII string PD_err contains any error message that was generated.<p>
</a>
<a name="933211">
<p>
</a>
<A NAME="933212"><PRE><B>defstr *</a>PD_defloat(PDBfile *file,
</B></PRE><A NAME="933500"><PRE><B>                   char *name,
</B></PRE><A NAME="933501"><PRE><B>                   long bytespitem,
</B></PRE><A NAME="933523"><PRE><B>                   int align,
</B></PRE><A NAME="933502"><PRE><B>                   int *ordr,
</B></PRE><A NAME="933213"><PRE><B>                   long expb,
</B></PRE><A NAME="933524"><PRE><B>                   long mantb,
</B></PRE><A NAME="933529"><PRE><B>                   long sbs,
</B></PRE><A NAME="933528"><PRE><B>                   long sbe,
</B></PRE><A NAME="933527"><PRE><B>                   long sbm,
</B></PRE><A NAME="933526"><PRE><B>                   long hmb,
</B></PRE><A NAME="933525"><PRE><B>                   long bias)
</B></PRE><A NAME="933214"><B>
</B><HR><A NAME="933215"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="933216"><PRE> 
</PRE><A NAME="933226"><PRE> int ord_int24[] = {1, 3, 2};
</PRE><A NAME="933222"><PRE> 
</PRE><A NAME="933221"><PRE>    PDBfile *file;
</PRE><A NAME="933218"><PRE>    defstr *ptr;
</PRE><A NAME="933223"><PRE>           .
</PRE><A NAME="933224"><PRE>           .
</PRE><A NAME="933225"><PRE>           .
</PRE><A NAME="933220"><PRE>     ptr = </a>PD_defloat(file, &#147;fp24&#148;, 3, 1, ord_int24,
</PRE><A NAME="933219"><PRE>                      7L, 16L, 0L, 1L, 8L, 0L, 0x3F)
</PRE><A NAME="933228"><PRE>           .
</PRE><A NAME="933229"><PRE>           .
</PRE><A NAME="933195"><PRE>           .
</PRE><a name="933559">
<h2>4.13   PD_DEFNCV</h2>
</a>
<A NAME="933562"><PRE><B>
</B></PRE><A NAME="933563"><PRE><B>defstr *</a>PD_defncv(PDBfile *file,
</B></PRE><A NAME="933565"><PRE><B>                  char *name,
</B></PRE><A NAME="933566"><PRE><B>                  long bytespitem,
</B></PRE><A NAME="933569"><PRE><B>                  int align)
</B></PRE><a name="933570">
</a>Define a primitive type that will not undergo format conversion from platform to platform in the PDB file specified by <em>file</em>. Certain data types commonly defined in C programs are used as flags or character holders. With such data types the actual bit pattern contains the meaningful information. This information would be lost under a data conversion operation. This function provides users with a means to define primitive types which will not be converted under any circumstances and therefore preserve the meaningful bit patterns which constitute the intended data.<p>
</a>
<a name="933571">
Input to </a>PD_defncv is: <em>file</em>, a pointer to a PDBfile; name, an ASCII string containing the name of the new data type; bytespitem, the number of bytes required for 1 item of the new type; and align, the byte alignment for the type.<p>
</a>
<a name="933573">
Compare this information with that found in the discussion of data conversion later in this manual.<p>
</a>
<a name="933574">
A pointer to the new type&#146;s defstr is returned if the call is successful; otherwise, NULL is returned and the ASCII string PD_err contains any error message that was generated.<p>
</a>
<a name="933575">
<p>
</a>
<A NAME="933576"><PRE><B>defstr *PD_defncv(PDBfile *file,
</B></PRE><A NAME="933577"><PRE><B>                  char *name,
</B></PRE><A NAME="933578"><PRE><B>                  long bytespitem,
</B></PRE><a name="933580">
                  int align)<p>
</a>
<A NAME="933581"><B>
</B><HR><A NAME="933582"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="933583"><PRE> 
</PRE><A NAME="933584"><PRE>    PDBfile *file;
</PRE><A NAME="933586"><PRE>    defstr *ptr;
</PRE><A NAME="933587"><PRE>           .
</PRE><A NAME="933588"><PRE>           .
</PRE><A NAME="933589"><PRE>           .
</PRE><A NAME="933590"><PRE> /* define a type like the FORTRAN character*8 */
</PRE><A NAME="933567"><PRE>     ptr = </a>PD_defncv(file, &#147;char_8&#148;, 8, 1);
</PRE><A NAME="933591"><PRE>           .
</PRE><A NAME="935810"><PRE>           .
</PRE><A NAME="933592"><PRE>           .
</PRE><a name="933720">
<h2>4.14   PD_DEFSTR</h2>
</a>
<A NAME="933726"><PRE><B>
</B></PRE><A NAME="932622"><PRE><B>defstr *</a>PD_defstr(PDBfile *file,
</B></PRE><A NAME="932623"><PRE><B>                  char *name,
</B></PRE><A NAME="932625"><PRE><B>                  char *mem1, ..., memn,
</B></PRE><A NAME="932624"><PRE><B>                  int *LAST)
</B></PRE><a name="933736">
</a>Define a data </a>structure for a PDB file. As a matter of programming efficiency and clarity it is useful to be able to refer to more complex structural units than the primitive types: short integers, integers, long integers, floating point numbers, double precision floating point numbers, and characters. Arrays do this in a very simple-minded way. Many modern languages support extended types or structures which allow the programmer to group diverse types of data together in a very sophisticated way.<p>
</a>
<a name="933746">
PDBLib supports an extended data typing mechanism called a structure. A </a>structure is a set of declarations of members. Each member is in turn a data type known to the system. Much of the style and usage of structures comes from the C struct. Because of the memory management features upon which PDBLib now depends, even members whose types are pointers are allowed. The only </a>restrictions on member types are that they not be function pointers and that they be expressible without parentheses. Again any member which is a pointer must have its memory allocated by a SCORE </a>memory management function or macro. See the Memory Management section near the beginning of this manual. <p>
</a>
<a name="933758">
 </a>PD_defstr defines structures to the PDB system so that they can be read and written as a whole in a single statement. The members of the </a>structure are processed and an entry in the structure chart is made. Then subsequent references to the new structure type are processed using information from the structure chart. The syntax by which members of a structure are specified is like that for C structs. The formal definition is given below ([ ] enclose optional elements). </a>Self-referential structures are allowed providing the reference is through pointers (like C). The actual type name is used in the reference since PDBLib checks that all member types are already known or are the type being defined.<p>
</a>
<dl>
<a name="933761">
<dt>
</a>
<a name="932523">
<dt> &lt;member&gt;			:=	&lt;type&gt; [*...*]&lt;member name&gt;[(&lt;dimensions&gt;)]
</a>
<a name="933763">
<dt> &lt;type&gt;			:=	&lt;primitive type&gt; | &lt;derived type&gt;
</a>
<a name="933766">
<dt> &lt;member name&gt;			:=	an ascii string representing the name of the member
</a>
<a name="933768">
<dt> &lt;primitive type&gt;			:=	short | integer | long | float | double | char
</a>
<a name="933770">
<dt> &lt;derived type&gt;			:=	any </a>PD_defstr&#146;d type
</a>
<a name="933773">
<dt> &lt;dimensions&gt;			:=	&lt;integer&gt; |
</a>
<a name="933620">
<dt>				&lt;integer : integer&gt; |
</a>
<a name="933621">
<dt>				&lt;integer&gt;, &lt;dimensions&gt; |
</a>
<a name="932524">
<dt>				&lt;integer : integer&gt; &lt;dimensions&gt;
</a>
<a name="933782">
Dimensions can be given in two ways. If the default offset value for the PDB file can be taken as the minimum value for the range which a dimension index can legally run, the maximum value may be specified alone. Alternatively, the minimum value followed by a colon and the maximum value may be specified. For example,<p>
</a>
<a name="933785">
<dd> integer a(30,1:10)<P>
</a>
<a name="933791">
The arguments to </a>PD_defstr are: file, a pointer to a PDBfile; name, an ASCII string containing the name of the data structure type in the PDB file; and memi, a list of ASCII strings each representing the declaration of a member of a </a>structure are defined above. LAST must terminate the list of members.<p>
</a>
<a name="933612">
The return value is a pointer to the entry made in the structure chart if the call is successful; otherwise, NULL is returned and the ASCII string PD_err contains any error message that was generated.<p>
</a>
<a name="933793">
<p>
</a>
<a name="933799">
<p>
</a>
<a name="932626">
defstr *PD_defstr(PDBfile *file,<p>
</a>
<a name="932627">
                  char *name,<p>
</a>
<a name="932628">
                  char *mem1, ..., memn,<p>
</a>
<a name="932629">
                  int *LAST)<p>
</a>
<A NAME="933805"><B>
</B><HR><A NAME="933808"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="933809"><PRE> 
</PRE><A NAME="933810"><PRE>    PDBfile *file;
</PRE><A NAME="933811"><PRE>    defstr *ptr;
</PRE><A NAME="933812"><PRE>    struct sample
</PRE><A NAME="933813"><PRE>       {float x[20];
</PRE><A NAME="933814"><PRE>        float y[20];
</PRE><A NAME="933815"><PRE>        int number;};
</PRE><A NAME="933816"><PRE>           .
</PRE><A NAME="933817"><PRE>           .
</PRE><A NAME="933818"><PRE>           .
</PRE><A NAME="933819"><PRE>     ptr = </a>PD_defstr(file, &#147;sample&#148;, &#147;float x(20)&#148;, &#147;float y(20)&#148;,
</PRE><A NAME="933820"><PRE>                           &#147;int number&#148;, LAST);
</PRE><A NAME="933821"><PRE>           .
</PRE><A NAME="933822"><PRE>           .
</PRE><A NAME="933823"><PRE>           .
</PRE></dl>
<a name="934412">
<h2>4.15   PD_DEFSTR_ALT</h2>
</a>
<A NAME="934413"><PRE><B>
</B></PRE><a name="934498">
defstr *</a>PD_defstr_alt(PDBfile *file,<p>
</a>
<a name="934499">
                      char *name,<p>
</a>
<a name="934500">
                      int nmemb,<p>
</a>
<a name="934501">
                      char **members)<p>
</a>
<a name="934446">
</a>Define a data </a>structure for a PDB file. As a matter of programming efficiency and clarity it is useful to be able to refer to more complex structural units than the primitive types: short integers, integers, long integers, floating point numbers, double precision floating point numbers, and characters. Arrays do this in a very simple-minded way. Many modern languages support extended types or structures which allow the programmer to group diverse types of data together in a very sophisticated way.<p>
</a>
<a name="934447">
PDBLib supports an extended data typing mechanism called a structure. A </a>structure is a set of declarations of members. Each member is in turn a data type known to the system. Much of the style and usage of structures comes from the C struct. Because of the memory management features upon which PDBLib now depends, even members whose types are pointers are allowed. The only </a>restrictions on member types are that they not be function pointers and that they be expressible without parentheses. Again any member which is a pointer must have its memory allocated by a SCORE </a>memory management function or macro. See the Memory Management section near the beginning of this manual. <p>
</a>
<a name="934448">
 </a>PD_defstr defines structures to the PDB system so that they can be read and written as a whole in a single statement. The members of the </a>structure are processed and an entry in the structure chart is made. Then subsequent references to the new structure type are processed using information from the structure chart. The syntax by which members of a structure are specified is like that for C structs. The formal definition is given below ([ ] enclose optional elements). </a>Self-referential structures are allowed providing the reference is through pointers (like C). The actual type name is used in the reference since PDBLib checks that all member types are already known or are the type being defined.<p>
</a>
<dl>
<a name="934449">
<dt>
</a>
<a name="934450">
<dt> &lt;member&gt;			:=	&lt;type&gt; [*...*]&lt;member name&gt;[(&lt;dimensions&gt;)]
</a>
<a name="934451">
<dt> &lt;type&gt;			:=	&lt;primitive type&gt; | &lt;derived type&gt;
</a>
<a name="934452">
<dt> &lt;member name&gt;			:=	an ascii string representing the name of the member
</a>
<a name="934453">
<dt> &lt;primitive type&gt;			:=	short | integer | long | float | double | char
</a>
<a name="934454">
<dt> &lt;derived type&gt;			:=	any </a>PD_defstr&#146;d type
</a>
<a name="934455">
<dt> &lt;dimensions&gt;			:=	&lt;integer&gt; |
</a>
<a name="934456">
<dt>				&lt;integer : integer&gt; |
</a>
<a name="934457">
<dt>				&lt;integer&gt;, &lt;dimensions&gt; |
</a>
<a name="934458">
<dt>				&lt;integer : integer&gt; &lt;dimensions&gt;
</a>
<a name="934459">
Dimensions can be given in two ways. If the default offset value for the PDB file can be taken as the minimum value for the range which a dimension index can legally run, the maximum value may be specified alone. Alternatively, the minimum value followed by a colon and the maximum value may be specified. For example,<p>
</a>
<a name="934460">
<dd> integer a(30,1:10)<P>
</a>
<a name="934461">
The arguments to </a>PD_defstr are: file, a pointer to a PDBfile; name, an ASCII string containing the name of the data structure type in the PDB file; nmemb, an integer number of strings in the members array; and members, an array of ASCII strings each representing the declaration of a member of a </a>structure are defined above.<p>
</a>
<a name="934462">
The return value is a pointer to the entry made in the structure chart if the call is successful; otherwise, NULL is returned and the ASCII string PD_err contains any error message that was generated.<p>
</a>
<a name="934463">
<p>
</a>
<a name="934464">
<p>
</a>
<a name="934465">
defstr *</a>PD_defstr_alt(PDBfile *file,<p>
</a>
<a name="934466">
                      char *name,<p>
</a>
<a name="934468">
                      int nmemb,<p>
</a>
<a name="934467">
                      char **members)<p>
</a>
<A NAME="934469"><B>
</B><HR><A NAME="934470"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="934471"><PRE> 
</PRE><A NAME="934472"><PRE>    PDBfile *file;
</PRE><A NAME="934473"><PRE>    defstr *ptr;
</PRE><A NAME="934497"><PRE>    char **members;
</PRE><A NAME="934475"><PRE>    struct sample
</PRE><A NAME="934476"><PRE>       {float x[20];
</PRE><A NAME="934477"><PRE>        float y[20];
</PRE><A NAME="934478"><PRE>        int number;};
</PRE><A NAME="934479"><PRE>           .
</PRE><A NAME="934480"><PRE>           .
</PRE><A NAME="934481"><PRE>           .
</PRE><A NAME="934489"><PRE>     members = MAKE_N(char *, 3);
</PRE><A NAME="934490"><PRE>     members[0] = SC_strsave(&#147;float x[20]&#148;);
</PRE><A NAME="934491"><PRE>     members[1] = SC_strsave(&#147;float y[20]&#148;);
</PRE><A NAME="934492"><PRE>     members[2] = SC_strsave(&#147;integer number&#148;);
</PRE><A NAME="934483"><PRE>     ptr = </a>PD_defstr_alt(file, &#147;sample&#148;, 3, members);
</PRE><A NAME="934484"><PRE> 
</PRE><A NAME="934493"><PRE>     SFREE(members[0]);
</PRE><A NAME="934494"><PRE>     SFREE(members[1]);
</PRE><A NAME="934495"><PRE>     SFREE(members[3]);
</PRE><A NAME="934496"><PRE>     SFREE(members);
</PRE><A NAME="934485"><PRE>           .
</PRE><A NAME="934486"><PRE>           .
</PRE><A NAME="934487"><PRE>           .
</PRE></dl>
<a name="935904">
<h2>4.16   PD_FAMILY</h2>
</a>
<A NAME="935907"><PRE><B>
</B></PRE><A NAME="935970"><PRE><B>PDBfile *</a>PD_family(PDBfile *file, int flag)
</B></PRE><a name="935971">
This function checks to see whether the specified file has exceeded it size limit. If it has a new file is opened and returns. If not the given file pointer is returned. The flag is set to TRUE if you want </a>PD_family to close the file it is given. Otherwise the application is responsible for closing the file<p>
</a>
<a name="935985">
The arguments to this function are: file, the pointer to the PDBfile structure returned by a previous call to </a>PD_open; and flag an integer value (either TRUE or FALSE).<p>
</a>
<a name="935990">
This function returns a pointer to a PDBfile.<p>
</a>
<a name="935995">
<p>
</a>
<a name="935996">
PDBfile *</a>PD_family(PDBfile *file, int flag)<p>
</a>
<A NAME="935997"><B>
</B><HR><A NAME="935998"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="935999"><PRE> 
</PRE><A NAME="936000"><PRE>    PDBfile *old, *new;
</PRE><A NAME="936001"><PRE>            .
</PRE><A NAME="936003"><PRE>            .
</PRE><A NAME="936004"><PRE>            .
</PRE><A NAME="936005"><PRE>     new = PD_family(old, FALSE);
</PRE><A NAME="935323"><PRE>     if (new != old)
</PRE><A NAME="935324"><PRE>        {PD_close(old);
</PRE><A NAME="935325"><PRE>              .
</PRE><A NAME="935524"><PRE>              .
</PRE><A NAME="935811"><PRE>              .
</PRE><A NAME="935972"><PRE>         old = new;};
</PRE><A NAME="936008"><PRE>            .
</PRE><A NAME="936009"><PRE>            .
</PRE><A NAME="936010"><PRE>            .
</PRE><a name="933831">
<h2>4.17   PD_FLUSH</h2>
</a>
<A NAME="934268"><PRE><B>
</B></PRE><A NAME="934275"><PRE><B>int </a>PD_flush(PDBfile *file)
</B></PRE><a name="934277">
This function writes out the information which describes the </a>contents of the PDB file specified. Normally, </a>PD_close calls this routine, but applications that want to protect themselves from system failures or other problems may chose to periodically use this function. After a successful return and until or unless more data is written to the file or space reserved for future writes, the PDB file is valid in the sense that if the application terminates unexpectedly before calling PD_close, the file can be </a>PD_open&#146;d successfully.<p>
</a>
<a name="934276">
NOTE: this call does NOT obviate PD_close!<p>
</a>
<a name="934278">
The argument to this function is file, the pointer to the PDBfile structure returned by a previous call to PD_open.<p>
</a>
<a name="934279">
This function returns TRUE if successful and FALSE otherwise.<p>
</a>
<a name="934281">
<p>
</a>
<a name="934282">
int </a>PD_flush(PDBfile *file)<p>
</a>
<A NAME="934283"><B>
</B><HR><A NAME="934284"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="934285"><PRE> 
</PRE><A NAME="934286"><PRE>    PDBfile *file;
</PRE><A NAME="934287"><PRE>            .
</PRE><A NAME="934288"><PRE>            .
</PRE><A NAME="934289"><PRE>            .
</PRE><A NAME="934290"><PRE>     if (</a>PD_flush(file) == FALSE)
</PRE><A NAME="934291"><PRE>        printf(&#147;%s&#148;, PD_err);
</PRE><A NAME="934292"><PRE>            .
</PRE><A NAME="934293"><PRE>            .
</PRE><A NAME="934280"><PRE>            .
</PRE><a name="934559">
<h2>4.18   PD_GET_ATTRIBUTE</h2>
</a>
<A NAME="934560"><PRE><B>
</B></PRE><A NAME="934561"><PRE><B>void *</a>PD_get_attribute(PDBfile *file,
</B></PRE><A NAME="934562"><PRE><B>                       char *vr,
</B></PRE><A NAME="934567"><PRE><B>                       char *attr)
</B></PRE><a name="934564">
</a>Return the value of the specified </a>attribute for the named entity.<p>
</a>
<a name="934563">
The </a>model of an attribute in PDBLib is an entity that has a name and type. The two supported operations on attributes are to create them and to remove them. An entity in a PDB file can be assigned an </a>attribute value simply by calling </a>PD_set_attribute. The only association between an entry in a PDB file and any attribute is made by the name in the attribute table and the entry in the symbol table. In particular, this mechanism allows the application developer to define and use entities in a PDB file solely in terms of attributes.<p>
</a>
<a name="934565">
Attribute values are always assigned by </a>reference and </a>PD_get_attribute returns them the same way. The application may have to make a cast on the returned pointer.<p>
</a>
<a name="934566">
The arguments to this function are: file, a pointer to a PDBfile; vr, an ASCII string containing the name of an entity in the PDB file; and attr, an ASCII string containing the name of the attribute being sought.<p>
</a>
<a name="934579">
The return value is a pointer to the value of the attribute if one exists and NULL otherwise.<p>
</a>
<a name="934568">
See also </a>PD_def_attribute, </a>PD_rem_attribute, and </a>PD_set_attribute.<p>
</a>
<a name="934946">
<p>
</a>
<A NAME="934924"><PRE><B>void *</a>PD_get_attribute(PDBfile *file,
</B></PRE><A NAME="934966"><PRE><B>                       char *vr,
</B></PRE><A NAME="934967"><PRE><B>                       char *attr)
</B></PRE><A NAME="934951"><B>
</B><HR><A NAME="934952"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="934953"><PRE> 
</PRE><A NAME="934954"><PRE>    PDBfile *file;
</PRE><A NAME="934947"><PRE>    char *dt;
</PRE><A NAME="934955"><PRE>            .
</PRE><A NAME="934957"><PRE>            .
</PRE><A NAME="934958"><PRE>            .
</PRE><A NAME="934959"><PRE>     dt = (char *) </a>PD_get_attribute(file, &#147;foo&#148;, &#147;date&#148;);
</PRE><A NAME="934960"><PRE>        printf(&#147;%s&#148;, PD_err);
</PRE><A NAME="934961"><PRE>            .
</PRE><A NAME="934962"><PRE>            .
</PRE><A NAME="934964"><PRE>            .
</PRE><a name="935459">
<h2>4.19   PD_LN</h2>
</a>
<A NAME="935460"><PRE><B>
</B></PRE><A NAME="935462"><PRE><B>int </a>PD_ln(PDBfile *file,
</B></PRE><A NAME="935464"><PRE><B>          char *var,
</B></PRE><A NAME="935498"><PRE><B>          char *link)
</B></PRE><a name="935465">
</a>Create a link to a variable in the specified PDB file.<p>
</a>
<a name="935467">
PDBLib supports an optional </a>hierarchical </a>directory structure inside PDB files. A directory or a variable in a directory may be specified by either a </a>relative path or an </a>absolute path. Slashes separate nodes in a </a>path name. Absolute paths begin with a slash. Nodes consisting of two periods, &#147;..&#148;, refer to the next higher level directory.<p>
</a>
<a name="935468">
The arguments to </a>PD_ln are: file, a pointer to a PDBfile; var, an ASCII string containing the path name of an existing variable; and link, an ASCII string containing the path name of the new link.<p>
</a>
<a name="935469">
The return value is a TRUE if successful; otherwise, FALSE is returned and the ASCII string PD_err contains any error message that was generated.<p>
</a>
<a name="935470">
See also </a>PD_cd, </a>PD_ls, </a>PD_mkdir, and </a>PD_pwd.<p>
</a>
<a name="935471">
<p>
</a>
<a name="935472">
int </a>PD_ln(PDBfile *file,<p>
</a>
<a name="935473">
          char *var,<p>
</a>
<a name="935499">
          char *link)<p>
</a>
<A NAME="935474"><B>
</B><HR><A NAME="935475"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="935476"><PRE> 
</PRE><A NAME="935477"><PRE>    PDBfile *file;
</PRE><A NAME="935478"><PRE>          .
</PRE><A NAME="935479"><PRE>          .
</PRE><A NAME="935480"><PRE>          .
</PRE><A NAME="935481"><PRE>     if (</a>PD_ln(file, &#147;/animals/mammals/chimpanzee&#148;, &#147;/chimp&#148;) == FALSE)
</PRE><A NAME="935483"><PRE>        printf(&#147;%s&#148;, PD_err);
</PRE><A NAME="935484"><PRE>          .
</PRE><A NAME="935486"><PRE>          .
</PRE><A NAME="935492"><PRE>          .
</PRE><a name="935493">
<h2>4.20   PD_LS</h2>
</a>
<A NAME="935494"><PRE><B>
</B></PRE><A NAME="935495"><PRE><B>char **PD_ls(PDBfile *file,
</B></PRE><A NAME="935496"><PRE><B>             char *path,
</B></PRE><A NAME="935526"><PRE><B>             char *type,
</B></PRE><A NAME="935497"><PRE><B>             int *num)
</B></PRE><a name="935501">
</a>Return a list of names of entries (variables and directories) in PDB file file that are of type type and that are in the </a>directory and match the variable name pattern specified by path.<p>
</a>
<a name="935542">
PDBLib supports an optional </a>hierarchical </a>directory structure inside PDB files. A directory or a variable in a directory may be specified by either a </a>relative path or an </a>absolute path. Slashes separate nodes in a </a>path name. Absolute paths begin with a slash. Nodes consisting of two periods, &#147;..&#148;, refer to the next higher level directory.<p>
</a>
<a name="935527">
The arguments to </a>PD_ls are: file, a pointer to a PDBfile; <em>path</em>, an ASCII string containing the path name of the directory to search and/or the variable name pattern to match; <em>type</em>, an ASCII string containing the type of entries to return; and num, a pointer to an integer to contain the number of entries returned.<p>
</a>
<a name="935530">
If path is NULL, the contents of the </a>current directory are listed. If type is NULL, all types are returned.<p>
</a>
<a name="935500">
The terminal node of path may contain meta characters &#147;*&#148; and &#147;?&#148;. Each &#147;*&#148; matches any zero or more characters and each &#147;?&#148; matches any single character.<p>
</a>
<a name="935503">
For the sake of efficiency, the returned names are not duplicated. That is, the caller should not free the space associated with each of the individual strings, but should free the char ** pointer. This should be done using the SFREE macro as shown in the example.<p>
</a>
<a name="935502">
The return value is a pointer to an array of strings, if successful; otherwise, NULL is returned and the ASCII string PD_err contains any error message that was generated.<p>
</a>
<a name="935504">
See also </a>PD_cd, </a>PD_ln, </a>PD_mkdir, and </a>PD_pwd.<p>
</a>
<a name="935505">
<p>
</a>
<a name="935506">
int </a>PD_ls(PDBfile *file,<p>
</a>
<a name="935507">
          char *path,<p>
</a>
<a name="935509">
          char *type,<p>
</a>
<a name="935531">
          int *num)<p>
</a>
<A NAME="935510"><B>
</B><HR><A NAME="935511"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="935512"><PRE> 
</PRE><A NAME="935513"><PRE>    PDBfile *file;
</PRE><A NAME="935543"><PRE>    char **list;
</PRE><A NAME="935580"><PRE>    int num;
</PRE><A NAME="935514"><PRE>          .
</PRE><A NAME="935516"><PRE>          .
</PRE><A NAME="935517"><PRE>          .
</PRE><A NAME="935518"><PRE> /* get a list of all directories in the current directory */
</PRE><A NAME="935519"><PRE>     list = </a>PD_ls(file, NULL, &#147;Directory&#148;, &amp;num);
</PRE><A NAME="935521"><PRE>     if (list == NULL)
</PRE><A NAME="935522"><PRE>        printf(&#147;%s&#148;, PD_err);
</PRE><A NAME="935523"><PRE>          .
</PRE><A NAME="935541"><PRE>          .
</PRE><A NAME="935544"><PRE>          .
</PRE><A NAME="935545"><PRE>     SFREE(list);
</PRE><A NAME="935546"><PRE>          .
</PRE><A NAME="935548"><PRE>          .
</PRE><A NAME="935549"><PRE>          .
</PRE><A NAME="935550"><PRE> /* get a list of the variables of type char * in directory animals */
</PRE><A NAME="935551"><PRE>     list = </a>PD_ls(file, &#147;animals&#148;, &#147;char *&#148;, &amp;num);
</PRE><A NAME="935553"><PRE>     if (list == NULL)
</PRE><A NAME="935554"><PRE>        printf(&#147;%s&#148;, PD_err);
</PRE><A NAME="935555"><PRE>          .
</PRE><A NAME="935556"><PRE>          .
</PRE><A NAME="935559"><PRE>          .
</PRE><A NAME="935560"><PRE>     SFREE(list);
</PRE><A NAME="935577"><PRE>          .
</PRE><A NAME="935578"><PRE>          .
</PRE><A NAME="935579"><PRE>          .
</PRE><a name="935581">
<h2>4.21   PD_MKDIR</h2>
</a>
<A NAME="935583"><PRE><B>
</B></PRE><A NAME="935584"><PRE><B>int </a>PD_mkdir(PDBfile *file,
</B></PRE><A NAME="935594"><PRE><B>             char *dirname)
</B></PRE><a name="935595">
</a>Create a new directory in the specified PDB file.<p>
</a>
<a name="935596">
PDBLib supports an optional </a>hierarchical </a>directory structure inside PDB files. A directory or a variable in a directory may be specified by either a </a>relative path or an </a>absolute path. Slashes separate nodes in a </a>path name. Absolute paths begin with a slash. Nodes consisting of two periods, &#147;..&#148;, refer to the next higher level directory.<p>
</a>
<a name="935597">
The arguments to </a>PD_mkdir are: file, a pointer to a PDBfile and dirname, an ASCII string containing the path name of the new directory.<p>
</a>
<a name="935593">
The </a>root directory, &#147;/&#148;, does not have to be created.<p>
</a>
<a name="935598">
The return value is a TRUE if successful; otherwise, FALSE is returned and the ASCII string PD_err contains any error message that was generated.<p>
</a>
<a name="935599">
See also </a>PD_cd, </a>PD_ln, </a>PD_ls, and </a>PD_pwd.<p>
</a>
<a name="935600">
<p>
</a>
<a name="935602">
int </a>PD_mkdir(PDBfile *file,<p>
</a>
<a name="935604">
             char *dirname)<p>
</a>
<A NAME="935605"><B>
</B><HR><A NAME="935606"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="935607"><PRE> 
</PRE><A NAME="935608"><PRE>    PDBfile *file;
</PRE><A NAME="935609"><PRE>          .
</PRE><A NAME="935610"><PRE>          .
</PRE><A NAME="935611"><PRE>          .
</PRE><A NAME="935612"><PRE>     if (</a>PD_mkdir(file, &#147;/animals/mammals) == FALSE)
</PRE><A NAME="935613"><PRE>        printf(&#147;%s&#148;, PD_err);
</PRE><A NAME="935614"><PRE>          .
</PRE><A NAME="935615"><PRE>          .
</PRE><A NAME="935616"><PRE>          .
</PRE><a name="934232">
<h2>4.22   PD_OPEN</h2>
</a>
<A NAME="933834"><PRE><B>
</B></PRE><A NAME="932630"><PRE><B>PDBfile *</a>PD_open(char *filename,
</B></PRE><A NAME="932631"><PRE><B>                 char *mode)
</B></PRE><a name="933848">
</a>Open an existing PDB file or </a>create a new PDB file. Depending on the value of the mode argument, PDBLib attempts to open the file filename in read-only binary mode, open the file in append binary </a>mode, or create a new file in read-write binary mode. Any string which begins with &#147;</a>r&#148; causes the file to be opened in </a>read-only mode, any string beginning with &#147;</a>a&#148; causes the file to be opened in </a>append mode, and any string beginning with &#147;</a>w&#148; causes a file to be </a>created in </a>read-write mode. Next the beginning of the file is searched for the header which identifies the file as having been generated by PDBLib. The addresses of the structure chart and symbol table are then sought.<p>
</a>
<a name="933857">
The structure chart from the file is read in. The structure chart contains information about data types (e.g. floats), their sizes in bytes and their structures if any. By default there are six </a>primitive </a>data types that PDBLib knows about: short integers, integers, long integers, floating point numbers, double precision floating point numbers, characters, and pointers. The sizes of these types varies from machine to machine, but PDBLib hides this from the user.<p>
</a>
<a name="933863">
The symbol table from the file is read in. The symbol table contains the list of variables in the file, their types as defined in the structure chart, and dimensioning information for arrays. Each read from the file first consults the symbol table to see if the requested variable is present in the PDB file.<p>
</a>
<a name="933868">
Both the structure chart and the symbol table are implemented as hash tables, although their shapes are different. This makes lookups as efficient as possible given an unknown amount of data in the file.<p>
</a>
<a name="933871">
The arguments to </a>PD_open are: filename, an ASCII string, which is the name of the file to be created or opened; and mode, an ASCII string, which is the mode (either &#147;w&#148; for create, &#147;r&#148; for read-only or &#147;a&#148; for append).<p>
</a>
<a name="933878">
The function returns a pointer to a PDBfile. This PDBfile identifies the particular file to PDBLib. As such, if it is overwritten the file is lost. The number of PDB files which can be open simultaneously is machine or operating system dependent, but each open file has a unique PDBfile associated with it.<p>
</a>
<a name="933881">
If any aspect of the PDB file opening process fails a NULL pointer is returned and the ASCII string PD_err contains any error message that was generated.<p>
</a>
<a name="933884">
<p>
</a>
<a name="932633">
PDBfile *</a>PD_open(char *filename,<p>
</a>
<a name="932634">
                 char *mode)<p>
</a>
<A NAME="933889"><B>
</B><HR><A NAME="933893"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="933894"><PRE> 
</PRE><A NAME="933895"><PRE>    PDBfile *file;
</PRE><A NAME="933896"><PRE>           .
</PRE><A NAME="933897"><PRE>           .
</PRE><A NAME="933898"><PRE>           .
</PRE><A NAME="933899"><PRE>    if ((file = </a>PD_open(&#147;filenam&#148;, &#147;r&#148;)) == NULL)
</PRE><A NAME="933900"><PRE>       printf(&#147;%s&#148;, PD_err);
</PRE><A NAME="933901"><PRE>           .
</PRE><A NAME="933902"><PRE>           .
</PRE><A NAME="933903"><PRE>           .
</PRE><a name="935603">
<h2>4.23   PD_PWD</h2>
</a>
<A NAME="935617"><PRE><B>
</B></PRE><A NAME="935618"><PRE><B>char *PD_pwd(PDBfile *file)
</B></PRE><a name="935620">
</a>Return the </a>current </a>directory for the specified PDB file.<p>
</a>
<a name="935621">
PDBLib supports an optional </a>hierarchical </a>directory structure inside PDB files. A directory or a variable in a directory may be specified by either a </a>relative path or an </a>absolute path. Slashes separate nodes in a </a>path name. Absolute paths begin with a slash. Nodes consisting of two periods, &#147;..&#148;, refer to the next higher level directory.<p>
</a>
<a name="935622">
The argument to </a>PD_pwd is file, a pointer to a PDBfile.<p>
</a>
<a name="935619">
If no directory has been created, &#147;/&#148; is returned.<p>
</a>
<a name="935624">
The return value is a pointer to a string containing the path name of the current directory if successful; otherwise, NULL is returned and the ASCII string PD_err contains any error message that was generated.<p>
</a>
<a name="935625">
See also </a>PD_cd, </a>PD_ln, </a>PD_ls, and </a>PD_mkdir.<p>
</a>
<a name="935626">
<p>
</a>
<a name="935627">
int </a>PD_pwd(PDBfile *file)<p>
</a>
<A NAME="935629"><B>
</B><HR><A NAME="935630"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="935631"><PRE> 
</PRE><A NAME="935632"><PRE>    PDBfile *file;
</PRE><A NAME="935623"><PRE>    char *dirname;
</PRE><A NAME="935633"><PRE>          .
</PRE><A NAME="935635"><PRE>          .
</PRE><A NAME="935636"><PRE>          .
</PRE><A NAME="935637"><PRE>     if ((dirname = </a>PD_pwd(file)) == NULL)
</PRE><A NAME="935638"><PRE>        printf(&#147;%s&#148;, PD_err);
</PRE><A NAME="935639"><PRE>          .
</PRE><A NAME="935640"><PRE>          .
</PRE><A NAME="935641"><PRE>          .
</PRE><a name="933911">
<h2>4.24   PD_READ</h2>
</a>
<A NAME="933914"><PRE><B>
</B></PRE><A NAME="932635"><PRE><B>int </a>PD_read(PDBfile *file,
</B></PRE><A NAME="932636"><PRE><B>            char *name,
</B></PRE><A NAME="932637"><PRE><B>            void *var)
</B></PRE><a name="933921">
</a>Read all or part of a data entry from an open PDB file. The symbol table of the given PDB file is searched for the given name and if it is found the information there is used to read the proper number of bytes from the file, do any conversions, and put the result in memory pointed to by var.<p>
</a>
<a name="933057">
The arguments to </a>PD_read are: file, a pointer to a PDBfile which designates the PDB file from which to attempt the read; name, an ASCII string containing the specification of data to be read; and var, a pointer to the location where the data is to be placed.<p>
</a>
<a name="932809">
Note: In each </a>PD_read operation, the type of var must be a pointer to the type of the variable name.<p>
</a>
<a name="933053">
Note: PDBLib can only read part of an entry if the type of the terminal node is primitive or a structure which contains no indirections and whose descendant members contain no indirections. <p>
</a>
<a name="933929">
Note: When reading part of a variable, especially a structured variable, the path to the desired part must contain one array reference for each level of </a>indirection traversed.<p>
</a>
<a name="933933">
The return value is TRUE, if successful; otherwise, FALSE is returned and the ASCII string PD_err contains any error messages.<p>
</a>
<a name="934226">
See also </a>PD_read_alt, </a>PD_read_as, </a>PD_read_as_alt.<p>
</a>
<a name="933939">
<p>
</a>
<a name="932639">
int </a>PD_read(PDBfile *file,<p>
</a>
<a name="932641">
            char *name,<p>
</a>
<a name="932642">
            void *var)<p>
</a>
<A NAME="933944"><B>
</B><HR><A NAME="933948"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="933949"><PRE> 
</PRE><A NAME="933950"><PRE>     PDBfile *file;
</PRE><A NAME="933951"><PRE>     float x[20];
</PRE><A NAME="933952"><PRE>           .
</PRE><A NAME="933953"><PRE>           .
</PRE><A NAME="933954"><PRE>           .
</PRE><A NAME="933955"><PRE>     if (</a>PD_read(file, &#147;x&#148;, x) == FALSE)
</PRE><A NAME="933956"><PRE>        printf(&#147;%s&#148;, PD_err);
</PRE><A NAME="933957"><PRE>           .
</PRE><A NAME="933958"><PRE>           .
</PRE><A NAME="933959"><PRE>           .
</PRE><a name="932648">
<h2>4.25   PD_READ_ALT</h2>
</a>
<A NAME="932649"><PRE><B>
</B></PRE><A NAME="932650"><PRE><B>int </a>PD_read_alt(PDBfile *file,
</B></PRE><A NAME="932651"><PRE><B>                char *name,
</B></PRE><A NAME="932652"><PRE><B>                void *var,
</B></PRE><A NAME="932653"><PRE><B>                long *ind)
</B></PRE><a name="932654">
</a>Read all or part of a data entry from an open PDB file. The symbol table of the given PDB file is searched for the given name and if it is found the information there is used to read the proper number of bytes from the file, do any conversions, and put the result in memory pointed to by var.<p>
</a>
<a name="932676">
The arguments to </a>PD_read_alt are: file, a pointer to a PDBfile which designates the PDB file from which to attempt the read; name, an ASCII string containing the specification of the data to be read; var, a pointer to the location where the data is to be placed; and ind, an array of long integers consisting of three indexes (start, stop, and step) for each dimension of the entry.<p>
</a>
<a name="932677">
Note: In each </a>PD_read_alt operation, the type of var must be a pointer to the type of the variable name.<p>
</a>
<a name="933937">
Note: PDBLib can only read part of an entry if the type of the terminal node is primitive or a structure which contains no indirections and whose descendant members contain no indirections. <p>
</a>
<a name="932678">
Note: When reading part of a variable, especially a structured variable, the path to the desired part must contain one array reference for each level of </a>indirection traversed.<p>
</a>
<a name="932680">
The return value is TRUE, if successful; otherwise, FALSE is returned and the ASCII string PD_err contains any error messages.<p>
</a>
<a name="934225">
See also </a>PD_read, </a>PD_read_as, </a>PD_read_as_alt.<p>
</a>
<a name="932681">
<p>
</a>
<a name="932682">
int </a>PD_read_alt(PDBfile *file,<p>
</a>
<a name="932683">
                char *name,<p>
</a>
<a name="932684">
                void *var,<p>
</a>
<a name="932685">
                long *ind)<p>
</a>
<A NAME="932686"><B>
</B><HR><A NAME="932986"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="932990"><PRE> 
</PRE><A NAME="932991"><PRE>     PDBfile *file;
</PRE><A NAME="932995"><PRE>     long ind[3];
</PRE><A NAME="932996"><PRE>     float x[20];
</PRE><A NAME="932997"><PRE>           .
</PRE><A NAME="932998"><PRE>           .
</PRE><A NAME="933000"><PRE>           .
</PRE><A NAME="933040"><PRE>     ind[0] = 3;
</PRE><A NAME="933044"><PRE>     ind[1] = 18;
</PRE><A NAME="933334"><PRE>     ind[2] = 2;
</PRE><A NAME="933335"><PRE>     if (</a>PD_read_alt(file, &#147;x&#148;, x, ind) == FALSE)
</PRE><A NAME="933336"><PRE>        printf(&#147;%s&#148;, PD_err);
</PRE><A NAME="933337"><PRE>           .
</PRE><A NAME="933338"><PRE>           .
</PRE><A NAME="933339"><PRE>           .
</PRE><a name="932598">
<h2>4.26   PD_READ_AS</h2>
</a>
<A NAME="932600"><PRE><B>
</B></PRE><A NAME="932601"><PRE><B>int </a>PD_read_as(PDBfile *file,
</B></PRE><A NAME="932602"><PRE><B>               char *name,
</B></PRE><A NAME="932603"><PRE><B>               char *type,
</B></PRE><A NAME="933098"><PRE><B>               void *var)
</B></PRE><a name="932604">
</a>Read data from an open PDB file. The symbol table of the given PDB file is searched for the given name and if it is found the information there is used with the type specified by type to read the proper number of bytes from the file, do any conversions, and put the result in memory pointed to by var. The type specified overrides the type in the symbol table entry as far as deciding on data conversions goes.<p>
</a>
<a name="933099">
This function is generally used to read floats as doubles and so on. However with sufficient care and understanding of both the file data and C data structuring, it can be used to transmute structured data.<p>
</a>
<a name="932606">
The arguments to </a>PD_read_as are: file, a pointer to a PDBfile which designates the PDB file from which to attempt the read; name, an ASCII string containing the specification for the data to be read;<em> type</em>, an ASCII string containing the type of the data desired; and var, a pointer to the location where the data is to be placed.<p>
</a>
<a name="932607">
Note: In each </a>PD_read_as operation, the type of var must be a pointer to the type specified by type.<p>
</a>
<a name="934313">
Note: PDBLib can only read part of an entry if the type of the terminal node is primitive or a structure which contains no indirections and whose descendant members contain no indirections. <p>
</a>
<a name="932608">
Note: When reading part of a variable, especially a structured variable, the path to the desired part must contain one array reference for each level of </a>indirection traversed.<p>
</a>
<a name="932609">
The return value is TRUE, if successful; otherwise, FALSE is returned and the ASCII string PD_err contains any error messages.<p>
</a>
<a name="934212">
See also </a>PD_read, </a>PD_read_alt, </a>PD_read_as_alt.<p>
</a>
<a name="932610">
<p>
</a>
<a name="933067">
int </a>PD_read_as(PDBfile *file,<p>
</a>
<a name="933069">
               char *name,<p>
</a>
<a name="933072">
               char *type,<p>
</a>
<a name="933095">
               void *var)<p>
</a>
<A NAME="933075"><B>
</B><HR><A NAME="933077"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="933078"><PRE> 
</PRE><A NAME="933079"><PRE>     PDBfile *file;
</PRE><A NAME="933081"><PRE>     float x[20];
</PRE><A NAME="933082"><PRE>           .
</PRE><A NAME="933083"><PRE>           .
</PRE><A NAME="933085"><PRE>           .
</PRE><A NAME="933086"><PRE> /* x is a double in the file */
</PRE><A NAME="933096"><PRE>     if (</a>PD_read_as(file, &#147;x&#148;, &#147;float&#148;, x) == FALSE)
</PRE><A NAME="933087"><PRE>        printf(&#147;%s&#148;, PD_err);
</PRE><A NAME="933090"><PRE>           .
</PRE><A NAME="933092"><PRE>           .
</PRE><A NAME="933094"><PRE>           .
</PRE><A NAME="932526"><PRE> 
</PRE><a name="932862">
<h2>4.27   PD_READ_AS_ALT</h2>
</a>
<A NAME="932870"><PRE><B>
</B></PRE><A NAME="933045"><PRE><B>int </a>PD_read_as_alt(PDBfile *file,
</B></PRE><A NAME="933049"><PRE><B>                   char *name,
</B></PRE><A NAME="933050"><PRE><B>                   char *type,
</B></PRE><A NAME="933051"><PRE><B>                   void *var,
</B></PRE><A NAME="933052"><PRE><B>                   long *ind)
</B></PRE><a name="933054">
</a>Read all or part of a data entry from an open PDB file. The symbol table of the given PDB file is searched for the given name and if it is found the information there is used with the type specified by type to read the proper number of bytes from the file, do any conversions, and put the result in memory pointed to by var. The type specified overrides the type in the symbol table entry as far as deciding on data conversions goes.<p>
</a>
<a name="933285">
This function is generally used to read floats as doubles and so on. However with sufficient care and understanding of both the file data and C data structuring, it can be used to transmute structured data.<p>
</a>
<a name="933309">
The arguments to </a>PD_read_as_alt are: file, a pointer to a PDBfile which designates the PDB file from which to attempt the read; name, an ASCII string containing the specification of the data to be read;<em> type</em>, an ASCII string containing the type of the data desired; var, a pointer to the location where the data is to be placed; and ind, an array of long integers consisting of three indexes (start, stop, and step) for each dimension of the entry.<p>
</a>
<a name="933310">
Note: In each </a>PD_read_as_alt operation, the type of var must be a pointer to the type specified by type.<p>
</a>
<a name="934314">
Note: PDBLib can only read part of an entry if the type of the terminal node is primitive or a structure which contains no indirections and whose descendant members contain no indirections. <p>
</a>
<a name="933311">
Note: When reading part of a variable, especially a structured variable, the path to the desired part must contain one array reference for each level of </a>indirection traversed.<p>
</a>
<a name="933312">
The return value is TRUE, if successful; otherwise, FALSE is returned and the ASCII string PD_err contains any error messages.<p>
</a>
<a name="933989">
See also </a>PD_read, </a>PD_read_as, </a>PD_read_alt.<p>
</a>
<a name="933313">
<p>
</a>
<A NAME="933314"><PRE><B>int </a>PD_read_as_alt(PDBfile *file,
</B></PRE><A NAME="933319"><PRE><B>                   char *name,
</B></PRE><A NAME="933320"><PRE><B>                   char *type,
</B></PRE><A NAME="933321"><PRE><B>                   void *var,
</B></PRE><A NAME="933322"><PRE><B>                   long *ind)
</B></PRE><A NAME="933323"><B>
</B><HR><A NAME="933324"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="933325"><PRE> 
</PRE><A NAME="933326"><PRE>     PDBfile *file;
</PRE><A NAME="933327"><PRE>     long ind[3];
</PRE><A NAME="933328"><PRE>     float x[20];
</PRE><A NAME="933329"><PRE>           .
</PRE><A NAME="933330"><PRE>           .
</PRE><A NAME="933331"><PRE>           .
</PRE><A NAME="933340"><PRE>     ind[0] = 2;
</PRE><A NAME="933341"><PRE>     ind[1] = 10;
</PRE><A NAME="933342"><PRE>     ind[2] = 2;
</PRE><A NAME="933343"><PRE> 
</PRE><A NAME="933344"><PRE> /* x is a double in the file */
</PRE><A NAME="933345"><PRE>     if (</a>PD_read_as_alt(file, &#147;x&#148;, &#147;float&#148;, x, ind) == FALSE)
</PRE><A NAME="933346"><PRE>        printf(&#147;%s&#148;, PD_err);
</PRE><A NAME="933572"><PRE>           .
</PRE><A NAME="933579"><PRE>           .
</PRE><A NAME="933593"><PRE>           .
</PRE><a name="934188">
<h2>4.28   PD_RESET_PTR_LIST</h2>
</a>
<A NAME="936825"><PRE><B>
</B></PRE><A NAME="936827"><PRE><B>int </a>PD_reset_ptr_list(PDBfile *file)
</B></PRE><a name="936829">
Free the list of pointers which the PDB file file knows about. This includes both pointers in memory acquired during write operations and pointers in the file acquired during read operations.<p>
</a>
<a name="936830">
Rationale: When reading or writing indirectly referenced data, PDBLib, maintains an array of pointers encountered in write operations and an array of pointers encountered in read operations.  This is done on a per file basis. These arrays are the basis on which PDBLIb can determine how to preserve the connectivity of data trees when they are moved between memory and files. Because of the difference between memory and disk files, it is important for applications to be able to clear out these arrays and start over. See the discussion on </a>Using Pointers earlier in the manual.<p>
</a>
<a name="936828">
The argument to this function is file a pointer to a PDBfile.<p>
</a>
<a name="936832">
The return value is TRUE if successful, and FALSE otherwise.<p>
</a>
<a name="936833">
<p>
</a>
<A NAME="936834"><PRE><B>int </a>PD_reset_ptr_list(PDBfile *file)
</B></PRE><A NAME="936835"><B>
</B><HR><A NAME="936836"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="936837"><PRE> 
</PRE><A NAME="936839"><PRE>    PDBfile *file;
</PRE><A NAME="936840"><PRE>            .
</PRE><A NAME="936841"><PRE>            .
</PRE><A NAME="936842"><PRE>            .
</PRE><A NAME="936843"><PRE>     if (</a>PD_reset_ptr_list(file) == FALSE)
</PRE><A NAME="936844"><PRE>        printf(&#147;%s&#148;, PD_err);
</PRE><A NAME="936845"><PRE>            .
</PRE><A NAME="936846"><PRE>            .
</PRE><a name="934569">
<h2>4.29   PD_REM_ATTRIBUTE</h2>
</a>
<A NAME="934570"><PRE><B>
</B></PRE><A NAME="934571"><PRE><B>int </a>PD_rem_attribute(PDBfile *file,
</B></PRE><A NAME="934573"><PRE><B>                     char *attr)
</B></PRE><a name="934574">
</a>Remove the specified </a>attribute. Any entities which have a value for this </a>attribute will have it removed by PDBLib.<p>
</a>
<a name="934575">
The </a>model of an attribute in PDBLib is an entity that has a name and type. The two supported operations on attributes are to create them and to remove them. An entity in a PDB file can be assigned an </a>attribute value simply by calling </a>PD_set_attribute. The only association between an entry in a PDB file and any attribute is made by the name in the attribute table and the entry in the symbol table. In particular, this mechanism allows the application developer to define and use entities in a PDB file solely in terms of attributes.<p>
</a>
<a name="934577">
The arguments to this function are: file, a pointer to a PDBfile; and attr, an ASCII string containing the name of the attribute being removed.<p>
</a>
<a name="934578">
The return value is TRUE if successful, and FALSE otherwise.<p>
</a>
<a name="934572">
See also </a>PD_def_attribute, </a>PD_get_attribute, and </a>PD_set_attribute.<p>
</a>
<a name="934950">
<p>
</a>
<A NAME="934948"><PRE><B>int </a>PD_rem_attribute(PDBfile *file,
</B></PRE><A NAME="934993"><PRE><B>                     char *attr)
</B></PRE><A NAME="934976"><B>
</B><HR><A NAME="934977"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="934979"><PRE> 
</PRE><A NAME="934980"><PRE>    PDBfile *file;
</PRE><A NAME="934981"><PRE>            .
</PRE><A NAME="934986"><PRE>            .
</PRE><A NAME="934987"><PRE>            .
</PRE><A NAME="934988"><PRE>     if (</a>PD_rem_attribute(file, &#147;date&#148;) == FALSE)
</PRE><A NAME="934989"><PRE>        printf(&#147;%s&#148;, PD_err);
</PRE><A NAME="934990"><PRE>            .
</PRE><A NAME="934991"><PRE>            .
</PRE><A NAME="934992"><PRE>            .
</PRE><a name="934580">
<h2>4.30   PD_SET_ATTRIBUTE</h2>
</a>
<A NAME="934581"><PRE><B>
</B></PRE><A NAME="934582"><PRE><B>int </a>PD_set_attribute(PDBfile *file,
</B></PRE><A NAME="934583"><PRE><B>                     char *vr,
</B></PRE><A NAME="934585"><PRE><B>                     char *attr,
</B></PRE><A NAME="934598"><PRE><B>                     void *vl)
</B></PRE><a name="934593">
</a>Set the value of the specified </a>attribute for the named entity. Attribute values are always assigned by </a>reference.<p>
</a>
<a name="934592">
The </a>model of an attribute in PDBLib is an entity that has a name and type. The two supported operations on attributes are to create them and to remove them. An entity in a PDB file can be assigned an </a>attribute value simply by calling </a>PD_set_attribute. The only association between an entry in a PDB file and any attribute is made by the name in the attribute table and the entry in the symbol table. In particular, this mechanism allows the application developer to define and use entities in a PDB file solely in terms of attributes.<p>
</a>
<a name="934595">
The arguments to this function are: file, a pointer to a PDBfile; vr, an ASCII string containing the name of an entity in the PDB file; attr, an ASCII string containing the name of the attribute being set; and vl, a pointer to data whose type matches the attribute type.<p>
</a>
<a name="934596">
The return value is TRUE if successful and FALSE otherwise.<p>
</a>
<a name="934597">
See also </a>PD_def_attribute, </a>PD_rem_attribute, and </a>PD_get_attribute.<p>
</a>
<a name="934969">
<p>
</a>
<A NAME="934968"><PRE><B>int </a>PD_set_attribute(PDBfile *file,
</B></PRE><A NAME="935012"><PRE><B>                     char *vr,
</B></PRE><A NAME="935013"><PRE><B>                     char *attr,
</B></PRE><A NAME="935014"><PRE><B>                     void *vl)
</B></PRE><A NAME="934997"><B>
</B><HR><A NAME="934998"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="934999"><PRE> 
</PRE><A NAME="935000"><PRE>    PDBfile *file;
</PRE><A NAME="935001"><PRE>    char *dt;
</PRE><A NAME="935002"><PRE>            .
</PRE><A NAME="935003"><PRE>            .
</PRE><A NAME="935004"><PRE>            .
</PRE><A NAME="935005"><PRE>     dt = SC_strsave(&#147;Mon March 23, 1921&#148;);
</PRE><A NAME="934975"><PRE>     if (</a>PD_set_attribute(file, &#147;foo&#148;, &#147;date&#148;, dt) == FALSE)
</PRE><A NAME="935007"><PRE>        printf(&#147;%s&#148;, PD_err);
</PRE><A NAME="935008"><PRE>            .
</PRE><A NAME="935009"><PRE>            .
</PRE><A NAME="935011"><PRE>            .
</PRE><a name="934174">
<h2>4.31   PD_TARGET</h2>
</a>
<A NAME="934175"><PRE><B>
</B></PRE><A NAME="932671"><PRE><B>int </a>PD_target(data_standard *std,
</B></PRE><A NAME="932672"><PRE><B>              data_alignment *align)
</B></PRE><a name="934186">
Write the next PDB file according to the specified data standard and alignment. PDBLib has a general binary data conversion mechanism called </a>parametrized </a>data </a>conversion (</a>PDC). The an integer type is described by one set of parameters and a floating point type is described by another. A general purpose conversion routine takes the description of the input type and a description of the desired output type and does the conversion. In this way, PDBLib avoids an N2 increase in data conversion routines as it ports to new machines. In fact, the number of data standards and alignments grows more slowly than N because many machines share common formats.<p>
</a>
<a name="934190">
An additional advantage to PDC is that by specifying a format involving the minimal number of bits to represent the data for a file, PDBLib can carry out a large class of </a>data </a>compressions.<p>
</a>
<a name="934196">
For programmer convenience, PDBLib carries several data standards and alignments. </a>Data standards: </a>IEEEA_STD, </a>IEEEB_STD, </a>IEEEC_STD, </a>INTELA_STD, </a>INTELB_STD, </a>VAX_STD, and </a>CRAY_STD. </a>Data </a>alignments: </a>DEF_ALIGNMENT, </a>SPARC_ALIGNMENT, </a>MIPS_ALIGNMENT, </a>M68000_ALIGNMENT, </a>INTEL_ALIGNMENT, and </a>CRAY_ALIGNMENT.<p>
</a>
<a name="934198">
Some common </a>configurations are:<p>
</a>
<dl>
<a name="934203">
<dt> Motorola					- </a>PD_target(&amp;IEEEA_STD, &amp;M68000_ALIGNMENT)
</a>
<a name="934204">
<dt> SPARC					- PD_target(&amp;IEEEA_STD, &amp;SPARC_ALIGNMENT)
</a>
<a name="933307">
<dt>MIPS, SGI					- PD_target(&amp;IEEEA_STD, &amp;MIPS_ALIGNMENT)
</a>
<a name="934205">
<dt>IBM RS6000					- PD_target(&amp;IEEEA_STD, &amp;RS6000_ALIGNMENT)
</a>
<a name="934206">
<dt>Mac/Think C					- PD_target(&amp;IEEEB_STD, &amp;M68000_ALIGNMENT)
</a>
<a name="934207">
<dt>Mac/MPW					- PD_target(&amp;IEEEC_STD, &amp;M68000_ALIGNMENT)
</a>
<a name="934208">
<dt>DOS					- PD_target(&amp;INTELA_STD, &amp;INTEL_ALIGNMENT)
</a>
<a name="934209">
<dt>Intel 80x86 UNIX					- PD_target(&amp;INTELB_STD, &amp;INTEL_ALIGNMENT)
</a>
<a name="934210">
<dt>DEC Vax					- PD_target(&amp;VAX_STD, &amp;DEF_ALIGNMENT)
</a>
<a name="934211">
<dt>DEC 3100					- PD_target(&amp;INTELB_STD, &amp;MIPS_ALIGNMENT)
</a>
<a name="934213">
<dt>UNICOS Cray					- </a>PD_target(&amp;CRAY_STD, &amp;UNICOS_ALIGNMENT)
</a>
<a name="934219">
The argument, std, is a pointer to a data_standard structure, and the argument, align, is a pointer to a data_alignment structure. See the section on Data Structures.<p>
</a>
<a name="933333">
The return value is TRUE, if successful; otherwise, FALSE is returned and the ASCII string PD_err contains any error messages.<p>
</a>
<a name="934224">
<p>
</a>
<a name="932674">
int </a>PD_target(data_standard *std,<p>
</a>
<a name="932675">
              data_alignment *align)<p>
</a>
<A NAME="934229"><B>
</B><HR><A NAME="934233"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="934234"><PRE> 
</PRE><A NAME="934235"><PRE> void test_target(tgt, base, n, fname, datfile)
</PRE><A NAME="934236"><PRE>    char *tgt, *base;
</PRE><A NAME="934237"><PRE>    int n;
</PRE><A NAME="934238"><PRE>    char *fname, *datfile;
</PRE><A NAME="934239"><PRE>    {if (tgt != NULL)
</PRE><A NAME="934240"><PRE> 
</PRE><A NAME="934241"><PRE> /* for DOS machines */
</PRE><A NAME="934242"><PRE>        {if (strcmp(tgt, &#147;dos&#148;) == 0)
</PRE><A NAME="934243"><PRE>            </a>PD_target(&amp;</a>INTEL_STD, &amp;</a>INTEL_ALIGNMENT);
</PRE><A NAME="934244"><PRE> 
</PRE><A NAME="934245"><PRE> /* for CRAY computers */
</PRE><A NAME="934246"><PRE>         else if (strcmp(tgt, &#147;cray&#148;) == 0)
</PRE><A NAME="934247"><PRE>            </a>PD_target(&amp;</a>CRAY_STD, &amp;</a>UNICOS_ALIGNMENT);
</PRE><A NAME="934248"><PRE> 
</PRE><A NAME="934249"><PRE> /* for DEC VAX machines */
</PRE><A NAME="934250"><PRE>         else if (strcmp(tgt, &#147;vax&#148;) == 0)
</PRE><A NAME="934251"><PRE>            </a>PD_target(&amp;</a>VAX_STD, &amp;</a>DEF_ALIGNMENT);
</PRE><A NAME="934252"><PRE> 
</PRE><A NAME="934253"><PRE> /* for MIPS based machines */
</PRE><A NAME="934254"><PRE>         else if (strcmp(tgt, &#147;mips&#148;) == 0)
</PRE><A NAME="934255"><PRE>            </a>PD_target(&amp;</a>IEEEA_STD, &amp;</a>MIPS_ALIGNMENT);
</PRE><A NAME="934256"><PRE> 
</PRE><A NAME="934257"><PRE> /* for standard M68000 machines */
</PRE><A NAME="934258"><PRE>         else if (strcmp(tgt, &#147;sun3&#148;) == 0)
</PRE><A NAME="934259"><PRE>            </a>PD_target(&amp;</a>IEEEA_STD, &amp;</a>M68000_ALIGNMENT);
</PRE><A NAME="934260"><PRE> 
</PRE><A NAME="934261"><PRE> /* for SPARC machines */
</PRE><A NAME="934262"><PRE>         else if (strcmp(tgt, &#147;sun4&#148;) == 0)
</PRE><A NAME="934263"><PRE>            </a>PD_target(&amp;</a>IEEEA_STD, &amp;</a>SPARC_ALIGNMENT);
</PRE><A NAME="934264"><PRE> 
</PRE><A NAME="934265"><PRE> /* for Macintosh */
</PRE><A NAME="934266"><PRE>         else if (strcmp(tgt, &#147;mac&#148;) == 0)
</PRE><A NAME="934267"><PRE>            </a>PD_target(&amp;</a>IEEEB_STD, &amp;</a>M68000_ALIGNMENT);
</PRE><A NAME="932593"><PRE> 
</PRE><A NAME="932594"><PRE>         sprintf(fname, &#147;%s-%s.rs%d&#148;, base, tgt, n);
</PRE><A NAME="934269"><PRE>         sprintf(datfile, &#147;%s-%s.db%d&#148;, base, tgt, n);}
</PRE><A NAME="934270"><PRE>     else
</PRE><A NAME="934271"><PRE>        {sprintf(fname, &#147;%s-nat.rs%d&#148;, base, n);
</PRE><A NAME="934272"><PRE>         sprintf(datfile, &#147;%s-nat.db%d&#148;, base, n);};
</PRE><A NAME="934273"><PRE> 
</PRE><A NAME="934274"><PRE>     return;}
</PRE><A NAME="934474"><PRE> 
</PRE></dl>
<a name="934415">
<h2>4.32   PD_TYPEDEF</h2>
</a>
<A NAME="934416"><PRE><B>
</B></PRE><a name="934445">
defstr *</a>PD_typedef(PDBfile *file,<p>
</a>
<a name="934502">
                   char *oname,<p>
</a>
<A NAME="934503"><PRE><B>                   char *tname)
</B></PRE><a name="934504">
</a>Define a an alternate name for an existing type. The intended use of this function is to allow users to make their PDB data types match their C types as closely as possible. It does this by mimicking the C </a>typedef mechanism in a limited way. More accurately it provides an </a>aliasing capability. This can be used in conjunction with either </a>PD_defix or </a>PD_defloat to install a definition of a data type in the host chart (</a>PD_defix and </a>PD_defloat define their types to the file chart only).<p>
</a>
<a name="934506">
Input to </a>PD_defix is: <em>file</em>, a pointer to a PDBfile; oname, an ASCII string containing the name of the original data type; tname, an ASCII string containing the name of the alias.<p>
</a>
<a name="934507">
A pointer to the original type&#146;s defstr is returned if the call is successful; otherwise, NULL is returned and the ASCII string PD_err contains any error message that was generated.<p>
</a>
<a name="934508">
<p>
</a>
<a name="934509">
defstr *</a>PD_typedef(PDBfile *file,<p>
</a>
<a name="934510">
                   char *oname,<p>
</a>
<a name="934511">
                   char *tname)<p>
</a>
<A NAME="934512"><B>
</B><HR><A NAME="934513"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="934515"><PRE> 
</PRE><A NAME="934516"><PRE>    PDBfile *file;
</PRE><A NAME="934517"><PRE>    defstr *ptr;
</PRE><A NAME="934518"><PRE>           .
</PRE><A NAME="934519"><PRE>           .
</PRE><A NAME="934520"><PRE>           .
</PRE><A NAME="934521"><PRE> /* define &#147;enum&#148; as an alias for &#147;integer&#148; */
</PRE><A NAME="934522"><PRE>     ptr = </a>PD_typedef(file, &#147;integer&#148;, &#147;enum&#148;);
</PRE><A NAME="934523"><PRE>           .
</PRE><A NAME="934524"><PRE>           .
</PRE><A NAME="934629"><PRE> 
</PRE><a name="934482">
<h2>4.33   PD_WRITE</h2>
</a>
<a name="934586">
<p>
</a>
<a name="934591">
int </a>PD_write(PDBfile *file,<p>
</a>
<a name="934587">
             char *name,<p>
</a>
<a name="934589">
             char *type,<p>
</a>
<a name="934590">
             void *var)<p>
</a>
<a name="932742">
</a>Write data to a PDB file. If an entry already exists in the file, the data overwrites the specified file data; otherwise, before writing data to the PDB file an entry is prepared for the symbol table consisting of the name, the type, the </a>dimension information, the disk address to which the data will be written, and the total number of bytes as computed with the help of the structure chart. After the entry is installed in the symbol table the data from memory is converted (only if the </a>target machine type is different from the current machine type) and then written out to disk starting at the current disk address.<p>
</a>
<a name="934505">
The </a>primitive </a>data types which the PDBLib system knows about by default are: &#147;short&#148;, &#147;integer&#148;, &#147;long&#148;, &#147;float&#148;, &#147;double&#148;, and &#147;char&#148; for short integer, integer, long integer, floating point or real number, double precision floating point number, and character or single byte respectively. Additional types may be added using </a>PD_defstr.<p>
</a>
<a name="934514">
PDBLib supports arbitrary levels of </a>indirections. This means that all types of pointers (except function pointers) can be traced down to the actual data to which they point and that data will be written out into the PDB file in such a way that the read operations can reconstruct the data as it exists prior to the write operation. There is one crucial restriction. That is that the memory associated with any pointer must have been allocated using a SCORE memory management function or macro. See the memory management section near the beginning of this document.<p>
</a>
<a name="934526">
Rationale: When writing out scalar variables (i.e. non-dimensioned variables - structured variables are scalars unless specifically dimensioned) this function is the most convenient to use since it involves no variable argument list and hence no worries about terminating the list. Another situation, which is more common than expected, in which </a>PD_write would be preferred is when it is desirable to make entries in a PDB file which do not correspond to any variables in the application program. Since string manipulations might be involved in preparing the name under which to write the data, coding in the dimensional information is not any less efficient.<p>
</a>
<a name="934531">
Dimensions can be given in two ways. If the default offset value for the PDB file can be taken as the minimum value for the range which a dimension index can legally run, the maximum value may be specified alone. Alternatively, the minimum value, maximum value, and stride (separated by colons) may be specified. The stride is optional and defaults to 1.<p>
</a>
<a name="934539">
The arguments to </a>PD_write are: file, a pointer to a PDBfile which designates the PDB file to which to attempt to write; name, an ASCII string containing the name of the variable to install in the symbol table; type, an ASCII string specifying the variable type; and var, a pointer to the data to be written. This pointer must be consistent with the type specified, that is it must be a pointer to data with type, type. For example:<p>
</a>
<a name="934543">
<dd>char **s, **t;<P>
</a>
<a name="934544">
<dd>integer *u;<P>
</a>
<a name="934546">
<dd><P>
</a>
<a name="932527">
<dd>PD_write(file, &#147;s&#148;, &#147;char **&#148;, &amp;s);<P>
</a>
<a name="934547">
<dd>PD_write(file, &#147;t(3)&#148;, &#147;char *&#148;, t);<P>
</a>
<a name="934548">
<dd>PD_write(file, &#147;u(30,1:10)&#148;, &#147;integer&#148;, u);<P>
</a>
<a name="934553">
The </a>dimension information is encoded in the ASCII string, name, as if in a FORTRAN dimension statement.<p>
</a>
<a name="934315">
Note: PDBLib can only write part of an entry if the type of the terminal node is primitive or a structure which contains no indirections and whose descendant members contain no indirections. <p>
</a>
<a name="934316">
Note: When writing part of a variable, especially a structured variable, the path to the desired part must contain one array reference for each level of </a>indirection traversed.<p>
</a>
<a name="932744">
The return value is TRUE if successful; otherwise, FALSE is returned and the ASCII string PD_err contains any error messages.<p>
</a>
<a name="933496">
See also </a>PD_write_alt and </a>PD_defent.<p>
</a>
<a name="932746">
<p>
</a>
<a name="933249">
int </a>PD_write(PDBfile *file,<p>
</a>
<a name="932747">
             char *name,<p>
</a>
<a name="932748">
             char *type,<p>
</a>
<a name="933046">
             void *var)<p>
</a>
<A NAME="933047"><B>
</B><HR><A NAME="933181"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="933185"><PRE> 
</PRE><A NAME="933189"><PRE>     PDBfile *file;
</PRE><A NAME="933227"><PRE>     float x[20];
</PRE><A NAME="933230"><PRE>           .
</PRE><A NAME="933235"><PRE>           .
</PRE><A NAME="933236"><PRE>           .
</PRE><A NAME="933237"><PRE>     if (!</a>PD_write(file, &#147;x(20)&#148;, &#147;float&#148;, x))
</PRE><A NAME="933238"><PRE>        printf(&#147;%s&#148;, PD_err);
</PRE><A NAME="933243"><PRE>           .
</PRE><A NAME="933247"><PRE>           .
</PRE><A NAME="933248"><PRE>           .
</PRE><a name="934557">
<p>
</a>
<a name="933347">
<h2>4.34   PD_WRITE_ALT</h2>
</a>
<A NAME="933377"><PRE><B>
</B></PRE><A NAME="933378"><PRE><B>int </a>PD_write_alt(PDBfile *file,
</B></PRE><A NAME="933379"><PRE><B>                 char *name,
</B></PRE><A NAME="933380"><PRE><B>                 char *type,
</B></PRE><A NAME="933381"><PRE><B>                 void *var,
</B></PRE><A NAME="933422"><PRE><B>                 int nd,
</B></PRE><A NAME="933423"><PRE><B>                 long *ind)
</B></PRE><a name="933382">
</a>Write data to a PDB file. This is an alternate form to </a>PD_write. If an entry already exists in the file, the data overwrites the specified file data; otherwise, before writing data to the PDB file an entry is prepared for the symbol table consisting of the name, the type, the </a>dimension information, the disk address to which the data will be written, and the total number of bytes as computed with the help of the structure chart. After the entry is installed in the symbol table the data from memory is converted (only if the </a>target machine type is different from the current machine type) and then written out to disk starting at the current disk address.<p>
</a>
<a name="933383">
The </a>primitive </a>data types which the PDBLib system knows about by default are: &#147;short&#148;, &#147;integer&#148;, &#147;long&#148;, &#147;float&#148;, &#147;double&#148;, and &#147;char&#148; for short integer, integer, long integer, floating point or real number, double precision floating point number, and character or single byte respectively. Additional types may be added using </a>PD_defstr.<p>
</a>
<a name="933384">
PDBLib supports arbitrary levels of </a>indirections. This means that, subject to the restrictions spelled out in the section on rules, pointers (except function pointers) can be traced down to the actual data to which they point and that data will be written out into the PDB file in such a way that the read operations can reconstruct the data as it exists prior to the write operation. There is one crucial restriction. That is that the memory associated with any pointer must have been allocated by a SCORE memory management function or macro. See the Memory Management section near the beginning of this document.<p>
</a>
<a name="933386">
The rationale for this function is that in some situations, it is desirable to be able to specify the dimensions without building them into an ASCII string.<p>
</a>
<a name="933385">
The arguments to </a>PD_write_alt are: file, a pointer to a PDBfile which designates the PDB file to which to attempt to write; name, an ASCII string containing the name of the variable to install in the symbol table; type, an ASCII string specifying the variable type; var, a pointer to the data to be written; nd, then number of dimensions for the variable; and ind, an array of long integers containing (min, max, stride) triples specifying the ranges and strides of the dimensions. The pointer, var, must be consistent with the type specified, that is it must be a pointer to data with type, type. For example:<p>
</a>
<a name="933388">
<dd>char **s, **t;<P>
</a>
<a name="933389">
<dd>integer *u;<P>
</a>
<a name="933391">
<dd>PD_write_alt(file, &#147;s&#148;, &#147;char **&#148;, &amp;s, ...);<P>
</a>
<a name="933392">
<dd>PD_write_alt(file, &#147;t&#148;, &#147;char *&#148;, t, ...);<P>
</a>
<a name="933393">
<dd>PD_write_alt(file, &#147;u&#148;, &#147;integer&#148;, u, ...);<P>
</a>
<a name="934318">
Note: PDBLib can only write part of an entry if the type of the terminal node is primitive or a structure which contains no indirections and whose descendant members contain no indirections. <p>
</a>
<a name="933395">
Note: When writing part of a variable, especially a structured variable, the path to the desired part must contain one array reference for each level of </a>indirection traversed.<p>
</a>
<a name="934317">
The return value is TRUE if successful; otherwise, FALSE is returned and the ASCII string PD_err contains any error messages.<p>
</a>
<a name="933396">
<p>
</a>
<a name="933397">
int </a>PD_write_alt(PDBfile *file,<p>
</a>
<a name="933398">
                 char *name,<p>
</a>
<a name="933399">
                 char *type,<p>
</a>
<a name="933400">
                 void *var,<p>
</a>
<a name="933414">
                 int nd,<p>
</a>
<a name="933416">
                 long *ind)<p>
</a>
<A NAME="933401"><B>
</B><HR><A NAME="933402"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="933403"><PRE> 
</PRE><A NAME="933404"><PRE>     PDBfile *file;
</PRE><A NAME="933406"><PRE>     long ind[6];
</PRE><A NAME="933417"><PRE>     float x[20][5];
</PRE><A NAME="933407"><PRE>           .
</PRE><A NAME="933408"><PRE>           .
</PRE><A NAME="933409"><PRE>           .
</PRE><A NAME="933410"><PRE>     ind[0] = 0L;
</PRE><A NAME="933419"><PRE>     ind[1] = 19L;
</PRE><A NAME="933420"><PRE>     ind[2] = 1L;
</PRE><A NAME="933421"><PRE>     ind[3] = -2L;
</PRE><A NAME="934326"><PRE>     ind[4] = 2L;
</PRE><A NAME="934327"><PRE>     ind[5] = 1L;
</PRE><A NAME="933418"><PRE>     if (!</a>PD_write_alt(file, &#147;x&#148;, &#147;float&#148;, x, 2, ind))
</PRE><A NAME="933411"><PRE>        printf(&#147;%s&#148;, PD_err);
</PRE><A NAME="933412"><PRE>           .
</PRE><A NAME="933413"><PRE>           .
</PRE><A NAME="933415"><PRE>           .
</PRE><a name="933182">
<h2>4.35   PD_WRITE_AS</h2>
</a>
<A NAME="933165"><PRE><B>
</B></PRE><A NAME="933183"><PRE><B>int </a>PD_write_as(PDBfile *file,
</B></PRE><A NAME="933475"><PRE><B>                char *name,
</B></PRE><A NAME="933476"><PRE><B>                char *intype,
</B></PRE><A NAME="933477"><PRE><B>                char *outtype,
</B></PRE><A NAME="933478"><PRE><B>                void *var)
</B></PRE><a name="933172">
</a>Write the data pointed to by <em>var</em> under <em>name</em> and with <em>intype</em> in PDB file <em>file</em> as data of outtype.<p>
</a>
<a name="933264">
The rationale for this function is that in some situations, it is desirable to not only convert the formats of data of a specified type, but to convert between types. An example that occurs in practice often enough is converting a 32 bit int to a 32 bit long on a machine which only has a 16 bit int.<p>
</a>
<a name="933178">
Input to </a>PD_write_as is: <em>file</em>, a pointer to a PDBfile; <em>name</em>, an ASCII string containing the name of the variable in the PDB file; <em>intype</em>, an ASCII string containing the type of the variable; <em>outtype</em>, an ASCII string containing the output type of the variable; and <em>var</em>, a pointer to the location where the data is to be stored in memory.<p>
</a>
<a name="934320">
Note: PDBLib can only write part of an entry if the type of the terminal node is primitive or a structure which contains no indirections and whose descendant members contain no indirections. <p>
</a>
<a name="933162">
Note: When writing part of a variable, especially a structured variable, the path to the desired part must contain one array reference for each level of </a>indirection traversed.<p>
</a>
<a name="934319">
</a>PD_write_as returns TRUE if successful; otherwise, FALSE is returned and the ASCII string PD_err contains any error messages.<p>
</a>
<a name="933495">
See also </a>PD_write_as_alt and </a>PD_defent_alt.<p>
</a>
<a name="933176">
<p>
</a>
<a name="933175">
int </a>PD_write_as(PDBfile *file,<p>
</a>
<a name="933479">
                char *name,<p>
</a>
<a name="933480">
                char *intype,<p>
</a>
<a name="933481">
                char *outtype,<p>
</a>
<a name="933482">
                void *var)<p>
</a>
<A NAME="933173"><B>
</B><HR><A NAME="933250"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="933251"><PRE> 
</PRE><A NAME="933252"><PRE>     PDBfile *file;
</PRE><A NAME="933254"><PRE>     float x[20];
</PRE><A NAME="933255"><PRE>           .
</PRE><A NAME="933256"><PRE>           .
</PRE><A NAME="933257"><PRE>           .
</PRE><A NAME="933263"><PRE>     if (!</a>PD_write_as(file, &#147;x(20)&#148;, &#147;float&#148;, &#147;double&#148;, x))
</PRE><A NAME="933259"><PRE>        printf(&#147;%s&#148;, PD_err);
</PRE><A NAME="933260"><PRE>           .
</PRE><A NAME="933261"><PRE>           .
</PRE><A NAME="933262"><PRE>           .
</PRE><a name="933451">
<h2>4.36   PD_WRITE_AS_ALT</h2>
</a>
<A NAME="933452"><PRE><B>
</B></PRE><A NAME="933453"><PRE><B>int </a>PD_write_as_alt(PDBfile *file,
</B></PRE><A NAME="933483"><PRE><B>                    char *name,
</B></PRE><A NAME="933484"><PRE><B>                    char *intype,
</B></PRE><A NAME="933485"><PRE><B>                    char *outtype,
</B></PRE><A NAME="933486"><PRE><B>                    void *var,
</B></PRE><A NAME="933487"><PRE><B>                    int nd,
</B></PRE><A NAME="933488"><PRE><B>                    long *ind)
</B></PRE><a name="933454">
</a>Write the data pointed to by <em>var</em> under <em>name</em> and with <em>intype</em> in PDB file <em>file</em> as data of outtype. This is an alternate form of </a>PD_write_as.<p>
</a>
<a name="933455">
The rationale for this function is that in some situations, it is desirable to be able to specify the dimensions without building them into an ASCII string.<p>
</a>
<a name="933456">
Input to </a>PD_write_as_alt is: <em>file</em>, a pointer to a PDBfile; <em>name</em>, an ASCII string containing the name of the variable in the PDB file; <em>intype</em>, an ASCII string containing the type of the variable; <em>outtype</em>, an ASCII string containing the output type of the variable; <em>var</em>, a pointer to the location where the data is to be stored in memory; nd, an integer number of dimensions; and ind, an array of long integers specifying the ranges of each dimension (min, max, stride).<p>
</a>
<a name="934322">
Note: PDBLib can only write part of an entry if the type of the terminal node is primitive or a structure which contains no indirections and whose descendant members contain no indirections. <p>
</a>
<a name="933457">
Note: When writing part of a variable, especially a structured variable, the path to the desired part must contain one array reference for each level of </a>indirection traversed.<p>
</a>
<a name="934321">
PD_write_as_alt returns TRUE if successful; otherwise, FALSE is returned and the ASCII string PD_err contains any error messages.<p>
</a>
<a name="933458">
<p>
</a>
<a name="933459">
int </a>PD_write_as_alt(PDBfile *file,<p>
</a>
<a name="933489">
                    char *name,<p>
</a>
<a name="933490">
                    char *intype,<p>
</a>
<a name="933494">
                    char *outtype,<p>
</a>
<a name="933493">
                    void *var,<p>
</a>
<a name="933492">
                    int nd,<p>
</a>
<a name="933491">
                    long *ind)<p>
</a>
<A NAME="933460"><B>
</B><HR><A NAME="933461"><PRE> #include &#147;pdb.h&#148;
</PRE><A NAME="933462"><PRE> 
</PRE><A NAME="933463"><PRE>     PDBfile *file;
</PRE><A NAME="933387"><PRE>     long ind[6];
</PRE><A NAME="933390"><PRE>     float x[20][5];
</PRE><A NAME="933424"><PRE>           .
</PRE><A NAME="933466"><PRE>           .
</PRE><A NAME="933467"><PRE>           .
</PRE><A NAME="933468"><PRE>     ind[0] = 0L;
</PRE><A NAME="933469"><PRE>     ind[1] = 19L;
</PRE><A NAME="933613"><PRE>     ind[2] = 1L;
</PRE><A NAME="933614"><PRE>     ind[3] = -2L;
</PRE><A NAME="934328"><PRE>     ind[4] = 2L;
</PRE><A NAME="934329"><PRE>     ind[5] = 1L;
</PRE><A NAME="933470"><PRE>     if (!</a>PD_write_as_alt(file, &#147;x&#148;, &#147;float&#148;, &#147;double&#148;, x, 2, ind))
</PRE><A NAME="933471"><PRE>        printf(&#147;%s&#148;, PD_err);
</PRE><A NAME="933472"><PRE>           .
</PRE><A NAME="933473"><PRE>           .
</PRE><A NAME="933474"><PRE>           .
</PRE><a name="932587">
<h1>5.0   </a>Summary of the </a>FORTRAN </a>API</h1>
</a>
<a name="932589">
There is a hierarchy of routines in PDBLib from high to low level. The </a>high level routines form the API while the lower level routines are modularized to perform the actual work. It should be noted that the lower level routines are sufficiently well modularized so as to make it possible to build entirely different API&#146;s for PDBLib. <p>
</a>
<a name="932815">
The high level PDBLib routines have a strict </a>naming convention. All routines in the FORTRAN API begin with &#145;</a>PF&#146;.<p>
</a>
<a name="932590">
Note: many of these functions return integer values. The </a>implicit typing convention in FORTRAN would indicate that they return real values. Application programs must explicitly type these functions as integers.<p>
</a>
<a name="932595">
When an error condition is detected by PDBLib it saves a message in a global C character string. FORTRAN programs can access this </a>error message by invoking function </a><em>PFGERR</em>. The message contains the name of the function in which the error occurred thus eliminating the need for a cross reference document on error codes.  In this way applications programs can check for error conditions themselves and decide in what manner to use the PDBLib error messages instead of having error messages printed by the system routines. Error messages are not stacked and must be processed by the application before any other PDBLib calls are made in order to avoid potential overwrites. See the FORTRAN API section for more information about which routines return error messages<p>
</a>
<a name="934654">
<h2>5.1   Some Guidance in Using the FORTRAN API to PDBLib</h2>
</a>
<a name="934656">
PDBLib offers a great deal of flexibility to its users. In some cases the flexibility results in a bewildering assortment of function calls from which the application developer must choose. This section is intended to offer some guidance and enable developers to home in on the functions they need to use.<p>
</a>
<a name="934657">
<h3>5.1.1   Opening, Creating and Closing PDB Files</h3>
</a>
<a name="934658">
These are the most fundamental operations involving PDBLib. The function </a>PFOPEN is used to either open an existing file or create a new one. </a>PFCLOS is used to close a PDB file so that it can be recognized by PDBLib for future operations.<p>
</a>
<a name="934659">
PDBLib allows applications to specify the binary format in which a newly created file will be written. </a>PFTRGT does this work. It is not necessary to invoke </a>PFTRGT before creating a new PDB file.<p>
</a>
<a name="934662">
<h3>5.1.2   Writing Data to PDB Files</h3>
</a>
<a name="934663">
The following paragraphs describe a sequence of increasingly more elaborate output operations for PDB files. They are all compatible with one another so users can select the ones which match their needs best. The most straightforward operations are first.<p>
</a>
<a name="934664">
There are two forms for the most basic data writing operations. These have to do with how the application wants to handle the dimension specifications. The two functions are: </a>PFWRTA and </a>PFWRTD.<p>
</a>
<a name="934666">
PDBLib supports the notion of writing data of one type out into a file as another type. More precisely, an integer type of data can be written to a file in the format of any other integer type, and similarly for floating point types. The application must take all responsibility for ensuring the appropriateness of this type of conversion (e.g. underflows and overflows). The functions which support this are </a>PFWRAS and </a>PFWRAD.<p>
</a>
<a name="936499">
PDBLib allows applications to append data to existing entries. This is handy in situations where the total amount of data is not known in advance, but a logical ordering of the data is apparent which matches the order in which data will be written. The functions which do this are </a>PFAPPA,  </a>PFAPPD,  </a>PFAPAS and </a>PFAPAD.<p>
</a>
<a name="934667">
Finally, PDBLib allows applications to reserve space on disk and then let subsequent writes fill in that space with values. This is handy in instances where an application knows a logical structure for a data set but needs to write it out in smaller pieces and not necessarily in the order implied by its logical structure. The functions which let applications reserve space are </a>PFDEFA, and </a>PFDEFD. Reserved spaces may be written to with </a>PFWRTA,  </a>PFWRTD, </a>PFWRAS or </a>PFWRAD.<p>
</a>
<a name="934668">
<h3>5.1.3   Reading Data from PDB Files</h3>
</a>
<a name="932491">
Since data in a file has a definite size and shape, the reading operations in PDBLib are somewhat simpler than the writing operations. The functions </a>PFREAD,  </a>PFPTRD,  </a>PFRDAS,  and </a>PFRDAD, the counterparts of </a>PFWRTA,  </a>PFWRTD,  </a>PFWRAS,  and </a>PFWRAD, do all of the work in reading data from files.<p>
</a>
<a name="934671">
<h3>5.1.4   Defining New Data Types</h3>
</a>
<a name="934672">
To aid application developers in using structured data PDBLib lets applications define new data types in a PDBfile. New data types may either be derived from other existing data types or they may be primitive (integer types, floating point types, or byte sequences). To define derived types applications should use </a>PFDEFS.<p>
</a>
<a name="934675">
<h3>5.1.5   Defining Attributes</h3>
</a>
<a name="934677">
PDBLib supports a general mechanism for managing a class of data which is variously referred to as attributes or meta data. In a great many cases, the careful design of data structures obviates the need for this kind of data. Nevertheless, PDBLib supplies four functions to manage attributive data: </a>PFDATT, </a>PFRATT, </a>PFSVAT, and </a>PFGVAT.<p>
</a>
<a name="934653">
<h3>5.1.6   Queries</h3>
</a>
<a name="934660">
The FORTRAN API supports several query operations to help applications interpret the contents of a PDB file. The current functions are: </a>PFGBFS, </a>PFGERR, </a>PFGMOD, </a>PFGOFF, </a>PFITYP, and </a>PFIVAR.<p>
</a>
<a name="933691">
A few definitions must be given first to keep the following summary concise. Some of these will be elaborated upon in the next section.<p>
</a>
<a name="932847">
<p>
</a>
<A NAME="932849"></a>PDBfile: for the purposes of a program this is a collection of all the relevant information about one of these data files.See the section on Data Structures for more information.
<BR><A NAME="932848">
<BR><A NAME="932850"><strong></a>ASCII:</strong><em> </em>an array of characters
<BR><a name="932851">
<p>
</a>
<A NAME="932852"></a>VOID: any FORTRAN data type
<BR><a name="932858">
<p>
</a>
<A NAME="932860"><strong></a>LAST:</strong> the value 0
<BR><a name="932861">
<p>
</a>
<A NAME="932863"><strong></a>ENTRY: </strong>for the purposes of a program this is a collection of all the relevant information about a variable written to a PDB file.
<BR><a name="932846">
 <p>
</a>
<A NAME="932864"><strong></a>DEFSTR:</strong> for the purposes of a program this is a collection of all the relevant information about a data type in a PDB file.
<BR><a name="932865">
<p>
</a>
<A NAME="932868"><strong></a>REAL*8:</strong> an eight byte floating point number.
<BR><a name="932866">
<h2>5.2   </a>Function Summary</h2>
</a>
<a name="932867">
These routines form the </a>interface between FORTRAN applications programs and the PDBLib system.<p>
</a>
<A NAME="936511"><P><B></a>PFAPAD(fileid, nchr, name, ntype, type, space, nd, ind)
</B><BR><A NAME="936512"></a> </a>Append the data from spaceof type type to the entry name in a PDB file. In this alternate to </a>PFAPAS the dimensions are specified via the array ind.
<BR><dl>
<a name="936513">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="936514">
<dd>nchr, the number of characters in name,<P>
</a>
<a name="936515">
<dd>name, an ASCII string containing the name of the variable,<P>
</a>
<a name="936516">
<dd><em>ntype</em>, the number of characters in <em>type</em>,<P>
</a>
<a name="936517">
<dd><em>type</em>, an ASCII string containing the type of the variable in space,<P>
</a>
<a name="936518">
<dd><em>space</em>, the variable containing the data,<P>
</a>
<a name="936519">
<dd>nd, the number of dimensions of the entry,<P>
</a>
<a name="936520">
<dd>ind, an array containing (start, stop, step) index range triples for each dimension.<P>
</a>
<a name="936521">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="932925"><P><B></a>PFAPAS(fileid, nchr, name, ntype, type, space)
</B><BR><A NAME="932926"></a>Append the data from spaceof type type to the entry name in a PDB file. Dimensions 
are specified in the text of name.
<BR><a name="932928">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="932929">
<dd>nchr, the number of characters in name,<P>
</a>
<a name="932933">
<dd>name, an ASCII string containing the name of the variable and any dimensional information,<P>
</a>
<a name="936509">
<dd><em>ntype</em>, the number of characters in <em>type</em>,<P>
</a>
<a name="936510">
<dd><em>type</em>, an ASCII string containing the type of the variable in space,<P>
</a>
<a name="932934">
<dd><em>space</em>,the variable containing the data.<P>
</a>
<a name="932935">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="935061"><P><B></a>PFAPPA(fileid, nchr, name, space)
</B><BR><A NAME="935067"></a>Append data to an entry in a PDB file. In this alternate to </a>PFAPPD dimensions are 
specified in the text of name.
<BR><a name="935068">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="935069">
<dd>nchr, the number of characters in name,<P>
</a>
<a name="935070">
<dd>name, an ASCII string containing the name of the variable and any dimensional information,<P>
</a>
<a name="935071">
<dd><em>space</em>, the variable containing the data.<P>
</a>
<a name="935072">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="934867"><P><B></a>PFAPPD(fileid, nchr, name, space, nd, ind)
</B><BR><A NAME="934883"></a>Append data to an entry in a PDB file. The dimensions are specified via the array ind.
<BR><a name="935037">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="935048">
<dd>nchr, the number of characters in name,<P>
</a>
<a name="935059">
<dd>name, an ASCII string containing the name of the variable,<P>
</a>
<a name="935060">
<dd><em>space</em>, the variable containing the data,<P>
</a>
<a name="935073">
<dd>nd, the number of dimensions of the entry,<P>
</a>
<a name="935074">
<dd>ind, an array containing (start, stop, step) index range triples for each dimension.<P>
</a>
<a name="932869">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="932912"><P><B>[</a>PFCD(fileid, nchr, dirname)
</B><BR><A NAME="933640"></a>Change the </a>current </a>directory in a PDB file.
<BR><a name="934062">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="934101">
<dd>nchr, the number of characters in dirname,<P>
</a>
<a name="934364">
<dd>dirname, an ASCII string containing the path name of the directory to change to.<P>
</a>
<a name="934530">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="932871"><P><B></a>PFCLOS(fileid)
</B><BR><A NAME="932872"></a>Complete and close the PDB file<em> fileid</em>.
<BR><a name="932873">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number.
</a>
<a name="934913">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="935066"><P><B></a>PFDATT(fileid, na, attr, nt, type)
</B><BR><A NAME="934914">Define an attribute in a PDB file.
<BR><a name="934917">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="934926">
<dd><em>na</em>, an integer number of characters in attr,<P>
</a>
<a name="934927">
<dd>attr, an ASCII string naming the attribute,<P>
</a>
<a name="934919">
<dd><em>nt</em>, an integer number of characters in type,<P>
</a>
<a name="934921">
<dd>type, an ASCII string specifying the attribute type.<P>
</a>
<a name="934925">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="934144"><P><B></a>PFDEFA(fileid, nchr, name, ntype, outtype)
</B><BR><A NAME="934145"></a>Define an entry in the symbol table of a PDB file. This function </a>reserves space on disk 
but writes no data. The data can be written with later PDBLib calls.
<BR><a name="934146">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="934147">
<dd>nchr, the number of characters in name,<P>
</a>
<a name="934150">
<dd>name, an ASCII string containing the name of the variable and any dimensional information,<P>
</a>
<a name="934151">
<dd><em>ntype</em>, the number of characters in <em>outtype</em>,<P>
</a>
<a name="934148">
<dd>outtype, an ASCII string specifying the type of data in the file.<P>
</a>
<a name="934149">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="932883"><P><B></a>PFDEFD(fileid, nchr, name, ntype, outtype, nd, ind)
</B><BR><A NAME="934153"></a>Define an entry in the symbol table of a PDB file. This function </a>reserves space on disk 
but writes no data. The data can be written with later calls. In this alternate to </a>PFDEFA 
the dimensions are specified via the array ind.
<BR><a name="934154">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="934160">
<dd>nchr, the number of characters in name,<P>
</a>
<a name="934155">
<dd>name, an ASCII string containing the name of the variable (no dimensional information can be supplied with the name),<P>
</a>
<a name="934161">
<dd><em>ntype</em>, the number of characters in <em>outtype</em>,<P>
</a>
<a name="934156">
<dd>outtype, an ASCII string specifying the type of data in the file,<P>
</a>
<a name="934157">
<dd>nd, the number of dimensions of the entry,<P>
</a>
<a name="934158">
<dd>ind, an array containing (min, max) index range pairs for each dimension.<P>
</a>
<a name="934159">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="935099"><P><B></a>PFDEFS(fileid, nchr, name, ncm1, mem1, ..., ncmn, memn, LAST)
</B><BR><A NAME="935100"></a>Define a data structure for a PDB file. LAST must terminate the list of members.
<BR><a name="935104">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="935105">
<dd>nchr, the number of characters in name,<P>
</a>
<a name="935108">
<dd>name, an ASCII string containing the structure name,<P>
</a>
<a name="935146">
<dd>ncmi,the number of characters in memi,<P>
</a>
<a name="935147">
<dd>memi, an ASCII string containing the member declaration.<P>
</a>
<a name="935148">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="933063"><P><B></a>PFDEFT(fileid, nchr, name, nm, nc, memb)
</B><BR><A NAME="933064"></a>Define a data structure for a PDB file.
<BR><a name="933068">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="933303">
<dd>nchr, the number of characters in name,<P>
</a>
<a name="933304">
<dd>name, an ASCII string containing the structure name,<P>
</a>
<a name="933305">
<dd>nm,the number of members,<P>
</a>
<a name="935149">
<dd>nc, the array of offset, length pairs,<P>
</a>
<a name="933306">
<dd>memb, an ASCII string containing the member declarations.<P>
</a>
<a name="933288">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="935253"><P><B></a>PFDLS()
</B><BR><A NAME="935254"></a>Release table create by </a>PFLST.
<BR><a name="935271">
<dt>Input:	<em>None</em>.
</a>
<a name="935272">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="935348"><P><B></a>PFDVAR()
</B><BR><A NAME="935349"></a>Release table create by </a>PFVART.
<BR><a name="935350">
<dt>Input:	<em>None</em>.
</a>
<a name="935351">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="936236"><P><B></a>PFFAMI(fileid, flag)
</B><BR><A NAME="936237">If the <em>file indicated by</em> <em>fileid</em> has exceeded its size limit, open and return a new member 
of the </a>file family. If flag is TRUE close the old file.
<BR><a name="936238">
<dt>Input:	<em>fileid</em>, an integer file identifier
</a>
<a name="936247">
<dd>flag, an integer flag.<P>
</a>
<a name="936254">
<dt>Output:	an integer file identifier
</a>
<A NAME="935182"><P><B></a>PFFLSH(fileid)
</B><BR><A NAME="935183"></a>Flush the PDB file<em> fileid</em>.
<BR><a name="935185">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number.
</a>
<a name="935236">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="932874"><P><B></a>PFGBFS()
</B><BR><A NAME="932875"></a>Get the current buffer size which PDBLib uses for all PDB files and return it.
<BR><a name="932876">
<dt>Input:	<em>None.</em>
</a>
<a name="932877">
<dt>Output:	Return the current buffer size in bytes, if previously set; otherwise, return -1.
</a>
<A NAME="932878"><P><B></a>PFGERR(nchr, err)
</B><BR><A NAME="932879"></a>Get the current PDBLib error message. Return the length of the error message in <em>nchr</em> 
and the actual message in <em>err</em>. The space for <em>err</em> should be 255 characters long.
<BR><a name="932880">
<dt>Input:<em>	</em>None.
</a>
<a name="932882">
<dt>Output:	Return 1 if successful, 0 otherwise,
</a>
<a name="934152">
<dd><em>nchr</em>, the length of the error message,<P>
</a>
<a name="937567">
<dd><em>err</em>, an ASCII string into which the message is copied.<P>
</a>
<A NAME="937578"><P><B></a>PFGLS(n, nchr, name)
</B><BR><a name="935346">
<dt></a>Get the name of the nth entry in the internal table generated by </a>PFLST.
</a>
<a name="935347">
<dt>Input:	<em>n</em>, an integer ordinal index into the internal table.
</a>
<a name="935353">
<dt>Output:	Return 1 if successful, 0 otherwise,
</a>
<a name="935354">
<dd>nchr, the number of characters returned in name,<P>
</a>
<a name="935355">
<dd>name, an ASCII string to contain the entry name.<P>
</a>
<A NAME="934215"><P><B></a>PFGMOD(fileid)
</B><BR><A NAME="934216"></a>Get the current mode of PDB file<em> fileid</em>: 2 (append - &#146;a&#146;), 3 (open - &#146;r&#146;), 4 (create - &#146;w&#146;).
<BR><a name="934217">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number.
</a>
<a name="934218">
<dt>Output:	Return the integer value of the current mode.
</a>
<A NAME="937609"><P><B></a>PFGMXS(fileid)
</B><BR><a name="937610">
<dt></a>Get the current maximum file size of PDB file <em>fileid</em>.
</a>
<a name="937611">
<dt>Input:	<em>fileid</em>, an integer <strong>PDBfile</strong> identification number.
</a>
<a name="937612">
<dt>Output:	Return the integer value of the current maximum file size.
</a>
<A NAME="937584"><P><B></a>PFGNM(fileid, nchr, name)
</B><BR><A NAME="937586">Return the </a>name of a PDB file.
<BR><a name="937587">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="937588">
<dd>nchr, the number of characters in name,<P>
</a>
<a name="937589">
<dd>name, an ASCII string to contain the file name.<P>
</a>
<a name="937590">
<dt>Output:	Return 1 if successful, 0 otherwise,
</a>
<a name="937591">
<dd>name, an ASCII string containing the file name.<P>
</a>
<A NAME="937581"><P><B></a>PFGOFF(fileid)
</B><BR><A NAME="934201"></a>Get the current default offset for PDB file<em> fileid</em>.
<BR><a name="934202">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number.
</a>
<a name="934214">
<dt>Output:	Return the integer value of the default offset.
</a>
<A NAME="933271"><P><B></a>PFGVAR(n, nchr, name)
</B><BR><A NAME="933276"></a>Get the name of the nth variable in the internal sorted table generated by </a>PFVART.
<BR><a name="933278">
<dt>Input:	<em>n</em>, integer ordinal index into the internal sorted name table.
</a>
<a name="933279">
<dt>Output:	Return 1 if successful, 0 otherwise,
</a>
<a name="933280">
<dd>nchr, the number of characters in the name,<P>
</a>
<a name="935280">
<dd>name, an ASCII array in which the name is returned.<P>
</a>
<A NAME="934855"><P><B></a>PFGVAT(fileid, nv, var, na, attr, value)
</B><BR><A NAME="934862"></a>Get the value of an attribute for an entity in a PDB file.
<BR><a name="934895">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="934896">
<dd><em>nv</em>, an integer number of characters in var,<P>
</a>
<a name="934897">
<dd>var, an ASCII string naming an entity,<P>
</a>
<a name="934906">
<dd><em>na</em>, an integer number of characters in attr,<P>
</a>
<a name="934907">
<dd>attr, an ASCII string naming an existing attribute,<P>
</a>
<a name="934908">
<dd>value, the data for the attribute value.<P>
</a>
<a name="934909">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="936255"><P><B></a>PFIMBR(file, ntype, type, n, size, space)
</B><BR><A NAME="936256"></a>Inquire about the nth member of the type <em>type</em> in PDB file<em> fileid</em>.
<BR><a name="936257">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="936258">
<dd><em>ntype</em>, the number of characters in <em>type</em>,<P>
</a>
<a name="936260">
<dd><em>type</em>, an ASCII string containing the name of the type,<P>
</a>
<a name="936265">
<dd>n, an integer specifying the member,<P>
</a>
<a name="936267">
<dd>size, an integer character size of the space buffer,<P>
</a>
<a name="936268">
<dd>space, an character buffer to hold the member description.<P>
</a>
<a name="936261">
<dt>Output:	Return 1 if successful, 0 otherwise,
</a>
<a name="936262">
<dd><em>size</em>, the number of characters in the member description,<P>
</a>
<a name="936263">
<dd><em>space</em>, the member description.<P>
</a>
<A NAME="936264"><P><B></a>PFITYP(fileid, ntype, type, size, align, ind)
</B><BR><A NAME="932893"></a>Inquire about type <em>type</em> in PDB file<em> fileid</em>.
<BR><a name="932894">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="932895">
<dd><em>ntype</em>, the number of characters in <em>type</em>,<P>
</a>
<a name="932896">
<dd><em>type</em>, an ASCII string containing the name of the type.<P>
</a>
<a name="932897">
<dt>Output:	Return 1 if successful, 0 otherwise,
</a>
<a name="932898">
<dd><em>size</em>, the number of bytes necessary to represent the type,<P>
</a>
<a name="932899">
<dd><em>align</em>, the alignment of <em>type</em> in bytes,<P>
</a>
<a name="932900">
<dd><em>ind</em>, the number of members which are pointers if <em>type</em> is a derived type.<P>
</a>
<A NAME="932901"><P><B></a>PFIVAR(fileid, nchr, name, ntype, type, size, ndims, dims)
</B><BR><A NAME="932902"></a>Inquire about variable <em>name</em> in PDB file<em> fileid</em>.
<BR><a name="932903">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="932905">
<dd><em>nchr</em>, the number of characters in <em>name</em>,<P>
</a>
<a name="932906">
<dd><em>name</em>, an ASCII string containing the name of the variable.<P>
</a>
<a name="932908">
<dt>Output:	Return 1 if successful, 0 otherwise,
</a>
<a name="932909">
<dd><em>ntype</em>, the number of characters in <em>type</em>,<P>
</a>
<a name="932910">
<dd><em>type</em>, an ASCII string containing the type of the variable,<P>
</a>
<a name="932911">
<dd><em>size</em>, the number of elements in the variable,<P>
</a>
<a name="932913">
<dd><em>ndims</em>, the number of dimensions which the variable has,<P>
</a>
<a name="932914">
<dd><em>dims</em>, an array of the dimensions given as (min, max) pairs.<P>
</a>
<A NAME="935326"><P><B></a>PFLN(fileid, nvar, var, nlink, link)
</B><BR><A NAME="935327"></a>Create a </a>link to a variable in a PDB file.
<BR><a name="935328">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="935329">
<dd>nvar, the number of characters in var,<P>
</a>
<a name="935330">
<dd>var, an ASCII string containing the path name of an existing variable,<P>
</a>
<a name="935331">
<dd>nlink, the number of characters in link,<P>
</a>
<a name="935332">
<dd>link, an ASCII string containing the path name of the new link.<P>
</a>
<a name="935333">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="935334"><P><B></a>PFLST(fileid, npath, path, ntype, type, num)
</B><BR><a name="935335">
<dt></a>Generate an internal table of </a>variables and/or </a>directories in a PDB file.
</a>
<a name="935336">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="935337">
<dd>npath, the number of characters in path,<P>
</a>
<a name="935338">
<dd>path, an ASCII string containing the directory and/or variable name pattern,<P>
</a>
<a name="935340">
<dd>ntype, the number of characters in type,<P>
</a>
<a name="935341">
<dd>type, an ASCII string containing the type of entries to return.<P>
</a>
<a name="935342">
<dt>Output:	Return 1 if successful, 0 otherwise,
</a>
<a name="935344">
<dd>num, the number of entries in the table.<P>
</a>
<A NAME="935356"><P><B></a>PFMKDR(fileid, nchr, dirname)
</B><BR><A NAME="935357"></a>Create a new </a>directory in a PDB file.
<BR><a name="935359">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="935360">
<dd>nchr, the number of characters in dirname,<P>
</a>
<a name="935361">
<dd>dirname, an ASCII string containing the path name of the new directory.<P>
</a>
<a name="935375">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="932915"><P><B></a>PFOPEN(nchr, name, mode)
</B><BR><A NAME="932917"></a>Open a PDB file on disk named <em>name</em> in one of three </a>modes: &#145;</a>w&#146; for </a>create, &#145;</a>r&#146; for </a>read-
only, or &#145;</a>a&#146; for </a>append.
<BR><a name="932919">
<dt>Input:	<em>nchr</em>, the number of characters in name,
</a>
<a name="932920">
<dd><em>name</em>, an ASCII string naming the file,<P>
</a>
<a name="932922">
<dd><em>mode</em>, an ASCII string, either &#145;w&#146; for create, &#145;r&#146; for read, or &#145;a&#146; for append.<P>
</a>
<a name="932924">
<dt>Output:	Return an integer PDBfile identification number, if successful, and 0 otherwise.
</a>
<A NAME="932937"><P><B></a>PFPTRD(fileid, nchr, name, space, ind)
</B><BR><A NAME="932938"></a>Read <em>part of variable</em> <em>name</em> from PDB file <em>fil</em>eid and put it into <em>space</em>.
<BR><a name="932939">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="932940">
<dd><em>nchr</em>, the number of characters in <em>name</em>,<P>
</a>
<a name="932941">
<dd><em>name</em>, an ASCII string containing the name of the variable in the PDB file,<P>
</a>
<a name="932944">
<dd><em>space</em>, the variable where the data is to be placed,<P>
</a>
<a name="932946">
<dd><em>ind</em>, the array of dimension index specifications (start, stop, step triplets for each dimension).<P>
</a>
<a name="932948">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="935362"><P><B></a>PFPWD(fileid, nchr, dirname)
</B><BR><A NAME="935369"></a>Get the </a>current </a>directory for a PDB file.
<BR><a name="935392">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number.
</a>
<a name="935273">
<dt>Output:	Return 1 if successful, 0 otherwise,
</a>
<a name="935413">
<dd>nchr, the number of characters returned in dirname,<P>
</a>
<a name="935414">
<dd>dirname, an ASCII string to contain the path name of the current directory.<P>
</a>
<A NAME="934910"><P><B></a>PFRATT(fileid, na, attr)
</B><BR><A NAME="934911">Remove an attribute from a PDB file.
<BR><a name="934912">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="934915">
<dd><em>na</em>, an integer number of characters in attr,<P>
</a>
<a name="934916">
<dd>attr, an ASCII string naming an existing attribute.<P>
</a>
<a name="934918">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="936500"><P><B></a>PFRDAD(fileid, nchr, name, ntype, type, space, ind)
</B><BR><A NAME="936794"></a>Read <em>part of variable</em> <em>name</em> from PDB file <em>fil</em>eid as variable type type and put it into 
<em>space</em>.
<BR><a name="936501">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="936502">
<dd><em>nchr</em>, the number of characters in <em>name</em>,<P>
</a>
<a name="936503">
<dd><em>name</em>, an ASCII string containing the name of the variable in the PDB file,<P>
</a>
<a name="936504">
<dd><em>ntype</em>, the number of characters in <em>type</em>,<P>
</a>
<a name="936505">
<dd><em>type</em>, an ASCII string containing the type of the variable in space,<P>
</a>
<a name="936506">
<dd><em>space</em>, the variable where the data is to be placed,<P>
</a>
<a name="936507">
<dd><em>ind</em>, the array of dimension index specifications (start, stop, step triplets for each dimension).<P>
</a>
<a name="936508">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="936482"><P><B></a>PFRDAS(fileid, nchr, name, ntype, type, space)
</B><BR><A NAME="936483"></a>Read variable <em>name</em> from PDB file<em> fileid</em> as variable type type and put it into <em>space</em>.
<BR><a name="936484">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="936486">
<dd><em>nchr</em>, the number of characters in <em>name</em>,<P>
</a>
<a name="936487">
<dd><em>name</em>, an ASCII string containing the name of the variable in the PDB file,<P>
</a>
<a name="936497">
<dd><em>ntype</em>, the number of characters in <em>type</em>,<P>
</a>
<a name="936498">
<dd><em>type</em>, an ASCII string containing the type of the variable in space,<P>
</a>
<a name="936488">
<dd><em>space</em>, the variable where the data is to be placed.<P>
</a>
<a name="936489">
<dt>Output: Return 1 if successful, 0 otherwise.
</a>
<A NAME="936490"><P><B></a>PFREAD(fileid, nchr, name, space)
</B><BR><A NAME="936491"></a>Read variable <em>name</em> from PDB file<em> fileid</em> and put it into <em>space</em>.
<BR><a name="936492">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="936493">
<dd><em>nchr</em>, the number of characters in <em>name</em>,<P>
</a>
<a name="936494">
<dd><em>name</em>, an ASCII string containing the name of the variable in the PDB file,<P>
</a>
<a name="936495">
<dd><em>space</em>, the variable where the data is to be placed.<P>
</a>
<a name="936496">
<dt>Output: Return 1 if successful, 0 otherwise.
</a>
<A NAME="932950"><P><B></a>PFSBFS(v)
</B><BR><A NAME="932952"></a>Set the buffer size which PDBLib will use for all PDB files to <em>v</em>.
<BR><a name="932953">
<dt>Input:	<em>v</em>, an integer value for the buffer size in bytes.
</a>
<a name="932954">
<dt>Output:	Return the integer value of the buffer size in bytes.
</a>
<A NAME="937619"><P><B></a>PFSMXS(fileid, v)
</B><BR><a name="937620">
<dt></a>Set the maximum file size for PDB file <em>fileid</em> to <em>v</em>.
</a>
<a name="937621">
<dt>Input:	<em>fileid</em>, an integer <strong>PDBfile</strong> identification number.
</a>
<a name="937622">
<dd><em>v</em>, an integer value for the maximum file size.<P>
</a>
<a name="937623">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="932956"><P><B></a>PFSOFF(fileid, v)
</B><BR><A NAME="932957"></a>Set the default offset for PDB file<em> fileid</em> to <em>v</em>.
<BR><a name="932958">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="932959">
<dd><em>v</em>, an integer value for the default offset.<P>
</a>
<a name="932960">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="934898"><P><B></a>PFSVAT(fileid, nv, var, na, attr, value)
</B><BR><A NAME="934899"></a>Set the value of an attribute for an entity in a PDB file.
<BR><a name="934900">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="934902">
<dd><em>nv</em>, an integer number of characters in var,<P>
</a>
<a name="934904">
<dd>var, an ASCII string naming an entity,<P>
</a>
<a name="934894">
<dd><em>na</em>, an integer number of characters in attr,<P>
</a>
<a name="934905">
<dd>attr, an ASCII string naming an existing attribute,<P>
</a>
<a name="934863">
<dd>value, the data for the attribute value.<P>
</a>
<a name="934903">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="933289"><P><B></a>PFTRGT(is, ia)
</B><BR><A NAME="933290">Write the next PDB file to be created according to the specified </a>data standard and </a>alignment.
<BR><a name="933291">
<dt>Input:	<em>is</em>, an index specifying the data standard,
</a>
<a name="933292">
<dd><em>ia</em>, an index specifying the data alignment.<P>
</a>
<a name="933293">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="932885"><P><B></a>PFVART(fileid, order, nvars)
</B><BR><A NAME="932886"></a>Generate an internal </a>table of </a>variables in PDB file<em> fileid</em> which is sorted according to the 
specification, order.
<BR><a name="932887">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="932889">
<dd>order, an integer specifying the order (1, alphabetic; 2, disk address order).<P>
</a>
<a name="933267">
<dt>Output:	Return 1 if successful, 0 otherwise,
</a>
<a name="935283">
<dd>nvars, the number of variables in the file.<P>
</a>
<A NAME="932962"><P><B></a>PFWIMA(fileid, nchr, name, pkn, pkx, pln, plx, data, pxn, pxx, pyn, pyx, pim)
</B><BR><A NAME="932963">Write the given information out to file<em> fileid</em> as a PD_image.
<BR><a name="932964">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="932966">
<dd><em>nchr</em>, the number of characters in the image name,<P>
</a>
<a name="932968">
<dd><em>name</em>, an ASCII string containing the </a>image name,<P>
</a>
<a name="932969">
<dd><em>pkn</em>, an integer containing the minimum column index of data,<P>
</a>
<a name="932970">
<dd><em>pkx</em>, an integer containing the maximum column index of data,<P>
</a>
<a name="933646">
<dd><em>pln</em>, an integer containing the minimum row index of data,<P>
</a>
<a name="933648">
<dd><em>plx</em>, an integer containing the maximum row index of data,<P>
</a>
<a name="932971">
<dd><em>data</em>, a real*8 array containing the range data,<P>
</a>
<a name="932973">
<dd><em>pxn</em>, a real*8 constant specifying the minimum column index in image,<P>
</a>
<a name="932976">
<dd><em>pxx</em>, a real*8 constant specifying the maximum column index in image,<P>
</a>
<a name="932977">
<dd><em>pyn</em>, a real*8 constant specifying the minimum row index in image,<P>
</a>
<a name="932978">
<dd><em>pyx</em>, a real*8 constant specifying the maximum row index in image,<P>
</a>
<a name="934221">
<dd>pim, an integer containing the image number.<P>
</a>
<a name="932981">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="932983"><P><B></a>PFWMAP(fileid, dname, dp, dm, rname, rp, rm, pim)
</B><BR><A NAME="932984">Write the given information out to <em>file fileid</em> as a </a>PM_mapping. The number <em>pim</em> represents the </a>mapping number and must be unique.
<BR><a name="932985">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="932987">
<dd><em>dname</em>, an ASCII string containing the domain name,<P>
</a>
<a name="932988">
<dd><em>dp</em>, an integer array of parameters defining the domain,<P>
</a>
<a name="932989">
<dd><em>dm</em>, a real*8 array containing the domain data,<P>
</a>
<a name="932992">
<dd><em>rname</em>, an ASCII string containing the range name,<P>
</a>
<a name="932993">
<dd><em>rp</em>, an integer array of parameters defining the range,<P>
</a>
<a name="932994">
<dd><em>rm</em>, a real*8 array containing the range data,<P>
</a>
<a name="932999">
<dd><em>pim</em>, an integer containing the mapping number.<P>
</a>
<a name="933001">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="936531"><P><B></a>PFWRAD(fileid, nchr, name, ntypin, intype, ntypout, outtype, space, nd, ind)
</B><BR><A NAME="936532"></a>Write the data pointed to by <em>space</em> under <em>name</em> and with <em>type</em> in PDB file <em>fileid</em>. Array 
ind contains nd triples indicating the minimum and maximum index and the stride for 
each dimension.
<BR><a name="936533">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="936534">
<dd><em>nchr</em>, the number of characters in <em>name</em>,<P>
</a>
<a name="936535">
<dd><em>name</em>, an ASCII string containing the name of the variable in the PDB file,<P>
</a>
<a name="936538">
<dd><em>ntypin</em>, the number of characters in <em>intype</em>,<P>
</a>
<a name="936539">
<dd><em>intype</em>, an ASCII string containing the type of the variable in space,<P>
</a>
<a name="936540">
<dd><em>ntypout</em>, the number of characters in <em>outtype</em>,<P>
</a>
<a name="936541">
<dd><em>outtype</em>, an ASCII string containing the type of the variable in name,<P>
</a>
<a name="936624">
<dd><em>space</em>, the variable containing the data,<P>
</a>
<a name="936741">
<dd><em>nd</em>, an integer number of dimensions,<P>
</a>
<a name="936742">
<dd>ind, an array of nd integer (min, max, stride) triples.<P>
</a>
<a name="936746">
<dt>Output:	Return 1 if successful, 0 otherwise.AS</a>(fileid, nchr, name, ntypin, intype, ntypout, outtype, space)
</a>
<A NAME="933002"><P><B></a>PFWRAN(fileid, dname, nchr, rname, rp, rm, pim)
</B><BR><A NAME="933003">Write the given information out to file <em>fileid</em> as a </a>PM_mapping. The number <em>pim</em> represents the </a>mapping number and must be unique.
<BR><a name="933005">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="933006">
<dd><em>dname</em>, an ASCII string containing the domain name,<P>
</a>
<a name="933007">
<dd><em>nchr</em>, the number of characters in the domain name,<P>
</a>
<a name="933008">
<dd><em>rname</em>, an ASCII string containing the range name,<P>
</a>
<a name="933009">
<dd><em>rp</em>, an integer array of parameters defining the range,<P>
</a>
<a name="933012">
<dd><em>rm</em>, a real*8 array containing the range data,<P>
</a>
<a name="933013">
<dd><em>pim</em>, an integer containing the mapping number.<P>
</a>
<a name="933014">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="936522"><P><B></a>PFWRAS(fileid, nchr, name, ntypin, intype, ntypout, outtype, space)
</B><BR><A NAME="936523"></a>Write the data pointed to by <em>space of type</em> intype in PDB file<em> fileid</em> under <em>name</em> and with 
type outtype. An arbitrary number of dimensions may be included in the <em>name</em> string.
<BR><a name="936524">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="936525">
<dd><em>nchr</em>, the number of characters in name,<P>
</a>
<a name="936526">
<dd><em>name</em>, an ASCII string containing the name of the variable in the PDB file,<P>
</a>
<a name="936527">
<dd><em>ntypin</em>, the number of characters in <em>intype</em>,<P>
</a>
<a name="936528">
<dd><em>intype</em>, an ASCII string containing the type of the variable in space,<P>
</a>
<a name="936544">
<dd><em>ntypout</em>, the number of characters in <em>outtype</em>,<P>
</a>
<a name="936545">
<dd><em>outtype</em>, an ASCII string containing the type of the variable in name,<P>
</a>
<a name="936529">
<dd><em>space</em>, the variable containing the data.<P>
</a>
<a name="936530">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="933017"><P><B></a>PFWRTA(fileid, nchr, name, ntype, type, space)
</B><BR><A NAME="933020"></a>Write the data pointed to by <em>space</em> under <em>name</em> and with t<em>ype</em> in PDB file<em> fileid</em>. An arbitrary number of dimensions may be included in the <em>name</em> string.
<BR><a name="933022">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="933023">
<dd><em>nchr</em>, the number of characters in name,<P>
</a>
<a name="933024">
<dd><em>name</em>, an ASCII string containing the name of the variable in the PDB file,<P>
</a>
<a name="933026">
<dd><em>ntype</em>, the number of characters in <em>type</em>,<P>
</a>
<a name="933027">
<dd><em>type</em>, an ASCII string containing the type of the variable,<P>
</a>
<a name="933028">
<dd><em>space</em>, the variable containing the data.<P>
</a>
<a name="933031">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="933032"><P><B></a>PFWRTD(fileid, nchr, name, ntype, type, space, nd, ind)
</B><BR><A NAME="933034"></a>Write the data pointed to by <em>space</em> under <em>name</em> and with <em>type</em> in PDB file <em>fileid</em>. Array 
ind contains nd triples indicating the minimum and maximum index and the stride for 
each dimension.
<BR><a name="933035">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="933037">
<dd><em>nchr</em>, the number of characters in <em>name</em>,<P>
</a>
<a name="933038">
<dd><em>name</em>, an ASCII string containing the name of the variable in the PDB file,<P>
</a>
<a name="933039">
<dd><em>ntype</em>, the number of characters in <em>type</em>,<P>
</a>
<a name="933041">
<dd><em>type</em>, an ASCII string containing the type of the variable,<P>
</a>
<a name="933617">
<dd><em>space</em>, the variable containing the data,<P>
</a>
<a name="933042">
<dd><em>nd</em>, an integer number of dimensions,<P>
</a>
<a name="934071">
<dd>ind, an array of nd integer (min, max, stride) triples.<P>
</a>
<a name="933043">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="933294"><P><B></a>PFWSET(fileid, dname, dp, dm)
</B><BR><a name="933296">
<dt>Build a </a>PM_set structure out of the given input data and write it to a PDB file.
</a>
<a name="933295">
<dt>Input:	<em>fileid</em>, an integer PDBfile identification number,
</a>
<a name="933297">
<dd><em>dname</em>, an ASCII string containing the set name,<P>
</a>
<a name="933298">
<dd><em>dp</em>, an integer array of parameters defining the </a>PM_set,<P>
</a>
<a name="933299">
<dd><em>dm</em>, an array of real*8 values containing the set elements.<P>
</a>
<a name="933302">
<dt>Output:	Return 1 if successful, 0 otherwise.
</a>
<A NAME="934584"><PRE> 
</PRE></dl>
<a name="934594">
<h1>6.0   The </a>FORTRAN </a>API</h1>
</a>
<a name="932479">
In this section a more formal description of the FORTRAN API for PDBLib is given including a more detailed account of their workings.<p>
</a>
<a name="936585">
<h2>6.1   PFAPAD &#151; (PD_append_as_alt)</h2>
</a>
<A NAME="936586"><PRE><B>
</B></PRE><A NAME="936587"><PRE><B>integer </a>PFAPAD(integer fileid,
</B></PRE><A NAME="936588"><PRE><B>               integer nchr,
</B></PRE><A NAME="934669"><PRE><B>               character name,
</B></PRE><A NAME="936589"><PRE><B>               integer ntype,
</B></PRE><A NAME="936590"><PRE><B>               character intype,
</B></PRE><A NAME="936796"><PRE><B>               void space,
</B></PRE><A NAME="936591"><PRE><B>               integer nd,
</B></PRE><A NAME="936592"><PRE><B>               integer ind)
</B></PRE><a name="936593">
</a>Append data of type intype to an entry in the specified file. The outtype is assumed to be the same as for the original entry. The dimensions of the appended data are specified in nd and ind. They must match the original entry except for the most slowly varying one. The specification of the most slowly varying dimension must be one of the following;<p>
</a>
<dl>
<a name="936594">
<dt>min:max	:stride	 =&gt; new dimension is old_min:old_max+(max-min+1)
</a>
<a name="936595">
<dt>		 if min is the default_offset for the file
</a>
<a name="936596">
<dt>		or
</a>
<a name="936597">
<dt>min:max	:stride	 =&gt; new dimension is old_min:max
</a>
<a name="936598">
<dt>		if min is old_max+1
</a>
<a name="936599">
The rationale for this function is that some data sets are of unknown size until they are completely written. PDBLib permits any entry to reside in </a>discontiguous blocks of disk space. The library is responsible for reading and writing data correctly across these blocks.<p>
</a>
<a name="936600">
The shape or dimensional information of the entry is specified in nd and ind. In this respect PFAPAD behaves just like </a>PFWRTD.<p>
</a>
<a name="936601">
The arguments to PFAPAD are: fileid, an integer identifier which designates the PDB file to which to write; nchr, an integer number of characters in the name string; name, an ASCII string containing the name of the variable to install in the symbol table; ntype, an integer number of characters in the intype string; intype, an ASCII string specifying the type of data to which space points; space, the data to be written; nd, an integer number of dimensions; and ind, an array of nd integer triples containing the minimum and maximum index and the stride for each dimension.<p>
</a>
<a name="936602">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function </a>PFGERR.<p>
</a>
<a name="936603">
See also PFAPAS, PFAPPA, PFAPPD, PFWRAD, PFWRAS, PFWRTA, and PFWRTD.<p>
</a>
<a name="936604">
<p>
</a>
<A NAME="936605"><PRE><B>integer </a>PFAPAD(integer fileid,
</B></PRE><A NAME="936606"><PRE><B>               integer nchr,
</B></PRE><A NAME="936607"><PRE><B>               character name,
</B></PRE><A NAME="936563"><PRE><B>               integer ntype,
</B></PRE><A NAME="936798"><PRE><B>               character intype,
</B></PRE><A NAME="936608"><PRE><B>               void space,
</B></PRE><A NAME="936609"><PRE><B>               integer nd,
</B></PRE><A NAME="936610"><PRE><B>               integer ind)
</B></PRE><A NAME="936611"><B>
</B><HR><A NAME="936612"><PRE>       character*8 intype
</PRE><A NAME="936807"><PRE>       integer pfapad, pfwrtd
</PRE><A NAME="936613"><PRE>       integer fileid, ntype, nd, ind(3)
</PRE><A NAME="936614"><PRE>       real x(20) 
</PRE><A NAME="936799"><PRE>       real*8 y(10)
</PRE><A NAME="936615"><PRE>             .
</PRE><A NAME="936616"><PRE>             .
</PRE><A NAME="936617"><PRE>             .
</PRE><A NAME="936618"><PRE> c     write array x
</PRE><A NAME="936619"><PRE>       ind(1) = 1
</PRE><A NAME="936620"><PRE>       ind(2) = 20
</PRE><A NAME="936621"><PRE>       ind(3) = 1
</PRE><A NAME="936622"><PRE>       if (</a>pfwrtd(fileid, 1, &#145;x&#146;, 5, &#145;float&#146;, x, 1, ind) .eq. 0)
</PRE><A NAME="936623"><PRE>      $     call errproc
</PRE><A NAME="936732"><PRE>             .
</PRE><A NAME="936733"><PRE>             .
</PRE><A NAME="936740"><PRE>             .
</PRE><A NAME="936625"><PRE> c     append to x
</PRE><A NAME="936626"><PRE>       ind(2) = 10
</PRE><A NAME="936627"><PRE>       if (</a>pfapad(fileid, 1, &#145;x&#146;, 6, &#145;double&#146;, y, 1, ind) .eq. 0)
</PRE><A NAME="936628"><PRE>      $     call errproc
</PRE><A NAME="936629"><PRE>             .
</PRE><A NAME="936630"><PRE>             .
</PRE><A NAME="936546"><PRE>             .
</PRE><A NAME="936558"><PRE> Compare this with the example of </a>PFWRAD.
</PRE></dl>
<a name="936631">
<h2>6.2   PFAPAS  &#151; (PD_append_as)</h2>
</a>
<A NAME="936547"><PRE><B>
</B></PRE><A NAME="936548"><PRE><B>integer </a>PFAPAS(integer fileid,
</B></PRE><A NAME="936549"><PRE><B>               integer nchr,
</B></PRE><A NAME="936550"><PRE><B>               character name,
</B></PRE><A NAME="936801"><PRE><B>               integer ntype,
</B></PRE><A NAME="936802"><PRE><B>               character intype,
</B></PRE><A NAME="936551"><PRE><B>               void space)
</B></PRE><a name="936552">
</a>Append data to an entry in the specified file. The outtype is assumed to be the same as for the original entry. The dimensions of the appended data are specified in name. They must match the original entry except for the most slowly varying one. The specification of the most slowly varying dimension must be one of the following;<p>
</a>
<dl>
<a name="936553">
<dt>min:max		 =&gt; new dimension is old_min:old_max+(max-min+1)
</a>
<a name="936554">
<dt>		 if min is the default_offset for the file 
</a>
<a name="936555">
<dt>		or
</a>
<a name="936556">
<dt>min:max		 =&gt; new dimension is old_min:max
</a>
<a name="936557">
<dt>		if min is old_max+1
</a>
<a name="936665">
The rationale for this function is that some data sets are of unknown size until they are completely written. PDBLib permits any entry to reside in </a>discontiguous blocks of disk space. The library is responsible for reading and writing data correctly across these blocks.<p>
</a>
<a name="936559">
The shape or dimensional information of the entry is a part of the name string. In this respect </a>PFAPAS behaves just like </a>PFWRAS.<p>
</a>
<a name="936560">
The arguments to </a>PFAPAS are: fileid, an integer identifier which designates the PDB file to which to write; nchr, an integer number of characters in the name string; name, an ASCII string containing the name of the variable and any dimensional information, ntype, an integer number of characters in the intype string; intype, an ASCII string specifying the type of data to which space points and space, the data to be appended.<p>
</a>
<a name="936561">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function </a>PFGERR.<p>
</a>
<a name="936562">
See also PFAPAD, PFAPPA, PFAPPD, PFWRAD, PFWRAS, PFWRTA, and PFWRTD.<p>
</a>
<a name="936564">
<p>
</a>
<A NAME="936797"><PRE><B>integer </a>PFAPAS(integer fileid,
</B></PRE><A NAME="936565"><PRE><B>               integer nchr,
</B></PRE><A NAME="936566"><PRE><B>               character name,
</B></PRE><A NAME="936805"><PRE><B>               integer ntype,
</B></PRE><A NAME="936806"><PRE><B>               character intype,
</B></PRE><A NAME="936567"><PRE><B>               void space)
</B></PRE><A NAME="936568"><B>
</B><HR><A NAME="936808"><PRE>       character*8 intype
</PRE><A NAME="936569"><PRE>       integer pfapas, pfwrta
</PRE><A NAME="936570"><PRE>       integer fileid, nchr, ntype
</PRE><A NAME="936571"><PRE>       real x(20)
</PRE><A NAME="936803"><PRE>       real*8 y(10)
</PRE><A NAME="936572"><PRE>             .
</PRE><A NAME="936573"><PRE>             .
</PRE><A NAME="936574"><PRE>             .
</PRE><A NAME="936575"><PRE> c     write array x
</PRE><A NAME="936576"><PRE>       if (</a>pfwrta(fileid, 5, &#145;x(20)&#146;, 5, &#145;float&#146;, x) .eq. 0)
</PRE><A NAME="936577"><PRE>      $     call errproc
</PRE><A NAME="936747"><PRE>             .
</PRE><A NAME="936748"><PRE>             .
</PRE><A NAME="936749"><PRE>             .
</PRE><A NAME="936579"><PRE> c     append to x
</PRE><A NAME="936580"><PRE>       if (</a>pfapas(fileid, 7, &#145;x(1:10)&#146;, 6, &#145;double&#146;, y) .eq. 0)
</PRE><A NAME="936581"><PRE>      $     call errproc
</PRE><A NAME="936582"><PRE>             .
</PRE><A NAME="936578"><PRE>             .
</PRE><A NAME="936583"><PRE>             .
</PRE><a name="932907">
Compare this with the example of </a>PFWRAS.<p>
</a>
</dl>
<a name="936804">
<h2>6.3   PFAPPA  &#151; (PD_append)</h2>
</a>
<A NAME="933517"><PRE><B>
</B></PRE><A NAME="933518"><PRE><B>integer </a>PFAPPA(integer fileid,
</B></PRE><A NAME="934125"><PRE><B>               integer nchr,
</B></PRE><A NAME="934525"><PRE><B>               character name,
</B></PRE><A NAME="934527"><PRE><B>               void space)
</B></PRE><a name="934528">
</a>Append data to an entry in the specified file. The type is assumed to be the same as for the original entry. The dimensions of the appended data are specified in name. They must match the original entry except for the most slowly varying one. The specification of the most slowly varying dimension must be one of the following;<p>
</a>
<dl>
<a name="934529">
<dt>min:max		 =&gt; new dimension is old_min:old_max+(max-min+1)
</a>
<a name="934532">
<dt>		 if min is the default_offset for the file 
</a>
<a name="934533">
<dt>		or
</a>
<a name="934534">
<dt>min:max		 =&gt; new dimension is old_min:max
</a>
<a name="934538">
<dt>		if min is old_max+1
</a>
<a name="934599">
The rationale for this function is that some data sets are of unknown size until they are completely written. PDBLib permits any entry to reside in </a>discontiguous blocks of disk space. The library is responsible for reading and writing data correctly across these blocks.<p>
</a>
<a name="934622">
The shape or dimensional information of the entry is a part of the name string. In this respect </a>PFAPPA behaves just like </a>PFWRTA.<p>
</a>
<a name="934627">
The arguments to </a>PFAPPA are: fileid, an integer identifier which designates the PDB file to which to write; nchr, an integer number of characters in the name string; name, an ASCII string containing the name of the variable to install in the symbol table; and space, the data to be written.<p>
</a>
<a name="934688">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function </a>PFGERR.<p>
</a>
<a name="934722">
See also PFAPAD, PFAPAS, PFAPPD, PFWRAD, PFWRAS, PFWRTA, and PFWRTD.<p>
</a>
<a name="935241">
<p>
</a>
<A NAME="934724"><PRE><B>integer </a>PFAPPA(integer fileid,
</B></PRE><A NAME="934725"><PRE><B>               integer nchr,
</B></PRE><A NAME="934726"><PRE><B>               character name,
</B></PRE><A NAME="934728"><PRE><B>               void space)
</B></PRE><A NAME="934696"><B>
</B><HR><A NAME="934697"><PRE>       integer pfappa, pfwrta
</PRE><A NAME="934699"><PRE>       integer fileid
</PRE><A NAME="934700"><PRE>       real x(20), y(10)
</PRE><A NAME="934703"><PRE>             .
</PRE><A NAME="934704"><PRE>             .
</PRE><A NAME="934705"><PRE>             .
</PRE><A NAME="934707"><PRE> c     write array x
</PRE><A NAME="934708"><PRE>       if (</a>pfwrta(fileid, 5, &#145;x(20)&#146;, 5, &#145;float&#146;, x) .eq. 0)
</PRE><A NAME="934709"><PRE>      $     call errproc
</PRE><A NAME="934711"><PRE> 
</PRE><A NAME="934712"><PRE> c     append to x
</PRE><A NAME="934713"><PRE>       if (</a>pfappa(fileid, 7, &#145;x(1:10)&#146;, y) .eq. 0)
</PRE><A NAME="934714"><PRE>      $     call errproc
</PRE><A NAME="934715"><PRE>             .
</PRE><A NAME="934716"><PRE>             .
</PRE><A NAME="934689"><PRE>             .
</PRE></dl>
<a name="934690">
<h2>6.4   PFAPPD  &#151; (PD_append_alt)</h2>
</a>
<A NAME="934718"><PRE><B>
</B></PRE><A NAME="934776"><PRE><B>integer </a>PFAPPD(integer fileid,
</B></PRE><A NAME="934777"><PRE><B>               integer nchr,
</B></PRE><A NAME="934779"><PRE><B>               character name,
</B></PRE><A NAME="934780"><PRE><B>               void space,
</B></PRE><A NAME="934781"><PRE><B>               integer nd,
</B></PRE><A NAME="934782"><PRE><B>               integer ind)
</B></PRE><a name="934701">
</a>Append data to an entry in the specified file. The type is assumed to be the same as for the original entry. The dimensions of the appended data are specified in nd and ind. They must match the original entry except for the most slowly varying one. The specification of the most slowly varying dimension must be one of the following;<p>
</a>
<dl>
<a name="935244">
<dt>min:max	:stride	 =&gt; new dimension is old_min:old_max+(max-min+1)
</a>
<a name="935245">
<dt>		 if min is the default_offset for the file
</a>
<a name="935246">
<dt>		or
</a>
<a name="935247">
<dt>min:max	:stride	 =&gt; new dimension is old_min:max
</a>
<a name="935248">
<dt>		if min is old_max+1
</a>
<a name="934736">
The rationale for this function is that some data sets are of unknown size until they are completely written. PDBLib permits any entry to reside in </a>discontiguous blocks of disk space. The library is responsible for reading and writing data correctly across these blocks.<p>
</a>
<a name="934737">
The shape or dimensional information of the entry is specified in nd and ind. In this respect </a>PFAPPD behaves just like </a>PFWRTD.<p>
</a>
<a name="934691">
The arguments to </a>PFAPPD are: fileid, an integer identifier which designates the PDB file to which to write; nchr, an integer number of characters in the name string; name, an ASCII string containing the name of the variable to install in the symbol table; space, the data to be written; nd, an integer number of dimensions; and ind, an array of nd integer triples containing the minimum and maximum index and the stride for each dimension.<p>
</a>
<a name="934739">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function </a>PFGERR.<p>
</a>
<a name="934740">
See also PFAPAD, PFAPAS, PFAPPA, PFWRAD, PFWRAS, PFWRTA, and PFWRTD.<p>
</a>
<a name="934742">
<p>
</a>
<A NAME="936810"><PRE><B>integer </a>PFAPPD(integer fileid,
</B></PRE><A NAME="934744"><PRE><B>               integer nchr,
</B></PRE><A NAME="934745"><PRE><B>               character name,
</B></PRE><A NAME="934746"><PRE><B>               void space,
</B></PRE><A NAME="934774"><PRE><B>               integer nd,
</B></PRE><A NAME="934775"><PRE><B>               integer ind)
</B></PRE><A NAME="934747"><B>
</B><HR><A NAME="934748"><PRE>       integer pfappd, pfwrtd
</PRE><A NAME="934750"><PRE>       integer fileid, ind(3)
</PRE><A NAME="934751"><PRE>       real x(20), y(10)
</PRE><A NAME="934752"><PRE>             .
</PRE><A NAME="934754"><PRE>             .
</PRE><A NAME="934755"><PRE>             .
</PRE><A NAME="934756"><PRE> c     write array x
</PRE><A NAME="934757"><PRE>       ind(1) = 1
</PRE><A NAME="934771"><PRE>       ind(2) = 20
</PRE><A NAME="934772"><PRE>       ind(3) = 1
</PRE><A NAME="934770"><PRE>       if (</a>pfwrtd(fileid, 1, &#145;x&#146;, 5, &#145;float&#146;, x, 1, ind) .eq. 0)
</PRE><A NAME="934759"><PRE>      $     call errproc
</PRE><A NAME="934760"><PRE> 
</PRE><A NAME="934761"><PRE> c     append to x
</PRE><A NAME="934773"><PRE>       ind(2) = 10
</PRE><A NAME="934762"><PRE>       if (</a>pfappd(fileid, 1, &#145;x&#146;, y, 1, ind) .eq. 0)
</PRE><A NAME="934763"><PRE>      $     call errproc
</PRE><A NAME="934764"><PRE>             .
</PRE><A NAME="934766"><PRE>             .
</PRE><A NAME="934767"><PRE>             .
</PRE></dl>
<a name="935628">
<h2>6.5   </a>PFCD  &#151; (PD_cd)</h2>
</a>
<A NAME="935642"><PRE><B>
</B></PRE><A NAME="935643"><PRE><B>integer </a>PFCD(integer fileid,
</B></PRE><A NAME="935646"><PRE><B>             integer nchr,
</B></PRE><A NAME="935645"><PRE><B>             char *dirname)
</B></PRE><a name="935644">
</a>Change the </a>current </a>directory in a PDB file.<p>
</a>
<a name="935647">
PDBLib supports an optional </a>hierarchical </a>directory structure inside PDB files. A directory or a variable in a directory may be specified by either a </a>relative path or an </a>absolute path. Slashes separate nodes in a </a>path name. Absolute paths begin with a slash. Nodes consisting of two periods, &#147;..&#148;, refer to the next higher level directory.<p>
</a>
<a name="935648">
The arguments to </a>PFCD are: fileid, an integer file identifier; nchr, an integer number of characters in string dirname; and dirname, an ASCII string containing the path name of the directory to change to.<p>
</a>
<a name="935649">
If dirname is an empty string or a slash, it refers to the top level or </a>root directory.<p>
</a>
<a name="935650">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="935651">
See also </a>PFDLS, </a>PFGLS, </a>PFLN, </a>PFLST, </a>PFMKDR, </a>PFPWD.<p>
</a>
<a name="935652">
<p>
</a>
<A NAME="935653"><PRE><B>integer </a>PFCD(integer fileid,
</B></PRE><A NAME="935656"><PRE><B>             integer nchr,
</B></PRE><A NAME="935657"><PRE><B>             char *dirname)
</B></PRE><A NAME="935659"><B>
</B><HR><A NAME="935660"><PRE>       integer pfcd
</PRE><A NAME="935661"><PRE>       integer fileid
</PRE><A NAME="935662"><PRE>             .
</PRE><A NAME="935663"><PRE>             .
</PRE><A NAME="935664"><PRE>             .
</PRE><A NAME="935654"><PRE>       if (</a>pfcd(fileid, 16, &#145;/animals/mammals&#146;) .eq. 0)
</PRE><A NAME="935655"><PRE>      $     call errproc
</PRE><A NAME="935665"><PRE>             .
</PRE><A NAME="935666"><PRE>             .
</PRE><A NAME="935667"><PRE>             .
</PRE><A NAME="935668"><PRE>       if (</a>pfcd(fileid, 11, &#145;../reptiles&#146;) .eq. 0)
</PRE><A NAME="935669"><PRE>      $     call errproc
</PRE><A NAME="935670"><PRE>             .
</PRE><A NAME="935671"><PRE>             .
</PRE><A NAME="935672"><PRE>             .
</PRE><a name="934616">
<h2>6.6   PFCLOS  &#151; (PD_close)</h2>
</a>
<A NAME="934619"><PRE><B>
</B></PRE><A NAME="932750"><PRE><B>integer </a>PFCLOS(integer fileid)
</B></PRE><a name="934625">
</a>Close a PDB file. After all data is written to the PDB file, the structure chart and symbol table must be written out to the file and their disk addresses recorded in the file header. Without these operations the file cannot be read back in by PDBLib and all data is lost.<p>
</a>
<a name="934630">
All open PDB files must be </a>PFCLOS&#146;d before exiting the program. The integer identifier <em>fileid</em> associated with the PDB file must be passed to </a>PFCLOS.<p>
</a>
<a name="932483">
This function returns 1 if the PDB file is correctly written and closed; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="933692">
<p>
</a>
<A NAME="933694"><PRE><B>integer </a>PFCLOS(integer fileid)
</B></PRE><A NAME="932859"><B>
</B><HR><A NAME="932888"><PRE>       integer </a>pfclos
</PRE><A NAME="933841"><PRE>       integer fileid
</PRE><A NAME="933843"><PRE>             .
</PRE><A NAME="933844"><PRE>             .
</PRE><A NAME="933842"><PRE>             .
</PRE><A NAME="933845"><PRE>       if (</a>pfclos(fileid) .eq. 0)
</PRE><A NAME="933846"><PRE>      $     call errproc
</PRE><A NAME="933849"><PRE>             .
</PRE><A NAME="933850"><PRE>             .
</PRE><A NAME="933851"><PRE>             .
</PRE><a name="934588">
<h2>6.7   PFDATT  &#151; (PD_def_attribute)</h2>
</a>
<A NAME="934600"><PRE><B>
</B></PRE><A NAME="934601"><PRE><B>integer </a>PFDATT(integer fileid,
</B></PRE><A NAME="934608"><PRE><B>               integer na,
</B></PRE><A NAME="934602"><PRE><B>               char *attr,
</B></PRE><A NAME="934609"><PRE><B>               integer nt,
</B></PRE><A NAME="934603"><PRE><B>               char *type)
</B></PRE><a name="934604">
</a>Define an </a>attribute to the given PDB file. The </a>model of an attribute in PDBLib is an entity that has a name and type. The two supported operations on attributes are to create them and to remove them. An entity in a PDB file can be assigned an </a>attribute value simply by making a call which specifies the entity name, the attribute name, and the attribute value (which is determined by the type). The only association between an entry in a PDB file and any attribute is made by the name in the attribute table and the entry in the symbol table. In particular, this mechanism allows the application developer to define and use entities in a PDB file solely in terms of attributes.<p>
</a>
<a name="934610">
The arguments to </a>PFDATT are: fileid, an integer identifier which designates the PDB file in which the attribute is being defined; na, an integer number of characters in the attr string; attr, an ASCII string containing the name of the attribute; nt, an integer number of characters in the type string; and type, an ASCII string containing the type of the attribute;<p>
</a>
<a name="933972">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="934607">
See also </a>PFRATT, </a>PFGVAT, and </a>PFSVAT.<p>
</a>
<a name="934693">
<p>
</a>
<A NAME="934692"><PRE><B>integer </a>PFDATT(integer fileid,
</B></PRE><A NAME="934808"><PRE><B>               integer na,
</B></PRE><A NAME="934810"><PRE><B>               char *attr,
</B></PRE><A NAME="934811"><PRE><B>               integer nt,
</B></PRE><A NAME="934812"><PRE><B>               char *type)
</B></PRE><A NAME="934786"><B>
</B><HR><A NAME="934787"><PRE>       integer pfdatt
</PRE><A NAME="934788"><PRE>       integer fileid
</PRE><A NAME="934791"><PRE>             .
</PRE><A NAME="934792"><PRE>             .
</PRE><A NAME="934794"><PRE>             .
</PRE><A NAME="934796"><PRE>       if (</a>pfdatt(fileid, 4, &#145;date&#146;, 6, &#145;char *&#146;) .eq. 0)
</PRE><A NAME="934798"><PRE>      $     call errproc
</PRE><A NAME="934804"><PRE>             .
</PRE><A NAME="934805"><PRE>             .
</PRE><A NAME="934807"><PRE>             .
</PRE><a name="935077">
<h2>6.8   PFDEFA  &#151; (PD_defent)</h2>
</a>
<A NAME="935078"><PRE><B>
</B></PRE><A NAME="935075"><PRE><B>integer </a>PFDEFA(integer fileid,
</B></PRE><A NAME="935152"><PRE><B>               integer nc,
</B></PRE><A NAME="935153"><PRE><B>               char *name,
</B></PRE><A NAME="935154"><PRE><B>               integer nt,
</B></PRE><A NAME="935155"><PRE><B>               char *type)
</B></PRE><a name="935123">
</a>Define an entry in the </a>symbol table of the PDB file specified by <em>fileid</em>. This function </a>reserves space on disk but writes no data. The data can be written with later calls to </a>PFWRTA or </a>PFWRTD.<p>
</a>
<a name="935124">
The shape or dimensional information of the entry is a part of the name string. In this respect it behaves as </a>PFWRTA.<p>
</a>
<a name="935138">
The rationale for this function is to </a>block out space in a PDB file corresponding to some logical layout of a piece of data. The data may not exist at the time the space is reserved or for some reason it may be desirable to write out the data in pieces. In any case if the type and shape of a variable is known at some point, an entry may be made in the PDB file without writing any data. The space may filled with other PDBLib calls at some later time.<p>
</a>
<a name="935139">
The arguments to this function are: fileid, an integer identifier which designates the PDB file in which to define an entry; nchr, an integer number of characters in the name string; name, an ASCII string containing the name of the variable to install in the symbol table; ntype, an integer number of characters in the type string; and type, an ASCII string specifying the variable type.<p>
</a>
<a name="935140">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="935141">
See also  </a>PFAPAD, </a>PFAPAS, </a>PFAPPA, </a>PFAPPD, </a>PFDEFD,  </a>PFWRAD, </a>PFWRAS, </a>PFWRTA, and </a>PFWRTD.<p>
</a>
<a name="935088">
<p>
</a>
<A NAME="935080"><PRE><B>integer </a>PFDEFA(integer fileid,
</B></PRE><A NAME="935157"><PRE><B>               integer nc,
</B></PRE><A NAME="935158"><PRE><B>               char *name,
</B></PRE><A NAME="935159"><PRE><B>               integer nt,
</B></PRE><A NAME="935160"><PRE><B>               char *type)
</B></PRE><A NAME="935093"><B>
</B><HR><A NAME="934040"><PRE>       integer </a>pfdefa
</PRE><A NAME="935081"><PRE>       integer fileid
</PRE><A NAME="935086"><PRE>             .
</PRE><A NAME="935087"><PRE>             .
</PRE><A NAME="935142"><PRE>             .
</PRE><A NAME="935143"><PRE> c     define and reserve array x
</PRE><A NAME="935083"><PRE> c     declaration for x would be: real x(20)
</PRE><A NAME="935082"><PRE> 
</PRE><A NAME="935144"><PRE>       if (</a>pfdefa(fileid, 5, &#145;x(20)&#146;, 5, &#145;float&#146;) .eq. 0)
</PRE><A NAME="935145"><PRE>      $     call errproc
</PRE><A NAME="935101"><PRE>             .
</PRE><A NAME="935102"><PRE>             .
</PRE><A NAME="935103"><PRE>             .
</PRE><a name="935110">
Compare this with the example of </a>PFWRTA.<p>
</a>
<a name="935111">
<h2>6.9   PFDEFD  &#151; (PD_defent_alt)</h2>
</a>
<A NAME="935112"><PRE><B>
</B></PRE><A NAME="935079"><PRE><B>integer </a>PFDEFD(integer fileid,
</B></PRE><A NAME="935090"><PRE><B>               integer nc,
</B></PRE><A NAME="935091"><PRE><B>               char *name,
</B></PRE><A NAME="935092"><PRE><B>               integer nt,
</B></PRE><A NAME="935161"><PRE><B>               char *type,
</B></PRE><A NAME="935117"><PRE><B>               integer nd,
</B></PRE><A NAME="935118"><PRE><B>               integer ind)
</B></PRE><a name="935119">
</a>Define an entry in the </a>symbol table of the PDB file specified by <em>fileid</em>. This function </a>reserves space on disk but writes no data. The data can be written with later calls to </a>PFWRTA or </a>PFWRTD.<p>
</a>
<a name="935120">
This is an alternate form of </a>PFDEFA. The difference is that the </a>dimension information is supplied via the nd and ind arguments instead of being a part of the name string. In this respect it behaves as </a>PFWRTD.<p>
</a>
<a name="935122">
The rationale for this function is to </a>block out space in a PDB file corresponding to some logical layout of a piece of data. The data may not exist at the time the space is reserved or for some reason it may be desirable to write out the data in pieces. In any case if the type and shape of a variable is known at some point, an entry may be made in the PDB file without writing any data. The space may filled with other PDBLib calls at some later time.<p>
</a>
<a name="935136">
The arguments to this function are: fileid, an integer identifier which designates the PDB file in which to define an entry; nchr, an integer number of characters in the name string; name, an ASCII string containing the name of the variable to install in the symbol table; ntype, an integer number of characters in the type string; type, an ASCII string specifying the variable type; nd, an integer number of dimensions; and ind, an array of nd integer pairs containing the minimum and maximum index for each dimension.<p>
</a>
<a name="935137">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="934741">
See also  </a>PFAPAD, </a>PFAPAS, </a>PFAPPA, </a>PFAPPD, </a>PFDEFA,  </a>PFWRAD, </a>PFWRAS, </a>PFWRTA, and </a>PFWRTD.<p>
</a>
<a name="935125">
See also </a>PFAPPA, </a>PFAPPD, </a>PFDEFA, </a>PFWRTA, and </a>PFWRTD.<p>
</a>
<a name="935127">
<p>
</a>
<A NAME="935113"><PRE><B>integer </a>PFDEFD(integer fileid,
</B></PRE><A NAME="935114"><PRE><B>               integer nc,
</B></PRE><A NAME="935116"><PRE><B>               char *name,
</B></PRE><A NAME="935162"><PRE><B>               integer nt,
</B></PRE><A NAME="935164"><PRE><B>               char *type,
</B></PRE><A NAME="935165"><PRE><B>               integer nd,
</B></PRE><A NAME="935166"><PRE><B>               integer ind)
</B></PRE><A NAME="935133"><B>
</B><HR><A NAME="935128"><PRE>       integer </a>pfdefd
</PRE><A NAME="935129"><PRE>       integer fileid, nd, ind(4)
</PRE><A NAME="935131"><PRE>             .
</PRE><A NAME="935132"><PRE>             .
</PRE><A NAME="935151"><PRE>             .
</PRE><A NAME="935167"><PRE> c     define and reserve array c
</PRE><A NAME="935130"><PRE> c     declaration for c would be: real c(2,2:4)
</PRE><A NAME="935134"><PRE> 
</PRE><A NAME="935168"><PRE>       nd = 2
</PRE><A NAME="935169"><PRE>       ind(1) = 1
</PRE><A NAME="935170"><PRE>       ind(2) = 2
</PRE><A NAME="935171"><PRE>       ind(3) = 2
</PRE><A NAME="935172"><PRE>       ind(4) = 4
</PRE><A NAME="935176"><PRE>       if (</a>pfdefd(fileid, 1, &#145;c&#146;, 5, &#145;float&#146;, nd, ind) .eq. 0)
</PRE><A NAME="935177"><PRE>      $     call errproc
</PRE><A NAME="935178"><PRE>             .
</PRE><A NAME="935179"><PRE>             .
</PRE><A NAME="935180"><PRE>             .
</PRE><a name="935135">
Compare with the example for </a>PFWRTD.<p>
</a>
<a name="933695">
<h2>6.10   PFDEFS  &#151; (PD_defstr))</h2>
</a>
<A NAME="934645"><PRE><B>
</B></PRE><A NAME="932751"><PRE><B>integer </a>PFDEFS(integer fileid,
</B></PRE><A NAME="932752"><PRE><B>               integer nchr,
</B></PRE><A NAME="932753"><PRE><B>               character name,
</B></PRE><A NAME="932754"><PRE><B>               integer ncm1, character mem1,
</B></PRE><A NAME="932757"><PRE><B>                    ...,
</B></PRE><A NAME="932758"><PRE><B>               integer ncmn, character memn,
</B></PRE><A NAME="932756"><PRE><B>               integer LAST)
</B></PRE><a name="934655">
</a>Define a data structure for a PDB file. As a matter of programming efficiency and clarity it is useful to be able to refer to more complex structural units than the </a>primitive types: short integers, integers, long integers, floating point numbers, double precision floating point numbers, and characters. Arrays do this in a very simple-minded way. Many modern languages support </a>extended types or structures which allow the programmer to group diverse types of data together in a very sophisticated way.<p>
</a>
<a name="934661">
PDBLib supports an </a>extended </a>data typing mechanism called a structure. A </a>structure is a set of declarations of members. Each </a>member is in turn a data type known to the system. Much of the style and usage of structures comes from the C struct. Note: because FORTRAN 77 lacks a </a>pointer type, structures defined with this function should not contain pointered members.<p>
</a>
<a name="934670">
 </a>PFDEFS defines data structures to the PDB system so that instances of such extended types can be read and written as a whole in a single statement. The members of the structure are processed and an entry in the structure chart is made. Subsequent references to the new structure type are processed using information from the structure chart. The syntax by which members of a structure are specified is like that for C structs. The formal definition is given below ([ ] enclose optional elements). Note: </a>self-referential structures should not be used in FORTRAN applications.<p>
</a>
<dl>
<a name="934674">
<dt> &lt;member&gt;			:=	&lt;type&gt; &lt;member name&gt;[(&lt;dimensions&gt;)]
</a>
<a name="934676">
<dt> &lt;type&gt;			:=	&lt;primitive type&gt; | &lt;derived type&gt;
</a>
<a name="934679">
<dt> &lt;member name&gt;			:=	an ASCII string representing the name of the member
</a>
<a name="934681">
<dt> &lt;primitive type&gt;			:=	short | integer | long | float | double | char
</a>
<a name="934683">
<dt> &lt;derived type&gt;			:=	any PFDEFS&#146;d type
</a>
<a name="934685">
<dt> &lt;dimensions&gt;			:=	&lt;integer&gt; |
</a>
<a name="933618">
<dt>				&lt;integer : integer&gt; |
</a>
<a name="933619">
<dt>				&lt;integer&gt;, &lt;dimensions&gt; |
</a>
<a name="934687">
<dt>				&lt;integer : integer&gt;, &lt;dimensions&gt; |
</a>
<a name="934695">
Dimensions can be given in two ways. If the default offset value for the PDB file can be taken as the minimum value for the range which a dimension index can legally run, the maximum value may be specified alone. Alternatively, the minimum value followed by a colon and the maximum value may be specified. For example,<p>
</a>
<a name="934698">
<dd>integer a(30,1:10)<P>
</a>
<a name="934706">
The arguments to </a>PFDEFS are: fileid, an integer identifier which designates the PDB file to which to write; nchr, the integer number of characters in the name string; name, an ASCII string containing the name of the variable to install in the symbol table; a list of pairs where ncmi is an integer number of characters in the memi string which follows it; and a terminating LAST.<p>
</a>
<a name="934710">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="933697">
<p>
</a>
<A NAME="933699"><PRE><B>integer </a>PFDEFS(integer fileid,
</B></PRE><A NAME="933760"><PRE><B>               integer nchr,
</B></PRE><A NAME="933762"><PRE><B>               character name,
</B></PRE><A NAME="933764"><PRE><B>               integer ncm1, character mem1,
</B></PRE><A NAME="933765"><PRE><B>                    ...,
</B></PRE><A NAME="933767"><PRE><B>               integer ncmn, character memn,
</B></PRE><A NAME="933769"><PRE><B>               integer LAST)
</B></PRE><A NAME="933700"><B>
</B><HR><A NAME="933852"><PRE>       parameter(LAST = 0)
</PRE><A NAME="933875"><PRE>       integer </a>pfdefs
</PRE><A NAME="933853"><PRE>       integer fileid
</PRE><A NAME="933867"><PRE>       common /abc/ a(2), b, c(2,2:4)
</PRE><A NAME="933869"><PRE>       real a, b, c
</PRE><A NAME="933854"><PRE>       common /jkl/ j, k, l
</PRE><A NAME="934009"><PRE>       integer j, k, l
</PRE><A NAME="934010"><PRE>             .
</PRE><A NAME="933866"><PRE>             .
</PRE><A NAME="933855"><PRE>             .
</PRE><A NAME="933856"><PRE>       if (</a>pfdefs(fileid,
</PRE><A NAME="933858"><PRE>      $           3,  &#146;abc&#146;,
</PRE><A NAME="933859"><PRE>      $           10, &#146;float a(2)&#146;,
</PRE><A NAME="933864"><PRE>      $           7,  &#146;float b&#146;,
</PRE><A NAME="933865"><PRE>      $           14, &#146;float c(2,2:4)&#146;,
</PRE><A NAME="933870"><PRE>      $           LAST) .eq. 0)
</PRE><A NAME="933873"><PRE>      $     call errproc
</PRE><A NAME="934011"><PRE> 
</PRE><A NAME="934056"><PRE>       if (</a>pfdefs(fileid,
</PRE><A NAME="934012"><PRE>      $           3, &#146;jkl&#146;,
</PRE><A NAME="934013"><PRE>      $           9, &#146;integer j&#146;,
</PRE><A NAME="934014"><PRE>      $           9, &#146;integer k&#146;,
</PRE><A NAME="934015"><PRE>      $           9, &#146;integer l&#146;,
</PRE><A NAME="934016"><PRE>      $           LAST) .eq. 0)
</PRE><A NAME="934017"><PRE>      $     call errproc
</PRE><A NAME="933860"><PRE>             .
</PRE><A NAME="933861"><PRE>             .
</PRE><A NAME="933862"><PRE>             .
</PRE></dl>
<a name="935084">
<h2>6.11   PFDEFT  &#151; (PD_defstr_alt)</h2>
</a>
<A NAME="935095"><PRE><B>
</B></PRE><A NAME="935202"><PRE><B>integer </a>PFDEFT(integer fileid,
</B></PRE><A NAME="935203"><PRE><B>               integer nchr,
</B></PRE><A NAME="935209"><PRE><B>               character name,
</B></PRE><A NAME="935210"><PRE><B>               integer nm,
</B></PRE><A NAME="935216"><PRE><B>               integer nc(2*nm),
</B></PRE><A NAME="935217"><PRE><B>               character *memb)
</B></PRE><A NAME="935106"><PRE><B>
</B></PRE><a name="935107">
</a>Define a data structure for a PDB file. This is an alternate form of PFDEFS (see the description above for a discussion of structured data types).<p>
</a>
<a name="935186">
The arguments to </a>PFDEFT are: fileid, an integer identifier which designates the PDB file to which to write; nchr, the integer number of characters in the name string; name, an ASCII string containing the name of the variable to install in the symbol table; nm, an integer specifying how many members the type has; nc, an array of integer pairs specifying the 0 based offset into the nm array and the number of characters for each member; and nm, an array of characters containing the member specifications.<p>
</a>
<a name="935187">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="935096">
See also </a>PFDEFS.<p>
</a>
<a name="935188">
<p>
</a>
<A NAME="935189"><PRE><B>integer </a>PFDEFT(integer fileid,
</B></PRE><A NAME="935190"><PRE><B>               integer nchr,
</B></PRE><A NAME="935191"><PRE><B>               character name,
</B></PRE><A NAME="935192"><PRE><B>               integer nm,
</B></PRE><A NAME="935193"><PRE><B>               integer nc(2*nm),
</B></PRE><A NAME="935194"><PRE><B>               character *memb)
</B></PRE><A NAME="935196"><B>
</B><HR><A NAME="935198"><PRE>       integer </a>pfdeft
</PRE><A NAME="935199"><PRE>       integer fileid, nc(6)
</PRE><A NAME="935200"><PRE>       character*8 nm(4)
</PRE><A NAME="935195"><PRE>       common /abc/ a(2), b, c(2,2:4)
</PRE><A NAME="935204"><PRE>             .
</PRE><A NAME="935205"><PRE>             .
</PRE><A NAME="935207"><PRE>             .
</PRE><A NAME="935211"><PRE>       nc(1) = 0
</PRE><A NAME="935212"><PRE>       nc(2) = 10
</PRE><A NAME="935213"><PRE>       nc(3) = 10
</PRE><A NAME="935214"><PRE>       nc(4) = 7
</PRE><A NAME="935215"><PRE>       nc(5) = 17
</PRE><A NAME="935228"><PRE>       nc(6) = 14
</PRE><A NAME="935229"><PRE>       nm(1) = &#145;float a(&#145;
</PRE><A NAME="935230"><PRE>       nm(2) = &#145;2)float &#145;
</PRE><A NAME="935231"><PRE>       nm(3) = &#145;bfloat c&#146;
</PRE><A NAME="935232"><PRE>       nm(4) = &#145;(2,2:4) &#145;
</PRE><A NAME="935208"><PRE>       if (pfdeft(fileid, 3, &#146;abc&#146;, 3, nc, nm) .eq. 0)
</PRE><A NAME="935197"><PRE>          call errproc
</PRE><A NAME="935223"><PRE>             .
</PRE><A NAME="935224"><PRE>             .
</PRE><A NAME="935225"><PRE>             .
</PRE><a name="935097">
Compare with the example for </a>PFDEFS.<p>
</a>
<a name="935322">
<h2>6.12   PFFAMI  &#151; (PD_family)</h2>
</a>
<A NAME="936007"><PRE><B>
</B></PRE><A NAME="936012"><PRE><B>integer </a>PFFAMI(integer fileid, integer flag)
</B></PRE><a name="936013">
This function checks to see whether the specified file has exceeded it size limit. If it has a new file is opened and returns. If not the given file pointer is returned. The flag is set to TRUE if you want </a>PFFAMI to close the file it is given. Otherwise the application is responsible for closing the file<p>
</a>
<a name="936014">
The arguments to this function are: fileid, an integer file identifier returned by a previous call to </a>PFOPEN; and flag an integer value (either TRUE or FALSE).<p>
</a>
<a name="936015">
This function returns an integer file identifier.<p>
</a>
<a name="936017">
<p>
</a>
<a name="936018">
integer </a>PFFAMI(integer fileid, integer flag)<p>
</a>
<A NAME="936019"><B>
</B><HR><A NAME="936099"><PRE>    integer old, new
</PRE><A NAME="936097"><PRE>    integer </a>pffami
</PRE><A NAME="936102"><PRE>            .
</PRE><A NAME="936165"><PRE>            .
</PRE><A NAME="936166"><PRE>            .
</PRE><A NAME="936167"><PRE>     new = pffami(old, 0)
</PRE><A NAME="936168"><PRE>     if (new .ne. old) then
</PRE><A NAME="936169"><PRE>        pfclos(old)
</PRE><A NAME="936170"><PRE>              .
</PRE><A NAME="936171"><PRE>              .
</PRE><A NAME="936173"><PRE>              .
</PRE><A NAME="936174"><PRE>        old = new
</PRE><A NAME="936098"><PRE>     endif
</PRE><A NAME="936175"><PRE>            .
</PRE><A NAME="936177"><PRE>            .
</PRE><A NAME="936178"><PRE>            .
</PRE><a name="935150">
<h2>6.13   PFFLSH  &#151; (PD_flush)</h2>
</a>
<A NAME="935173"><PRE><B>
</B></PRE><A NAME="935175"><PRE><B>integer </a>PFFLSH(integer fileid)
</B></PRE><a name="935237">
This function writes out the information which describes the </a>contents of the PDB file specified. Normally, </a>PFCLOS calls this routine, but applications that want to protect themselves from system failures or other problems may chose to periodically use this function. After a successful return and until or unless more data is written to the file or space reserved for future writes, the PDB file is valid in the sense that if the application terminates unexpectedly before calling </a>PFCLOS, the file can be </a>PFOPEN&#146;d successfully.<p>
</a>
<a name="935238">
NOTE: this call does NOT obviate </a>PFCLOS!<p>
</a>
<a name="935239">
The argument to this function is file, the pointer to the PDBfile structure returned by a previous call to PD_open.<p>
</a>
<a name="933275">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="935184">
<p>
</a>
<A NAME="935181"><PRE><B>integer </a>PFFLSH(integer fileid)
</B></PRE><A NAME="935201"><B>
</B><HR><A NAME="935218"><PRE>       integer </a>pfflsh
</PRE><A NAME="935219"><PRE>       integer fileid
</PRE><A NAME="935220"><PRE>             .
</PRE><A NAME="935221"><PRE>             .
</PRE><A NAME="935222"><PRE>             .
</PRE><A NAME="935226"><PRE>       if (</a>pfflsh(fileid) .eq. 0)
</PRE><A NAME="935227"><PRE>      $     call errproc
</PRE><A NAME="935233"><PRE>             .
</PRE><A NAME="935234"><PRE>             .
</PRE><A NAME="935235"><PRE>             .
</PRE><a name="932854">
<h2>6.14   PFGFNM</h2>
</a>
<A NAME="932855"><PRE><B>
</B></PRE><A NAME="935261"><PRE><B>integer </a>PFGFNM(integer fileid,
</B></PRE><A NAME="935262"><PRE><B>               integer nchr,
</B></PRE><A NAME="935270"><PRE><B>               character name)
</B></PRE><a name="934405">
Return the name of the specified PDB file. The nchr argument contains the length of the buffer on input and the length of the file name on output. If the buffer is not long enough, the length of the file name is returned in nchr and a value of 0 is returned.<p>
</a>
<a name="932856">
The arguments to </a>PFGFNM are: fileid, an integer identifier which designates the PDB file in question; nchr, an integer number of characters in the name string; name, an ASCII string which will contain the file name upon successful completion.<p>
</a>
<a name="935255">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="935257">
<p>
</a>
<A NAME="935258"><PRE><B>integer </a>PFGFNM(integer fileid,
</B></PRE><A NAME="935259"><PRE><B>               integer nchr,
</B></PRE><A NAME="935260"><PRE><B>               character name)
</B></PRE><A NAME="935263"><B>
</B><HR><A NAME="935264"><PRE>       integer pfgfnm
</PRE><A NAME="935265"><PRE>       integer fileid
</PRE><A NAME="935266"><PRE>       character*8 name(4)
</PRE><A NAME="935267"><PRE>             .
</PRE><A NAME="935268"><PRE>             .
</PRE><A NAME="935269"><PRE>             .
</PRE><A NAME="935274"><PRE>       if (</a>pfgfnm(fileid, 32, name) .eq. 0)
</PRE><A NAME="935275"><PRE>      $     call errproc
</PRE><A NAME="935276"><PRE>             .
</PRE><A NAME="935277"><PRE>             .
</PRE><A NAME="935278"><PRE>             .
</PRE><a name="935673">
<h2>6.15   PFGLS</h2>
</a>
<A NAME="935674"><PRE><B>
</B></PRE><A NAME="935675"><PRE><B>integer </a>PFGLS(integer n,
</B></PRE><A NAME="935676"><PRE><B>              integer nchr,
</B></PRE><A NAME="935677"><PRE><B>              char *name)
</B></PRE><a name="935679">
</a>Get the name of the nth entry in the internal table generated by </a>PFLST.<p>
</a>
<a name="935678">
PDBLib supports an optional </a>hierarchical </a>directory structure inside PDB files. A directory or a variable in a directory may be specified by either a </a>relative path or an </a>absolute path. Slashes separate nodes in a </a>path name. Absolute paths begin with a slash. Nodes consisting of two periods, &#147;..&#148;, refer to the next higher level directory.<p>
</a>
<a name="935680">
The arguments to </a>PFGLS are: n, an integer ordinal index into the internal table; nchr, an integer to contain the number of characters returned in string name; and name, an ASCII string to contain the returned entry name.<p>
</a>
<a name="935681">
Calls to </a>PFGLS must be preceded by a call to </a>PFLST to set up an internal table of directory and/or variable names.<p>
</a>
<a name="935806">
This function copies the name of a symbol table entry into the name, if successful. The application must ensure that name is large enough to contain the </a>longest name in the symbol table (although PDBLib permits names of arbitrary length, 256 characters would probably be more than enough). <p>
</a>
<a name="935682">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="935683">
See also </a>PFCD, </a>PFDLS, </a>PFLN, </a>PFLST, </a>PFMKDR, </a>PFPWD.<p>
</a>
<a name="935684">
<p>
</a>
<A NAME="935685"><PRE><B>integer </a>PFGLS(integer n,
</B></PRE><A NAME="935686"><PRE><B>              integer nchr,
</B></PRE><A NAME="935687"><PRE><B>              char *name)
</B></PRE><A NAME="935688"><B>
</B><HR><A NAME="935689"><PRE>       integer pfgls
</PRE><A NAME="935704"><PRE>       integer i, nvar, nchr
</PRE><A NAME="935699"><PRE>       character name(256)
</PRE><A NAME="935691"><PRE>             .
</PRE><A NAME="935692"><PRE>             .
</PRE><A NAME="935693"><PRE>             .
</PRE><A NAME="935690"><PRE>       do 100 i = 1, nvar
</PRE><A NAME="935694"><PRE>         if (</a>pfgls(i, nchr, name) .eq. 0)
</PRE><A NAME="935695"><PRE>      $       call errproc
</PRE><A NAME="935696"><PRE>             .
</PRE><A NAME="935697"><PRE>             .
</PRE><A NAME="935698"><PRE>             .
</PRE><A NAME="935705"><PRE>   100 continue
</PRE><A NAME="935701"><PRE>             .
</PRE><A NAME="935702"><PRE>             .
</PRE><A NAME="935703"><PRE>             .
</PRE><a name="933286">
<h2>6.16   PFGVAR</h2>
</a>
<A NAME="933281"><PRE><B>
</B></PRE><A NAME="933287"><PRE><B>integer </a>PFGVAR(n, nchr, name)
</B></PRE><a name="933282">
</a>Get the name of the nth variable in the internal table generated by a previous call to </a>PFVART. The table will have been sorted in a particular order and this function allows applications to access the variables in the sorted order, not the default hash ordering that would normally apply.<p>
</a>
<a name="933284">
This function copies the name into the array name, if successful. The application must ensure that name is large enough to contain the </a>longest name in the symbol table (although PDBLib permits names of arbitrary length, 256 characters would probably be more than enough). <p>
</a>
<a name="935282">
The arguments to </a>PFGVAR are: n, an integer ordinal index into the internal sorted name table; nchr, an integer in which the number of characters in the name string is returned; name, an ASCII string which will contain the variable name upon successful completion.<p>
</a>
<a name="933277">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="934617">
See also </a>PFVART and </a>PFDVAR.<p>
</a>
<a name="933713">
<p>
</a>
<A NAME="933714"><PRE><B>integer </a>PFGVAR(n, nchr, name)
</B></PRE><A NAME="933715"><B>
</B><HR><A NAME="933701"><PRE>       integer </a>pfgvar
</PRE><A NAME="933876"><PRE>       integer i, n, nvar, nchar
</PRE><A NAME="933892"><PRE>       character vname(256)
</PRE><A NAME="933891"><PRE>             .
</PRE><A NAME="933888"><PRE>             .
</PRE><A NAME="933890"><PRE>             .
</PRE><A NAME="933872"><PRE> c     print out the table of variable names created by pfvart
</PRE><A NAME="934027"><PRE>       write(6,700)
</PRE><A NAME="933874"><PRE>  700  format(/,&#146;Alphabetic list of variables:&#146;)
</PRE><A NAME="933877"><PRE>       do 701 n = 1, nvar
</PRE><A NAME="933879"><PRE>          if (</a>pfgvar(n, nchar, vname) .eq. 0)
</PRE><A NAME="933882"><PRE>      $        call errproc
</PRE><A NAME="933883"><PRE>          write(6,702) (vname(i), i=1,nchar)
</PRE><A NAME="933885"><PRE>  702     format(&#146;            &#146;,256a1)
</PRE><A NAME="933886"><PRE>  701  continue
</PRE><A NAME="933909"><PRE>             .
</PRE><A NAME="933910"><PRE>             .
</PRE><A NAME="933912"><PRE>             .
</PRE><a name="932918">
<h2>6.17   PFGVAT  &#151; (PD_get_attribute)</h2>
</a>
<A NAME="932923"><PRE><B> 
</B></PRE><A NAME="933696"><PRE><B>integer </a>PFGVAT(integer fileid,
</B></PRE><A NAME="934068"><PRE><B>               integer nv,
</B></PRE><A NAME="934407"><PRE><B>               char *var,
</B></PRE><A NAME="934605"><PRE><B>               integer na
</B></PRE><A NAME="934611"><PRE><B>               char *attr,
</B></PRE><A NAME="934612"><PRE><B>               void value)
</B></PRE><a name="934613">
</a>Get the value of the specified </a>attribute for the named entity. The application must ensure that there is sufficient space to receive the attribute value.<p>
</a>
<a name="934614">
The </a>model of an attribute in PDBLib is an entity that has a name and type. The two supported operations on attributes are to create them and to remove them. An entity in a PDB file can be assigned an </a>attribute value simply by calling </a>PFSVAT. The only association between an entry in a PDB file and any attribute is made by the name in the attribute table and the entry in the symbol table. In particular, this mechanism allows the application developer to define and use entities in a PDB file solely in terms of attributes.<p>
</a>
<a name="934615">
The arguments to </a>PFGVAT are: fileid, an integer identifier which designates the PDB file from which to get the attribute; nv, an integer number of characters in the var string; var, an ASCII string containing the name of an entity; na, an integer number of characters in the attr string; attr, an ASCII string containing the name of the attribute; and value into which the attribute value will be copied.<p>
</a>
<a name="934606">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="934621">
See also </a>PFDATT, </a>PFRATT, and </a>PFSVAT.<p>
</a>
<a name="934694">
<p>
</a>
<A NAME="933887"><PRE><B>integer </a>PFGVAT(integer fileid,
</B></PRE><A NAME="934820"><PRE><B>               integer nv,
</B></PRE><A NAME="934821"><PRE><B>               char *var,
</B></PRE><A NAME="934823"><PRE><B>               integer na
</B></PRE><A NAME="934824"><PRE><B>               char *attr,
</B></PRE><A NAME="934826"><PRE><B>               void value)
</B></PRE><A NAME="934799"><B>
</B><HR><A NAME="934801"><PRE>       integer pfgvat
</PRE><A NAME="934802"><PRE>       integer fileid
</PRE><A NAME="934738"><PRE>       character*8 dt(10)
</PRE><A NAME="934803"><PRE>             .
</PRE><A NAME="934813"><PRE>             .
</PRE><A NAME="934814"><PRE>             .
</PRE><A NAME="934815"><PRE>       if (</a>pfgvat(fileid, 3, &#145;foo&#146;, 4, &#145;date&#146;, dt) .eq. 0)
</PRE><A NAME="934816"><PRE>      $     call errproc
</PRE><A NAME="934817"><PRE>             .
</PRE><A NAME="934818"><PRE>             .
</PRE><A NAME="934819"><PRE>             .
</PRE><a name="932890">
<h2>6.18   PFIMBR</h2>
</a>
<A NAME="936352"><PRE><B>
</B></PRE><A NAME="936353"><PRE><B>integer </a>PFIMBR(integer fileid,
</B></PRE><A NAME="936354"><PRE><B>               integer ntype,
</B></PRE><A NAME="936355"><PRE><B>               char *type,
</B></PRE><A NAME="936357"><PRE><B>               integer n
</B></PRE><A NAME="936476"><PRE><B>               integer size
</B></PRE><A NAME="936358"><PRE><B>               char *space)
</B></PRE><a name="936360">
</a>Inquire about the nth member of the type <em>type</em> in PDB file<em> fileid</em>. Return the description of the member in the character buffer, space. On input size is the number of characters in the buffer space. If the member description requires more space, size is set to the number of bytes required and 0 is returned.<p>
</a>
<a name="936362">
Input to this function is: <em>fileid</em>, an integer PDBfile identification number<em>; ntype</em>, the number of characters in <em>type</em>; <em>type</em>, an ASCII string containing the name of the type; n, an integer specifying the member; size, an integer character size of the space buffer; and space, an character buffer to hold the member description.<p>
</a>
<a name="936485">
Output from this function is: <em>size</em>, the number of characters in the member description; and <em>space</em>, the member description.<p>
</a>
<a name="936361">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="936359">
See also </a>PFDEFS.<p>
</a>
<a name="936365">
<p>
</a>
<A NAME="936363"><PRE><B>integer </a>PFIMBR(integer fileid,
</B></PRE><A NAME="936364"><PRE><B>               integer ntype,
</B></PRE><A NAME="936478"><PRE><B>               char *type,
</B></PRE><A NAME="936479"><PRE><B>               integer n
</B></PRE><A NAME="936480"><PRE><B>               integer size
</B></PRE><A NAME="936481"><PRE><B>               char *space)
</B></PRE><A NAME="936464"><B>
</B><HR><A NAME="936465"><PRE>       integer pfimbr
</PRE><A NAME="936466"><PRE>       integer fileid
</PRE><A NAME="936467"><PRE>       character*8 type(10), desc(10), bdesc(100)
</PRE><A NAME="936468"><PRE>             .
</PRE><A NAME="936469"><PRE>             .
</PRE><A NAME="936470"><PRE>             .
</PRE><A NAME="936471"><PRE>       size = 80
</PRE><A NAME="936366"><PRE>       if (</a>pfimbr(fileid, 3, &#145;foo&#146;, 4, size, desc) .eq. 0) then
</PRE><A NAME="936472"><PRE>          if (size .le. 800) then
</PRE><A NAME="936368"><PRE>             if (</a>pfimbr(fileid, 3, &#145;foo&#146;, 4, size, bdesc) .eq. 0) then
</PRE><A NAME="936367"><PRE>      $         call errproc
</PRE><A NAME="936369"><PRE>             endif
</PRE><A NAME="936371"><PRE>          endif
</PRE><A NAME="936473"><PRE>       endif
</PRE><A NAME="936372"><PRE>             .
</PRE><A NAME="936474"><PRE>             .
</PRE><A NAME="936475"><PRE>             .
</PRE><a name="935700">
<h2>6.19   PFLN &#151; (PD_ln)</h2>
</a>
<A NAME="935706"><PRE><B>
</B></PRE><A NAME="935707"><PRE><B>integer </a>PFLN(integer fileid,
</B></PRE><A NAME="935708"><PRE><B>             integer nvar,
</B></PRE><A NAME="935709"><PRE><B>             char *var,
</B></PRE><A NAME="935737"><PRE><B>             integer nlink,
</B></PRE><A NAME="935738"><PRE><B>             char *link)
</B></PRE><a name="935710">
</a>Create a </a>link to a variable in a PDB file.<p>
</a>
<a name="935711">
PDBLib supports an optional </a>hierarchical </a>directory structure inside PDB files. A directory or a variable in a directory may be specified by either a </a>relative path or an </a>absolute path. Slashes separate nodes in a </a>path name. Absolute paths begin with a slash. Nodes consisting of two periods, &#147;..&#148;, refer to the next higher level directory.<p>
</a>
<a name="935712">
The arguments to </a>PFLN are: fileid, an integer file identifier; nvar, an integer number of characters in string var; var, an ASCII string containing the path name of an existing variable; nlink, an integer number of characters in string link; and link, an ASCII string containing the path name of the new link.<p>
</a>
<a name="935714">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="935715">
See also </a>PFCD, </a>PFDLS, </a>PFGLS, </a>PFLST, </a>PFMKDR, </a>PFPWD.<p>
</a>
<a name="935716">
<p>
</a>
<A NAME="935717"><PRE><B>integer </a>PFLN(integer fileid,
</B></PRE><A NAME="935713"><PRE><B>              integer nvar,
</B></PRE><A NAME="935718"><PRE><B>              char *var,
</B></PRE><A NAME="935719"><PRE><B>              integer nlink,
</B></PRE><A NAME="935739"><PRE><B>              char *link)
</B></PRE><A NAME="935720"><B>
</B><HR><A NAME="935721"><PRE>       integer pfln
</PRE><A NAME="935722"><PRE>       integer fileid
</PRE><A NAME="935724"><PRE>             .
</PRE><A NAME="935725"><PRE>             .
</PRE><A NAME="935726"><PRE>             .
</PRE><A NAME="935728"><PRE>       if (</a>pfln(fileid, 27, &#145;/animals/mammals/chimpanzee&#146;,
</PRE><A NAME="935723"><PRE>      $                  6, &#145;/chimp&#146;) .eq. 0)
</PRE><A NAME="935729"><PRE>      $     call errproc
</PRE><A NAME="935732"><PRE>             .
</PRE><A NAME="935733"><PRE>             .
</PRE><A NAME="935734"><PRE>             .
</PRE><a name="934717">
<h2>6.20   PFLST &#151; (PD_ls)</h2>
</a>
<A NAME="935727"><PRE><B>
</B></PRE><A NAME="935730"><PRE><B>integer </a>PFLST(integer fileid,
</B></PRE><A NAME="935731"><PRE><B>              integer npath,
</B></PRE><A NAME="935736"><PRE><B>              char *path,
</B></PRE><A NAME="935740"><PRE><B>              integer ntype,
</B></PRE><A NAME="935741"><PRE><B>              char *type,
</B></PRE><A NAME="935776"><PRE><B>              integer num)
</B></PRE><a name="935742">
</a>Generate an internal table of names of entries (variables and/or directories) in a PDB file that are of a specified type and that are in the directory and match the variable name pattern specified.<p>
</a>
<a name="935743">
PDBLib supports an optional </a>hierarchical </a>directory structure inside PDB files. A directory or a variable in a directory may be specified by either a </a>relative path or an </a>absolute path. Slashes separate nodes in a </a>path name. Absolute paths begin with a slash. Nodes consisting of two periods, &#147;..&#148;, refer to the next higher level directory.<p>
</a>
<a name="935744">
The arguments to </a>PFLST are: fileid, an integer file identifier; npath, an integer number of characters in string path; path, an ASCII string containing the path name of the directory to search and/or the variable name pattern to match; ntype, an integer number of characters in string type; type, an ASCII string containing the type of entries to return; and num, an integer to contain the number of entries returned.<p>
</a>
<a name="935766">
If npath is zero, the contents of the </a>current </a>directory are listed. If ntype is zero, all types are returned.<p>
</a>
<a name="935767">
The terminal node of path may contain meta characters &#147;*&#148; and &#147;?&#148;. Each &#147;*&#148; matches any zero or more characters and each &#147;?&#148; matches any single character.<p>
</a>
<a name="935765">
Call </a>PFGLS to get an entry from the internal table generated by </a>PFLST. Call </a>PFDLS to release the table. </a>PFLST automatically releases tables created by previous calls.<p>
</a>
<a name="935745">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="935746">
See also </a>PFCD, </a>PFDLS, </a>PFGLS, </a>PFLN, </a>PFMKDR, </a>PFPWD.<p>
</a>
<a name="935747">
<p>
</a>
<A NAME="935748"><PRE><B>integer </a>PFLST(integer fileid,
</B></PRE><A NAME="935749"><PRE><B>              integer npath,
</B></PRE><A NAME="935750"><PRE><B>              char *path,
</B></PRE><A NAME="935751"><PRE><B>              integer ntype,
</B></PRE><A NAME="935752"><PRE><B>              char *type,
</B></PRE><A NAME="935768"><PRE><B>              integer num)
</B></PRE><A NAME="935753"><B>
</B><HR><A NAME="935754"><PRE>       integer pflst, pfdls
</PRE><A NAME="935755"><PRE>       integer fileid, num
</PRE><A NAME="935756"><PRE>             .
</PRE><A NAME="935757"><PRE>             .
</PRE><A NAME="935758"><PRE>             .
</PRE><A NAME="935785"><PRE> c generate a table of all directories in the current directory
</PRE><A NAME="935759"><PRE>       if (</a>pflst(fileid, 0, &#145;&#146;, 9, &#145;Directory&#146;, num) .eq. 0)
</PRE><A NAME="935761"><PRE>      $     call errproc
</PRE><A NAME="935773"><PRE>             .
</PRE><A NAME="935774"><PRE>             .
</PRE><A NAME="935777"><PRE>             .
</PRE><A NAME="935783"><PRE> c generate a table of the variables of type char * in directory animals
</PRE><A NAME="935771"><PRE>       if (</a>pflst(fileid, 7, &#145;animals&#146;, 6, &#145;char *&#146;, num) .eq. 0)
</PRE><A NAME="935772"><PRE>      $     call errproc
</PRE><A NAME="935762"><PRE>             .
</PRE><A NAME="935763"><PRE>             .
</PRE><A NAME="935764"><PRE>             .
</PRE><a name="935760">
<h2>6.21   PFMKDR  &#151; (PD_mkdir)</h2>
</a>
<A NAME="935769"><PRE><B>
</B></PRE><A NAME="935770"><PRE><B>integer </a>PFMKDR(integer fileid,
</B></PRE><A NAME="935778"><PRE><B>               integer nchr,
</B></PRE><A NAME="935780"><PRE><B>               char *dirname)
</B></PRE><a name="935781">
</a>Create a new </a>directory in a PDB file.<p>
</a>
<a name="935782">
PDBLib supports an optional </a>hierarchical </a>directory structure inside PDB files. A directory or a variable in a directory may be specified by either a </a>relative path or an </a>absolute path. Slashes separate nodes in a </a>path name. Absolute paths begin with a slash. Nodes consisting of two periods, &#147;..&#148;, refer to the next higher level directory.<p>
</a>
<a name="935784">
The arguments to </a>PFMKDR are: fileid, an integer file identifier; nchr, an integer number of characters in string dirname; and dirname, an ASCII string containing the path name of the new directory.<p>
</a>
<a name="935787">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="935788">
See also </a>PFCD, </a>PFDLS, </a>PFGLS, </a>PFLN, </a>PFLST, </a>PFPWD.<p>
</a>
<a name="935789">
<p>
</a>
<A NAME="935790"><PRE><B>integer PFMKDR(integer fileid,
</B></PRE><A NAME="935791"><PRE><B>               integer nchr,
</B></PRE><A NAME="935792"><PRE><B>               char *dirname)
</B></PRE><A NAME="935793"><B>
</B><HR><A NAME="935794"><PRE>       integer pfmkdr
</PRE><A NAME="935795"><PRE>       integer fileid
</PRE><A NAME="935796"><PRE>             .
</PRE><A NAME="935797"><PRE>             .
</PRE><A NAME="935798"><PRE>             .
</PRE><A NAME="935799"><PRE>       if (</a>pfmkdr(fileid, 16, &#145;/animals/mammals&#146;) .eq. 0)
</PRE><A NAME="935800"><PRE>      $     call errproc
</PRE><A NAME="935801"><PRE>             .
</PRE><A NAME="935802"><PRE>             .
</PRE><A NAME="935804"><PRE>             .
</PRE><a name="935735">
<h2>6.22   PFOPEN  &#151; (PD_open)</h2>
</a>
<A NAME="934720"><PRE><B>
</B></PRE><A NAME="932760"><PRE><B>integer </a>PFOPEN(integer nchr,
</B></PRE><A NAME="932764"><PRE><B>               character name,
</B></PRE><A NAME="932766"><PRE><B>               character mode)
</B></PRE><a name="934727">
</a>Open an existing PDB file or </a>create a new PDB file. Depending on the value of mode, PDBLib attempts to open the file name in </a>read-only binary mode, open the file in </a>append binary mode, or </a>create a new file in </a>read-write binary mode.<p>
</a>
<a name="934731">
Any string which begins with &#145;</a>r&#146; causes the file to be opened in read-only mode, any string beginning with &#145;</a>a&#146; causes the file to be opened in append mode, and any string beginning with &#145;</a>w&#146; causes a file to be created in read-write mode.<p>
</a>
<a name="934734">
Next, the beginning of the file is searched for the header which identifies the file as having been generated by PDBLib. The addresses of the structure chart and symbol table are then sought.<p>
</a>
<a name="934743">
The structure chart from the file is read in. The structure chart contains information about data types (e.g. floats), their sizes in bytes and their structures, if any. By default there are six </a>primitive </a>data types that PDBLib knows about: short integers, integers, long integers, floating point numbers, double precision floating point numbers, characters, and pointers. The sizes of these types varies from machine to machine, but PDBLib hides this from the user.<p>
</a>
<a name="934749">
The symbol table from the file is read in. The symbol table contains the list of variables in the file, their types as defined in the structure chart, and dimensioning information for arrays. Each read from the file first consults the symbol table to see if the requested variable is present in the PDB file.<p>
</a>
<a name="934753">
Both the structure chart and the symbol table are implemented as hash tables, although their shapes are different. This makes lookups as efficient as possible given an unknown amount of data in the file.<p>
</a>
<a name="934758">
The arguments to </a>PFOPEN are: nchr, the number of characters in the string containing the file name; name, an ASCII string, which is the name of the file to be opened/created; and mode, an ASCII string, which is the mode (either &#145;w&#146; for create, &#145;r&#146; for read-only or &#145;a&#146; for append).<p>
</a>
<a name="934765">
The function returns an integer identifier for the PDB file opened/created. This identifies the particular file to PDBLib. As such, if it is overwritten the file is lost. The number of PDB files which can be open simultaneously is machine or operating system dependent, but each open PDB file has a unique identifier associated with it.<p>
</a>
<a name="934769">
If any aspect of the PDB file opening process fails 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="933717">
<p>
</a>
<A NAME="933718"><PRE><B>integer </a>PFOPEN(integer nchr,
</B></PRE><A NAME="933771"><PRE><B>               character name,
</B></PRE><A NAME="933772"><PRE><B>               character mode)
</B></PRE><A NAME="933719"><B>
</B><HR><A NAME="933716"><PRE>       integer </a>pfopen
</PRE><A NAME="933904"><PRE>       integer fileid
</PRE><A NAME="933913"><PRE>             .
</PRE><A NAME="933915"><PRE>             .
</PRE><A NAME="933916"><PRE>             .
</PRE><A NAME="933905"><PRE>       fileid = </a>pfopen(8, &#146;file.pdb&#146;, &#146;r&#146;)
</PRE><A NAME="933906"><PRE>       if (fileid .eq. 0)
</PRE><A NAME="933907"><PRE>      $     call errproc
</PRE><A NAME="933917"><PRE>             .
</PRE><A NAME="933918"><PRE>             .
</PRE><A NAME="933919"><PRE>             .
</PRE><a name="932741">
<h2>6.23   PFPTRD  &#151; (PD_read_alt)</h2>
</a>
<A NAME="932743"><PRE><B>
</B></PRE><A NAME="932945"><PRE><B>integer </a>PFPTRD(integer fileid,
</B></PRE><A NAME="933010"><PRE><B>               integer nchr,
</B></PRE><A NAME="933011"><PRE><B>               character name,
</B></PRE><A NAME="933497"><PRE><B>               void space
</B></PRE><A NAME="934540"><PRE><B>               integer ind)
</B></PRE><a name="934552">
</a>Read all or part of a data entry from an open PDB file. The symbol table of the given PDB file is searched for the given name and if it is found the information there is used to read the proper number of bytes from the file, do any conversions, and put the result in memory pointed to by var.<p>
</a>
<a name="934554">
The elements to be read from an array are designated by start, stop, step triples (one for each dimension) passed in the argument ind.<p>
</a>
<a name="933509">
The arguments to </a>PFPTRD are: fileid, an integer identifier which designates the PDB file from which to attempt the read; nchr, an integer number of characters in the name string; name, an ASCII string containing the name of the variable to lookup; space, the location where the data is to be placed; and ind, an array of integers which specify the elements to be read.<p>
</a>
<a name="933503">
Note: In each </a>PFPTRD operation, the type of space must be a pointer to the type of name.<p>
</a>
<a name="933504">
Note: When reading part of a variable, especially a structured variable, the path to the desired part must contain one array reference for each level of </a>indirection traversed.<p>
</a>
<a name="933505">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="933510">
See also </a>PFREAD, </a>PFRDAS, and </a>PFRDAD.<p>
</a>
<a name="933506">
<p>
</a>
<A NAME="933507"><PRE><B>integer </a>PFPTRD(integer fileid,
</B></PRE><A NAME="934541"><PRE><B>               integer nchr,
</B></PRE><A NAME="934542"><PRE><B>               character name,
</B></PRE><A NAME="934545"><PRE><B>               void space
</B></PRE><A NAME="934549"><PRE><B>               integer ind)
</B></PRE><A NAME="933511"><B>
</B><HR><A NAME="933512"><PRE>       integer </a>pfptrd
</PRE><A NAME="933513"><PRE>       integer fileid, ind(3)
</PRE><A NAME="933514"><PRE>       real xodd(10)
</PRE><A NAME="933519"><PRE>             .
</PRE><A NAME="933520"><PRE>             .
</PRE><A NAME="933521"><PRE>             .
</PRE><A NAME="933522"><PRE> c     read the first 10 odd elements of x into array xodd
</PRE><A NAME="932921"><PRE>       ind(1) = 1
</PRE><A NAME="933515"><PRE>       ind(2) = 20
</PRE><A NAME="933516"><PRE>       ind(3) = 2
</PRE><A NAME="934298"><PRE>       if (</a>pfptrd(fileid, 1, &#146;x&#146;, xodd, ind) .eq. 0)
</PRE><A NAME="934488"><PRE>      $     call errproc
</PRE><A NAME="934535"><PRE>             .
</PRE><A NAME="934536"><PRE>             .
</PRE><A NAME="934537"><PRE>             .
</PRE><a name="935786">
<h2>6.24   PFPWD</h2>
</a>
<A NAME="935812"><PRE><B>
</B></PRE><A NAME="935813"><PRE><B>integer </a>PFPWD(integer fileid,
</B></PRE><A NAME="935814"><PRE><B>              integer nchr,
</B></PRE><A NAME="935815"><PRE><B>              char *dirname)
</B></PRE><a name="935816">
</a>Get the </a>current </a>directory for a PDB file.<p>
</a>
<a name="935817">
PDBLib supports an optional </a>hierarchical </a>directory structure inside PDB files. A directory or a variable in a directory may be specified by either a </a>relative path or an </a>absolute path. Slashes separate nodes in a </a>path name. Absolute paths begin with a slash. Nodes consisting of two periods, &#147;..&#148;, refer to the next higher level directory.<p>
</a>
<a name="935818">
The arguments to </a>PFPWD are: fileid, an integer file identifier; nchr, an integer to contain the number of characters returned in string dirname; and dirname, an ASCII string to contain the path name of the </a>current </a>directory.<p>
</a>
<a name="935808">
This function copies the path name of a directory into the dirname, if successful. The application must ensure that dirname is large enough to contain the longest directory name (although PDBLib permits names of arbitrary length, 256 characters would probably be more than enough). <p>
</a>
<a name="935819">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="935821">
See also </a>PFCD, </a>PFDLS, </a>PFGLS, </a>PFLN, </a>PFLST, </a>PFMKDR.<p>
</a>
<a name="935822">
<p>
</a>
<A NAME="935905"><PRE><B>integer </a>PFPWD(integer fileid,
</B></PRE><A NAME="935906"><PRE><B>              integer nchr,
</B></PRE><A NAME="935909"><PRE><B>              char *dirname)
</B></PRE><A NAME="935910"><B>
</B><HR><A NAME="935911"><PRE>       integer pfpwd
</PRE><A NAME="935912"><PRE>       integer fileid, nchr
</PRE><A NAME="935805"><PRE>       character dirname(256)
</PRE><A NAME="935914"><PRE>             .
</PRE><A NAME="935915"><PRE>             .
</PRE><A NAME="935917"><PRE>             .
</PRE><A NAME="935918"><PRE>       if (</a>pfpwd(fileid, nchr, dirname) .eq. 0)
</PRE><A NAME="935967"><PRE>      $     call errproc
</PRE><A NAME="935991"><PRE>             .
</PRE><A NAME="935992"><PRE>             .
</PRE><A NAME="935993"><PRE>             .
</PRE><a name="934618">
<h2>6.25   PFRATT  &#151; (PD_rem_attribute)</h2>
</a>
<A NAME="934620"><PRE><B>
</B></PRE><A NAME="934628"><PRE><B>integer </a>PFRATT(integer fileid,
</B></PRE><A NAME="934633"><PRE><B>               integer na
</B></PRE><A NAME="934634"><PRE><B>               char *attr)
</B></PRE><a name="934636">
</a>Remove the specified </a>attribute. PDBLib will remove the values of this attribute which may be associated with entities in the file.<p>
</a>
<a name="934637">
The </a>model of an attribute in PDBLib is an entity that has a name and type. The two supported operations on attributes are to create them and to remove them. An entity in a PDB file can be assigned an </a>attribute value simply by calling </a>PFSVAT. The only association between an entry in a PDB file and any attribute is made by the name in the attribute table and the entry in the symbol table. In particular, this mechanism allows the application developer to define and use entities in a PDB file solely in terms of attributes.<p>
</a>
<a name="934638">
The arguments to </a>PFRATT are: fileid, an integer identifier which designates the PDB file from which to remove the attribute; na, an integer number of characters in the attr string; and attr, an ASCII string containing the name of the attribute.<p>
</a>
<a name="934639">
The return value is 1 if successful and 0 otherwise.<p>
</a>
<a name="934640">
See also </a>PFDATT, </a>PFGVAT, and </a>PFSVAT.<p>
</a>
<a name="934784">
<p>
</a>
<A NAME="934851"><PRE><B>integer </a>PFRATT(integer fileid,
</B></PRE><A NAME="934853"><PRE><B>               integer na
</B></PRE><A NAME="934854"><PRE><B>               char *attr)
</B></PRE><A NAME="934831"><B>
</B><HR><A NAME="934833"><PRE>       integer pfratt
</PRE><A NAME="934834"><PRE>       integer fileid
</PRE><A NAME="934836"><PRE>             .
</PRE><A NAME="934838"><PRE>             .
</PRE><A NAME="934839"><PRE>             .
</PRE><A NAME="934840"><PRE>       if (</a>pfratt(fileid, 4, &#145;date&#146;) .eq. 0)
</PRE><A NAME="934841"><PRE>      $     call errproc
</PRE><A NAME="934849"><PRE>             .
</PRE><A NAME="934850"><PRE>             .
</PRE><A NAME="934783"><PRE>             .
</PRE><a name="936536">
<h2>6.26   PFRDAD  &#151; (PD_read_as_alt)</h2>
</a>
<A NAME="936537"><PRE><B>
</B></PRE><A NAME="936542"><PRE><B>integer </a>PFRDAD(integer fileid,
</B></PRE><A NAME="936543"><PRE><B>               integer nchr,
</B></PRE><A NAME="936673"><PRE><B>               character name,
</B></PRE><A NAME="936809"><PRE><B>               integer ntype,
</B></PRE><A NAME="936811"><PRE><B>               character intype,
</B></PRE><A NAME="936674"><PRE><B>               void space
</B></PRE><A NAME="936675"><PRE><B>               integer ind)
</B></PRE><a name="936676">
</a>Read all or part of a data entry from an open PDB file as data type intype. The symbol table of the given PDB file is searched for the given name and if it is found the information there is used to read the proper number of bytes from the file, do any conversions, and put the result in memory pointed to by space.<p>
</a>
<a name="936677">
The elements to be read from an array are designated by start, stop, step triples (one for each dimension) passed in the argument ind.<p>
</a>
<a name="936678">
The arguments to </a>PFRDAD are: fileid, an integer identifier which designates the PDB file from which to attempt the read; nchr, an integer number of characters in the name string; name, an ASCII string containing the name of the variable to lookup; ntype, an integer number of characters in the intype string; intype, an ASCII string specifying the type of data to which space points; space, the location where the data is to be placed; and ind, an array of integers which specify the elements to be read.<p>
</a>
<a name="936679">
Note: In each </a>PFRDAD operation, the type of space must be a pointer to the type of intype.<p>
</a>
<a name="936680">
Note: When reading part of a variable, especially a structured variable, the path to the desired part must contain one array reference for each level of </a>indirection traversed.<p>
</a>
<a name="936681">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="936682">
See also PFPTRD, PFRDAS, and PFREAD.<p>
</a>
<a name="936683">
<p>
</a>
<A NAME="936684"><PRE><B>integer </a>PFRDAD(integer fileid,
</B></PRE><A NAME="936685"><PRE><B>               integer nchr,
</B></PRE><A NAME="936686"><PRE><B>               character name,
</B></PRE><A NAME="936812"><PRE><B>               integer ntype,
</B></PRE><A NAME="936813"><PRE><B>               character intype,
</B></PRE><A NAME="936687"><PRE><B>               void space
</B></PRE><A NAME="936688"><PRE><B>               integer ind)
</B></PRE><A NAME="936689"><B>
</B><HR><A NAME="936690"><PRE>       integer </a>pfrdad
</PRE><A NAME="936691"><PRE>       integer fileid, ind(3)
</PRE><A NAME="936692"><PRE>       real*8 xdd(10)
</PRE><A NAME="936693"><PRE>             .
</PRE><A NAME="936694"><PRE>             .
</PRE><A NAME="936695"><PRE>             .
</PRE><A NAME="936696"><PRE> c     read the first 10 elements of float x into array xdd 
</PRE><A NAME="936824"><PRE> c     as type double.
</PRE><A NAME="936664"><PRE> 
</PRE><A NAME="936697"><PRE>       ind(1) = 1
</PRE><A NAME="936698"><PRE>       ind(2) = 10
</PRE><A NAME="936699"><PRE>       ind(3) = 1
</PRE><A NAME="936700"><PRE>       if (</a>pfrdad(fileid, 1, &#146;x&#146;, 6, &#145;double&#146;, xdd, ind) .eq. 0)
</PRE><A NAME="936701"><PRE>      $     call errproc
</PRE><A NAME="936702"><PRE>             .
</PRE><A NAME="936703"><PRE>             .
</PRE><A NAME="936704"><PRE>             .
</PRE><a name="936632">
<h2>6.27   PFRDAS  &#151; (PD_read_as)</h2>
</a>
<A NAME="936633"><PRE><B>
</B></PRE><A NAME="936634"><PRE><B>integer </a>PFRDAS(integer fileid,
</B></PRE><A NAME="936635"><PRE><B>               integer nchr,
</B></PRE><A NAME="936636"><PRE><B>               character name,
</B></PRE><A NAME="936814"><PRE><B>               integer ntype,
</B></PRE><A NAME="936815"><PRE><B>               character intype,
</B></PRE><A NAME="936637"><PRE><B>               void space)
</B></PRE><a name="936638">
</a>Read data from an open PDB file as data type intype. The symbol table of the given PDB file is searched for the given name and if it is found the information there is used to read the proper number of bytes from the file, do any conversions, and put the result in memory pointed to by space.<p>
</a>
<a name="936639">
The arguments to </a>PFRDAS are: fileid, an integer identifier which designates the PDB file from which to attempt the read; nchr, an integer number of characters in the name string; name, an ASCII string containing the name of the variable to lookup; ntype, an integer number of characters in the intype string; intype, an ASCII string specifying the type of data to which space points; and space, the location where the data is to be placed.<p>
</a>
<a name="936640">
Note: In each </a>PFRDAS operation, the type of space must be a pointer to the type of intype.<p>
</a>
<a name="936641">
Note: When reading part of a variable, especially a structured variable, the path to the desired part must contain one array reference for each level of </a>indirection traversed.<p>
</a>
<a name="936642">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="936826">
See also PFPTRD, PFRDAD, and PFREAD.<p>
</a>
<a name="936643">
<p>
</a>
<A NAME="936644"><PRE><B>integer </a>PFRDAS(integer fileid,
</B></PRE><A NAME="936645"><PRE><B>               integer nchr,
</B></PRE><A NAME="936646"><PRE><B>               character name,
</B></PRE><A NAME="936816"><PRE><B>               integer ntype,
</B></PRE><A NAME="936817"><PRE><B>               character intype,
</B></PRE><A NAME="936647"><PRE><B>               void space)
</B></PRE><A NAME="936648"><B>
</B><HR><A NAME="936649"><PRE>       integer </a>pfrdas
</PRE><A NAME="936650"><PRE>       integer fileid
</PRE><A NAME="936651"><PRE>       real*8 xx(20)
</PRE><A NAME="936655"><PRE>             .
</PRE><A NAME="936657"><PRE>             .
</PRE><A NAME="936658"><PRE>             .
</PRE><A NAME="936659"><PRE> c     read array x into array xx as type double
</PRE><A NAME="936660"><PRE>       if (</a>pfrdas(fileid, 1, &#146;x&#146;, 6, &#146;double&#146;, xx) .eq. 0)
</PRE><A NAME="936661"><PRE>      $     call errproc
</PRE><A NAME="932454"><PRE>             .
</PRE><A NAME="936672"><PRE>             .
</PRE><A NAME="936584"><PRE>             .
</PRE><a name="936671">
<h2>6.28   PFREAD  &#151; (PD_read)</h2>
</a>
<A NAME="934778"><PRE><B>
</B></PRE><A NAME="932771"><PRE><B>integer </a>PFREAD(integer fileid,
</B></PRE><A NAME="932772"><PRE><B>               integer nchr,
</B></PRE><A NAME="932774"><PRE><B>               character name,
</B></PRE><A NAME="932773"><PRE><B>               void space)
</B></PRE><a name="934785">
</a>Read data from an open PDB file. The symbol table of the given PDB file is searched for the given name and if it is found the information there is used to read the proper number of bytes from the file, do any conversions, and put the result in memory pointed to by space.<p>
</a>
<a name="934790">
The arguments to </a>PFREAD are: fileid, an integer identifier which designates the PDB file from which to attempt the read; nchr, an integer number of characters in the name string; name, an ASCII string containing the name of the variable to lookup; and space, the location where the data is to be placed.<p>
</a>
<a name="934793">
Note: In each </a>PFREAD operation, the type of space must be a pointer to the type of name.<p>
</a>
<a name="934797">
Note: When reading part of a variable, especially a structured variable, the path to the desired part must contain one array reference for each level of </a>indirection traversed.<p>
</a>
<a name="934800">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="936652">
See also PFPTRD, PFRDAD, and PFRDAS.<p>
</a>
<a name="933722">
<p>
</a>
<A NAME="933723"><PRE><B>integer </a>PFREAD(integer fileid,
</B></PRE><A NAME="933774"><PRE><B>               integer nchr,
</B></PRE><A NAME="933775"><PRE><B>               character name,
</B></PRE><A NAME="933776"><PRE><B>               void space)
</B></PRE><A NAME="933721"><B>
</B><HR><A NAME="933724"><PRE>       integer </a>pfread
</PRE><A NAME="933925"><PRE>       integer fileid
</PRE><A NAME="934005"><PRE>       real x(20)
</PRE><A NAME="933934"><PRE>       common /abc/ a(2), b, c(2,2:4)
</PRE><A NAME="933935"><PRE>       real a, b, c
</PRE><A NAME="933940"><PRE>       common /jkl/ j, k, l
</PRE><A NAME="933922"><PRE>       integer j, k, l
</PRE><A NAME="934007"><PRE>             .
</PRE><A NAME="933923"><PRE>             .
</PRE><A NAME="933924"><PRE>             .
</PRE><A NAME="933920"><PRE> c     read array x
</PRE><A NAME="934028"><PRE>       if (</a>pfread(fileid, 1, &#146;x&#146;, x) .eq. 0)
</PRE><A NAME="933927"><PRE>      $     call errproc
</PRE><A NAME="933936"><PRE> 
</PRE><A NAME="934057"><PRE> c     read first element of member c of structure abc
</PRE><A NAME="934029"><PRE>       if (</a>pfread(fileid, 10, &#146;abc.c(1,2)&#146;, c) .eq. 0)
</PRE><A NAME="933938"><PRE>      $     call errproc
</PRE><A NAME="934006"><PRE> 
</PRE><A NAME="934058"><PRE> c     read entire structure jkl
</PRE><A NAME="934030"><PRE>       if (</a>pfread(fileid, 3, &#146;jkl&#146;, j) .eq. 0)
</PRE><A NAME="934008"><PRE>      $     call errproc
</PRE><A NAME="933930"><PRE>             .
</PRE><A NAME="933931"><PRE>             .
</PRE><A NAME="933932"><PRE>             .
</PRE><a name="934631">
<h2>6.29   PFSVAT  &#151; (PD_set_attribute)</h2>
</a>
<A NAME="934632"><PRE><B>
</B></PRE><A NAME="934635"><PRE><B>integer </a>PFSVAT(integer fileid,
</B></PRE><A NAME="934641"><PRE><B>               integer nv,
</B></PRE><A NAME="934642"><PRE><B>               char *var,
</B></PRE><A NAME="934643"><PRE><B>               integer na
</B></PRE><A NAME="934644"><PRE><B>               char *attr,
</B></PRE><A NAME="934646"><PRE><B>               void value)
</B></PRE><a name="934647">
</a>Set the value of the specified </a>attribute for the named entity.<p>
</a>
<a name="934648">
The </a>model of an attribute in PDBLib is an entity that has a name and type. The two supported operations on attributes are to create them and to remove them. An entity in a PDB file can be assigned an </a>attribute value simply by calling </a>PFSVAT. The only association between an entry in a PDB file and any attribute is made by the name in the attribute table and the entry in the symbol table. In particular, this mechanism allows the application developer to define and use entities in a PDB file solely in terms of attributes.<p>
</a>
<a name="934649">
The arguments to </a>PFSVAT are: fileid, an integer identifier which designates the PDB file in which the attribute is being set; nv, an integer number of characters in the var string; var, an ASCII string containing the name of an entity; na, an integer number of characters in the attr string; attr, an ASCII string containing the name of the attribute being set; and value containing the attribute value.<p>
</a>
<a name="933283">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="934651">
See also </a>PFDATT, </a>PFRATT, and </a>PFGVAT.<p>
</a>
<a name="934795">
<p>
</a>
<A NAME="934789"><PRE><B>integer </a>PFSVAT(integer fileid,
</B></PRE><A NAME="934889"><PRE><B>               integer nv,
</B></PRE><A NAME="934890"><PRE><B>               char *var,
</B></PRE><A NAME="934891"><PRE><B>               integer na
</B></PRE><A NAME="934892"><PRE><B>               char *attr,
</B></PRE><A NAME="934893"><PRE><B>               void value)
</B></PRE><A NAME="934864"><B>
</B><HR><A NAME="934828"><PRE>       integer pfsvat
</PRE><A NAME="934830"><PRE>       integer scftcs
</PRE><A NAME="934865"><PRE>       integer fileid
</PRE><A NAME="934868"><PRE>       character*80 dt
</PRE><A NAME="934869"><PRE>             .
</PRE><A NAME="934870"><PRE>             .
</PRE><A NAME="934882"><PRE>             .
</PRE><A NAME="935026"><PRE>       scftcs(dt, &#145;Mon March 27, 1921&#146;, 18)
</PRE><A NAME="934827"><PRE>       if (pfsvat(fileid, 3, &#145;foo&#146;, 4, &#145;date&#146;, dt) .eq. 0)
</PRE><A NAME="934884"><PRE>      $     call errproc
</PRE><A NAME="934885"><PRE>             .
</PRE><A NAME="934886"><PRE>             .
</PRE><A NAME="934887"><PRE>             .
</PRE><a name="934806">
<h2>6.30   PFTRGT  &#151; (PD_target)</h2>
</a>
<A NAME="934809"><PRE><B>
</B></PRE><A NAME="932775"><PRE><B>integer </a>PFTRGT(integer is,
</B></PRE><A NAME="932777"><PRE><B>               integer ia)
</B></PRE><a name="934822">
Write the next PDB file to be created according to the specified </a>data standard and </a>alignment. PDBLib has a general binary data conversion mechanism called </a>parametrized </a>data </a>conversion (</a>PDC). An integer type is described by one set of parameters and a floating point type is described by another. A general purpose conversion routine takes the description of the input type and a description of the desired output type and does the conversion. In this way, PDBLib avoids an N2 increase in data conversion routines as it ports to new machines. In fact, the number of data standards and alignments grows more slowly than N because many machines share common formats.<p>
</a>
<a name="934825">
An additional advantage to PDC is that by specifying a format involving the minimal number of bits to represent the data for a file, PDBLib can carry out a large class of data compressions.<p>
</a>
<a name="934829">
PDBLib carries several predefined </a>data_standard and </a>data_alignment structures which describe a large number of binary data formats. In the C API these may be directly referenced and their names are given here for completeness.<p>
</a>
<a name="934832">
Data standards: </a>IEEEA_STD, </a>IEEEB_STD, </a>IEEEC_STD, </a>INTELA_STD, </a>INTELB_STD, </a>VAX_STD, and </a>CRAY_STD.<p>
</a>
<a name="933191">
Data alignments: </a>DEF_ALIGNMENT, </a>SPARC_ALIGNMENT, </a>MIPS_ALIGNMENT, </a>RS6000_ALIGNMENT, </a>68000_ALIGNMENT, </a>INTEL_ALIGNMENT, </a>CRAY_ALIGNMENT, and </a>UNICOS_ALIGNMENT.<p>
</a>
<a name="934835">
In the FORTRAN API, these structures are placed in two arrays and the indices into these arrays are passed into </a>PFTRGT to specify the binary format to be targeted.<p>
</a>
<a name="934837">
The list of standards is:<p>
</a>
<a name="934842">
<dd>1 - </a>IEEEA_STD<P>
</a>
<a name="934843">
<dd>2 - </a>IEEEB_STD<P>
</a>
<a name="934844">
<dd>3 - </a>IEEEC_STD<P>
</a>
<a name="934845">
<dd>4 - </a>INTELA_STD<P>
</a>
<a name="934846">
<dd>5 - </a>INTELB_STD<P>
</a>
<a name="934847">
<dd>6 - </a>VAX_STD<P>
</a>
<a name="934848">
<dd>7 - </a>CRAY_STD<P>
</a>
<a name="934852">
The list of </a>alignments is:<p>
</a>
<dl>
<a name="934856">
<dt>1 - </a>M68000_ALIGNMENT
</a>
<a name="934857">
<dt>2 - </a>SPARC_ALIGNMENT
</a>
<a name="934858">
<dt>3 - </a>MIPS_ALIGNMENT
</a>
<a name="934859">
<dt>4 - </a>INTEL_ALIGNMENT
</a>
<a name="934860">
<dt>5 - </a>DEF_ALIGNMENT
</a>
<a name="934861">
<dt>6 - </a>CRAY_ALIGNMENT
</a>
<a name="933253">
<dt>7 - </a>UNICOS_ALIGNMENT
</a>
<a name="933258">
<dt>8 - </a>RS6000_ALIGNMENT
</a>
<a name="934866">
Some common </a>configurations are:<p>
</a>
<a name="934871">
<dt>Motorola					- </a>PFTRGT(1, 1)
</a>
<a name="934872">
<dt>SPARC					- PFTRGT(1, 2)
</a>
<a name="933308">
<dt>MIPS, SGI					- PFTRGT(1, 3)
</a>
<a name="934873">
<dt>IBM RS6000					- PFTRGT(1, 8)
</a>
<a name="934874">
<dt>Mac/Think C					- PFTRGT(2, 1)
</a>
<a name="934875">
<dt>Mac/MPW					- PFTRGT(3, 1)
</a>
<a name="934876">
<dt>DOS					- PFTRGT(4, 4)
</a>
<a name="934877">
<dt>Intel 80x86 UNIX					- PFTRGT(5, 4)
</a>
<a name="934878">
<dt>DEC Vax					- PFTRGT(6, 5)
</a>
<a name="934879">
<dt>DEC 3100					- PFTRGT(5, 3)
</a>
<a name="934880">
<dt>NLTSS Cray					- PFTRGT(7, 6)
</a>
<a name="934881">
<dt>UNICOS Cray					- </a>PFTRGT(7, 7)
</a>
<a name="934888">
The argument, is, is an index corresponding one of the </a>data_standard structures listed above, and the argument, ia, is an index corresponding to one of the </a>data_alignment structures above. See the section on Data Structures later on in this manual.<p>
</a>
<a name="932528">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="933727">
<p>
</a>
<A NAME="933728"><PRE><B>integer </a>PFTRGT(integer is,
</B></PRE><A NAME="933777"><PRE><B>               integer ia)
</B></PRE><A NAME="933729"><B>
</B><HR><A NAME="933725"><PRE>       integer </a>pftrgt
</PRE><A NAME="933963"><PRE>       integer is, ia
</PRE><A NAME="933964"><PRE>             .
</PRE><A NAME="933965"><PRE>             .
</PRE><A NAME="933966"><PRE>             .
</PRE><A NAME="933962"><PRE> c     set target architecture (MIPS, SGI)
</PRE><A NAME="933942"><PRE> c     IEEEA_STD
</PRE><A NAME="933943"><PRE>       is = 1
</PRE><A NAME="933945"><PRE> c     MIPS_ALIGNMENT
</PRE><A NAME="933946"><PRE>       ia = 3
</PRE><A NAME="933947"><PRE>       if (</a>pftrgt(is, ia) .eq. 0)
</PRE><A NAME="933960"><PRE>      $     call errproc
</PRE><A NAME="933967"><PRE>             .
</PRE><A NAME="933968"><PRE>             .
</PRE><A NAME="933969"><PRE>             .
</PRE></dl>
<a name="933269">
<h2>6.31   PFVART</h2>
</a>
<A NAME="933274"><PRE><B>
</B></PRE><A NAME="934650"><PRE><B>integer </a>PFVART(integer fileid,
</B></PRE><A NAME="935285"><PRE><B>               integer order,
</B></PRE><A NAME="935284"><PRE><B>               integer nvars)
</B></PRE><a name="933270">
</a>Generate an internal table of variables in the specified PDB file. With subsequent calls to </a>PFGVAR, each entry can be obtained one at a time by ordinal index. The table is sorted according to a specified scheme. The current choices are alphabetic and by disk address.<p>
</a>
<a name="933272">
The arguments to this function are: <em>fileid, </em>an integer which identifies the PDBfile; order, an integer specifying the </a>sort ordering; and nvars, an integer in which the number of variables in the file is returned. The choices for order are: 1, for an alphabetic sort; and 2, for a disk address order sort.<p>
</a>
<a name="933268">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="935240">
See also </a>PFDVAR and </a>PFGVAR.<p>
</a>
<a name="933730">
<p>
</a>
<A NAME="933880"><PRE><B>integer </a>PFVART(integer fileid,
</B></PRE><A NAME="933731"><PRE><B>               integer order,
</B></PRE><A NAME="935287"><PRE><B>               integer nvars)
</B></PRE><A NAME="933732"><B>
</B><HR><A NAME="933273"><PRE>       integer </a>pfvart
</PRE><A NAME="933975"><PRE>       integer fileid, nvar, order
</PRE><A NAME="933976"><PRE>             .
</PRE><A NAME="933977"><PRE>             .
</PRE><A NAME="933978"><PRE>             .
</PRE><A NAME="933941"><PRE> c     create table of variable names in alphabetic order
</PRE><A NAME="933970"><PRE>       order = 1
</PRE><A NAME="933971"><PRE>       if (</a>pfvart(fileid, order, nvar) .eq. 0)
</PRE><A NAME="933973"><PRE>      $     call errproc
</PRE><A NAME="933979"><PRE>             .
</PRE><A NAME="933980"><PRE>             .
</PRE><A NAME="933981"><PRE>             .
</PRE><a name="932529">
<h2>6.32   PFWIMA</h2>
</a>
<A NAME="934901"><PRE><B>
</B></PRE><A NAME="932778"><PRE><B>integer </a>PFWIMA(integer fileid,
</B></PRE><A NAME="932779"><PRE><B>               integer nchr,
</B></PRE><A NAME="932781"><PRE><B>               character name,
</B></PRE><A NAME="932782"><PRE><B>               integer pkn,
</B></PRE><A NAME="932783"><PRE><B>               integer pkx,
</B></PRE><A NAME="933688"><PRE><B>               integer pln,
</B></PRE><A NAME="933689"><PRE><B>               integer plx,
</B></PRE><A NAME="932789"><PRE><B>               real*8 data,
</B></PRE><A NAME="932800"><PRE><B>               real*8 pxn,
</B></PRE><A NAME="932801"><PRE><B>               real*8 pxx,
</B></PRE><A NAME="932802"><PRE><B>               real*8 pyn,
</B></PRE><A NAME="932803"><PRE><B>               real*8 pyx,
</B></PRE><A NAME="934222"><PRE><B>               integer pim)
</B></PRE><a name="934230">
</a>Build a PD_image structure out of the given input data and write it to a PDB file.<p>
</a>
<a name="934231">
Rationale: The </a>PD_image structure is a useful and general purpose representation of a </a>raster </a>image. The nature of the generalization is that the values in the raster are floating point numbers. So in addition to the standard data sets that can be rasterized, the PD_image can be used to display the computational matrix of some system of equations, for example. This function is a convenient way for FORTRAN programs to put out their data into PDB files as PD_image&#146;s for later visualization and processing by other programs. It allows a rectangular subset of a two dimensional array to be specified for the PD_image.<p>
</a>
<a name="934920">
The calling application must keep track of how many PM_image&#146;s have been written to each file. PDBLib will write each PM_image under the name composed of the string, &#145;Image&#146;, and the integer pim. For example if pim is 9, the PM_image will be written under the name &#145;Image9&#146;. If the application passes the same value for pim more than once only the last one will survive in the symbol table even though the data for each PM_image will persist in the file!<p>
</a>
<a name="934931">
The arguments to </a>PFWIMA are: fileid, an integer identifier which designates the PDB file to which to attempt to write; nchr, an integer number of characters in name; name, an ASCII string containing the name of the image; pkn, the integer minimum column index of the data array; pkx, the integer maximum column index of the data array; pln, the integer minimum row index of the data array; plx, the integer maximum row index of the data array; data, an array of real*8 values containing the image data; pxn, a real*8 value specifying the minimum column index in image; pxx, a real*8 value specifying the maximum column index in image; pyn, a real*8 value specifying the minimum row index in image; pyx, a real*8 value specifying the maximum row index in image; and pim, a counter specifying the number of the image being written out.<p>
</a>
<a name="934935">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="933734">
<p>
</a>
<A NAME="933735"><PRE><B>integer </a>PFWIMA(integer fileid,
</B></PRE><A NAME="933778"><PRE><B>               integer nchr,
</B></PRE><A NAME="933779"><PRE><B>               character name,
</B></PRE><A NAME="933780"><PRE><B>               integer pkn,
</B></PRE><A NAME="933781"><PRE><B>               integer pkx,
</B></PRE><A NAME="933783"><PRE><B>               integer pln,
</B></PRE><A NAME="933784"><PRE><B>               integer plx,
</B></PRE><A NAME="933786"><PRE><B>               real*8 data,
</B></PRE><A NAME="933787"><PRE><B>               real*8 pxn,
</B></PRE><A NAME="933788"><PRE><B>               real*8 pxx,
</B></PRE><A NAME="933789"><PRE><B>               real*8 pyn,
</B></PRE><A NAME="933790"><PRE><B>               real*8 pyx,
</B></PRE><A NAME="934223"><PRE><B>               integer pim)
</B></PRE><A NAME="933737"><B>
</B><HR><A NAME="933986"><PRE>       integer </a>pfwima
</PRE><A NAME="933985"><PRE>       integer fileid, k, l
</PRE><A NAME="933987"><PRE> c     these arguments to pfwima must have 8 byte element size
</PRE><A NAME="934034"><PRE>       double precision xmin, xmax, ymin, ymax, data(0:10,0:10)
</PRE><A NAME="933733"><PRE>             .
</PRE><A NAME="933982"><PRE>             .
</PRE><A NAME="933983"><PRE>             .
</PRE><A NAME="933984"><PRE>       xmin = 0.
</PRE><A NAME="933988"><PRE>       xmax = 10.
</PRE><A NAME="933994"><PRE>       ymin = 0.
</PRE><A NAME="933999"><PRE>       ymax = 10.
</PRE><A NAME="934003"><PRE>       do 100 l = 0, 10
</PRE><A NAME="933990"><PRE>          do 101 k = 0, 10
</PRE><A NAME="933991"><PRE>             data(k, l) = (k - 5)**2 + (l - 5)**2
</PRE><A NAME="933992"><PRE>  101     continue
</PRE><A NAME="933993"><PRE>  100  continue
</PRE><A NAME="933996"><PRE> 
</PRE><A NAME="934004"><PRE>       if (</a>pfwima(fileid, 10, &#146;Test image&#146;, 0, 10, 0, 10,
</PRE><A NAME="933997"><PRE>      $     data, xmin, xmax, ymin, ymax, 1) .eq. 0)
</PRE><A NAME="933998"><PRE>      $     call errproc
</PRE><A NAME="934002"><PRE>             .
</PRE><A NAME="934000"><PRE>             .
</PRE><A NAME="933995"><PRE>             .
</PRE><a name="934941">
<h2>6.33   PFWMAP</h2>
</a>
<A NAME="934945"><PRE><B>
</B></PRE><A NAME="932804"><PRE><B>integer </a>PFWMAP(integer fileid,
</B></PRE><A NAME="932805"><PRE><B>               character dname,
</B></PRE><A NAME="932806"><PRE><B>               integer dp,
</B></PRE><A NAME="932807"><PRE><B>               real*8 dm,
</B></PRE><A NAME="932808"><PRE><B>               character rname,
</B></PRE><A NAME="932810"><PRE><B>               integer rp,
</B></PRE><A NAME="932811"><PRE><B>               real*8 rm,
</B></PRE><A NAME="932812"><PRE><B>               integer pim)
</B></PRE><a name="934949">
</a>Build a PM_mapping structure out of the given input data and write it to a PDB file.<p>
</a>
<a name="934956">
Rationale: The </a>PM_mapping structure is a convenient medium of exchange between data production systems such as simulation codes, storage systems such as PDBLib, and </a>visualization systems such as PDBView. This function is a convenient way for FORTRAN programs to put out their data into PDB files as PM_mapping&#146;s for later visualization and processing by other programs. <p>
</a>
<a name="934963">
The PM_mapping is a structure with two main parts: a </a>domain and a </a>range. These two parts are in turn represented by a structure called a </a>PM_set. Because they are both represented as the same type of data object, they are specified similarly in </a>PFWMAP. For each of the domain and range </a>sets the following information is given: a name; an array of integer quantities specifying such information as the </a>dimensionality of the set, the dimensionality of the elements, the number of elements, and so on; and a linear array containing the elements of the set.<p>
</a>
<a name="934965">
The entries in the arrays dp and rp are as follows:<p>
</a>
<dl>
<a name="934970">
<dt>1		- the number of characters in the corresponding set name
</a>
<a name="934971">
<dt>2		- the dimensionality of the set, nd
</a>
<a name="934972">
<dt>3		- the dimensionality of the set elements, nde
</a>
<a name="934973">
<dt>4		- the number of elements in the set, ne
</a>
<a name="934974">
<dt>5 thru 5+ nd-1		- the sizes in each dimension
</a>
<a name="934978">
The layout of the set elements in dm and rm is:<p>
</a>
<a name="934982">
<dt>1 thru ne					- values of the first component
</a>
<a name="934983">
<dt>ne+1 thru 2*ne					- values of the second component
</a>
<a name="934984">
<dt>...					- values of components
</a>
<a name="934985">
<dt>(nde-1)*ne+1 thru nde*ne					- values of the nde&#146;th component
</a>
<a name="934996">
The calling application must keep track of how many PM_mapping&#146;s have been written to each file. PDBLib will write each PM_mapping under the name composed of the string, &#145;Mapping&#146;, and the integer pim. For example if pim is 9, the PM_mapping will be written under the name &#145;Mapping9&#146;. If the application passes the same value for pim more than once only the last one will survive in the symbol table even though the data for each PM_mapping will persist in the file!<p>
</a>
<a name="935006">
The arguments to </a>PFWMAP are: fileid, an integer identifier which designates the PDB file to which to attempt to write; dname, an ASCII string containing the name of the domain set; dp, an integer array of parameters defining the domain set; dm, an array of real*8 values containing the set elements component by component; rname, an ASCII string containing the name of the range set; rp, an integer array of parameters defining the range set; rm, an array of real*8 values containing the range elements component by component; and pim a counter specifying the number of the mapping being written out.<p>
</a>
<a name="935010">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="933739">
<p>
</a>
<A NAME="933740"><PRE><B>integer </a>PFWMAP(integer fileid,
</B></PRE><A NAME="933792"><PRE><B>               character dname,
</B></PRE><A NAME="933794"><PRE><B>               integer dp,
</B></PRE><A NAME="933795"><PRE><B>               real*8 dm,
</B></PRE><A NAME="933796"><PRE><B>               character rname,
</B></PRE><A NAME="933797"><PRE><B>               integer rp,
</B></PRE><A NAME="933798"><PRE><B>               real*8 rm,
</B></PRE><A NAME="933800"><PRE><B>               integer pim)
</B></PRE><A NAME="933738"><B>
</B><HR><A NAME="933741"><PRE>       integer </a>pfwmap
</PRE><A NAME="934052"><PRE>       integer fileid, dp(5), rp(5)
</PRE><A NAME="934073"><PRE>       double precision dm(0:99), rm(0:99)
</PRE><A NAME="934074"><PRE>             .
</PRE><A NAME="934096"><PRE>             .
</PRE><A NAME="934097"><PRE>             .
</PRE><A NAME="934076"><PRE>       dp(1) = 6
</PRE><A NAME="934077"><PRE>       dp(2) = 1
</PRE><A NAME="934078"><PRE>       dp(3) = 1
</PRE><A NAME="934079"><PRE>       dp(4) = 100
</PRE><A NAME="934080"><PRE>       dp(5) = 100
</PRE><A NAME="934081"><PRE>       rp(1) = 6
</PRE><A NAME="934082"><PRE>       rp(2) = 1
</PRE><A NAME="934083"><PRE>       rp(3) = 1
</PRE><A NAME="934084"><PRE>       rp(4) = 100
</PRE><A NAME="934085"><PRE>       rp(5) = 100
</PRE><A NAME="934086"><PRE> 
</PRE><A NAME="934087"><PRE>       do 100 i = 0, 99
</PRE><A NAME="934088"><PRE>          dm(i) = 6.28*float(i)/99.
</PRE><A NAME="934089"><PRE>          rm(i) = sin(6.28*float(i)/99.)
</PRE><A NAME="934090"><PRE>  100  continue
</PRE><A NAME="934091"><PRE> 
</PRE><A NAME="934092"><PRE>       if (</a>pfwmap(fileid, &#145;Domain&#146;, dp, dm, &#145;Range&#146;, rp, rm, 0)
</PRE><A NAME="934093"><PRE>      $    .eq. 0)
</PRE><A NAME="934094"><PRE>      $     call errproc
</PRE><A NAME="934095"><PRE>             .
</PRE><A NAME="934098"><PRE>             .
</PRE><A NAME="934099"><PRE>             .
</PRE></dl>
<a name="936662">
<h2>6.34   PFWRAD  &#151; (PD_write_as_alt)</h2>
</a>
<A NAME="936669"><PRE><B>
</B></PRE><A NAME="936670"><PRE><B>integer </a>PFWRAD(integer fileid,
</B></PRE><A NAME="936713"><PRE><B>               integer nchr,
</B></PRE><A NAME="936715"><PRE><B>               character name,
</B></PRE><A NAME="936716"><PRE><B>               integer ntypin,
</B></PRE><A NAME="936717"><PRE><B>               character intype,
</B></PRE><A NAME="936718"><PRE><B>               integer ntypout,
</B></PRE><A NAME="936750"><PRE><B>               character outtype,
</B></PRE><A NAME="936751"><PRE><B>               void space,
</B></PRE><A NAME="936752"><PRE><B>               integer nd,
</B></PRE><A NAME="936753"><PRE><B>               integer ind)
</B></PRE><a name="936754">
Write the data of type intype to the PDB file as data of type outtype.<p>
</a>
<a name="936755">
The rationale for this function is: <br>1)  that in some situations, it is desirable to not only convert the formats of data of a specified type, but to convert between types. An example that occurs in practice often enough is converting a 32 bit int to a 32 bit long on a machine which only has a 16 bit int.<br>2) that in some situations, it is desirable to be able to specify the dimensions without building them into an ASCII string.<p>
</a>
<a name="936756">
The arguments to </a>PFWRAD are: fileid, an integer identifier which designates the PDB file to which to write; nchr, an integer number of characters in the name string; name, an ASCII string containing the name of the variable to install in the symbol table; ntypin, an integer number of characters in the intype string; intype, an ASCII string specifying the variable type in space; ntypout, an integer number of characters in the outtype string; outtype, an ASCII string specifying the variable type in the PDB file; space, the data to be written; nd, an integer number of dimensions; and ind, an array of nd integer triples containing the minimum and maximum index and the stride for each dimension.<p>
</a>
<a name="936757">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="936758">
See also PFAPAS, PFAPAD, PFAPPA, PFAPPD, PFWRAS, PFWRTA, and PFWRTD.<p>
</a>
<a name="936759">
<p>
</a>
<a name="936760">
<p>
</a>
<A NAME="936761"><PRE><B>integer </a>PFWRAD(integer fileid,
</B></PRE><A NAME="936762"><PRE><B>               integer nchr,
</B></PRE><A NAME="936763"><PRE><B>               character name,
</B></PRE><A NAME="936764"><PRE><B>               integer ntypin,
</B></PRE><A NAME="936765"><PRE><B>               character intype,
</B></PRE><A NAME="936766"><PRE><B>               integer ntypout,
</B></PRE><A NAME="936767"><PRE><B>               character outtype,
</B></PRE><A NAME="936768"><PRE><B>               void space,
</B></PRE><A NAME="936769"><PRE><B>               integer nd,
</B></PRE><A NAME="936770"><PRE><B>               integer ind)
</B></PRE><A NAME="936771"><B>
</B><HR><A NAME="936772"><PRE>       integer </a>pfwrad
</PRE><A NAME="936773"><PRE>       integer fileid, nd, ind(6)
</PRE><A NAME="936774"><PRE>       real*8 c(2,2:4)
</PRE><A NAME="936775"><PRE>             .
</PRE><A NAME="936776"><PRE>             .
</PRE><A NAME="936777"><PRE>             .
</PRE><A NAME="936778"><PRE> c     write array c of type double as type float
</PRE><A NAME="936779"><PRE>       nd = 2
</PRE><A NAME="936780"><PRE>       ind(1) = 1
</PRE><A NAME="936781"><PRE>       ind(2) = 2
</PRE><A NAME="936782"><PRE>       ind(3) = 1
</PRE><A NAME="936783"><PRE>       ind(4) = 2
</PRE><A NAME="936784"><PRE>       ind(5) = 4
</PRE><A NAME="936785"><PRE>       ind(6) = 1
</PRE><A NAME="936786"><PRE>       if (</a>pfwrad(fileid, 1, &#145;c&#146;, 6, &#145;double&#146;,
</PRE><A NAME="936792"><PRE>      $                           5, &#145;float&#146;, c, nd, ind) .eq. 0)
</PRE><A NAME="936788"><PRE>      $     call errproc
</PRE><A NAME="936789"><PRE>             .
</PRE><A NAME="936790"><PRE>             .
</PRE><A NAME="936791"><PRE>             .
</PRE><a name="935015">
<h2>6.35   PFWRAN</h2>
</a>
<A NAME="935019"><PRE><B>
</B></PRE><A NAME="932813"><PRE><B>integer </a>PFWRAN(integer fileid,
</B></PRE><A NAME="932814"><PRE><B>               character dname,
</B></PRE><A NAME="932817"><PRE><B>               integer nchr,
</B></PRE><A NAME="932816"><PRE><B>               character rname,
</B></PRE><A NAME="932818"><PRE><B>               integer rp,
</B></PRE><A NAME="932819"><PRE><B>               real*8 rm,
</B></PRE><A NAME="932820"><PRE><B>               integer pim)
</B></PRE><a name="935023">
</a>Build a PM_mapping structure out of the given input data and write it to a PDB file.<p>
</a>
<a name="935030">
Rationale: The </a>PM_mapping structure is a convenient medium of exchange between data production systems such as simulation codes, storage systems such as PDBLib, and visualization systems such as PDBView. This function is a convenient way for FORTRAN programs to put out their data into PDB files as PM_mapping&#146;s for later </a>visualization and processing by other programs.<p>
</a>
<a name="935038">
The PM_mapping is a structure with two main parts: a </a>domain and a </a>range. These two parts are in turn represented by a structure called a </a>PM_set. In many cases a number of PM_mapping&#146;s share a common domain set. It is therefore more efficient to write the unique domain </a>sets out separately and use </a>PFWRAN to write out the PM_mapping&#146;s without their domains. Post processor codes such as PDBView (by definition) know how to put the full PM_mapping back together. Note: the domain name given for </a>PFWRAN must be the same as the domain name passed to the corresponding </a>PFWSET call.<p>
</a>
<a name="935043">
For each range set the following information is given: a name; an array of integer quantities specifying such information as the </a>dimensionality of the set, the dimensionality of the elements, the number of elements, and so on; and a linear array containing the elements of the set.<p>
</a>
<a name="935045">
The entries in the array rp are as follows:<p>
</a>
<dl>
<a name="935050">
<dt>1		- the number of characters in the corresponding set name
</a>
<a name="935051">
<dt>2		- the dimensionality of the set, nd
</a>
<a name="935052">
<dt>3		- the dimensionality of the set elements, nde
</a>
<a name="935053">
<dt>4		- the number of elements in the set, ne
</a>
<a name="935054">
<dt>5 thru 5+ nd-1		- the sizes in each dimension
</a>
<a name="935058">
The layout of the set elements in rm is:<p>
</a>
<a name="935062">
<dt>1 thru ne					 - values of the first component
</a>
<a name="935063">
<dt>ne+1 thru 2*ne					- values of the second component
</a>
<a name="935064">
<dt>...					- values of components
</a>
<a name="935065">
<dt>(nde-1)*ne+1 thru nde*ne					- values of the nde&#146;th component
</a>
<a name="935076">
The calling application must keep track of how many PM_mapping&#146;s have been written to each file. PDBLib will write each PM_mapping under the name composed of the string, &#145;Mapping&#146;, and the integer pim. For example if pim is 9, the PM_mapping will be written under the name &#145;Mapping9&#146;. If the application passes the same value for pim more than once only the last one will survive in the symbol table even though the data for each PM_mapping will persist in the file.<p>
</a>
<a name="935085">
The arguments to PFWRAN are: fileid, an integer identifier which designates the PDB file to which to attempt to write; dname, an ASCII string containing the name of the domain set; nchr, an integer number of characters in dname; rname, an ASCII string containing the name of the range set; rp, an integer array of parameters defining the range set; rm, an array of real*8 values containing the range elements component by component; and pim a counter specifying the number of the mapping being written out.<p>
</a>
<a name="935089">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="933743">
<p>
</a>
<A NAME="933744"><PRE><B>integer </a>PFWRAN(integer fileid,
</B></PRE><A NAME="933801"><PRE><B>               character dname,
</B></PRE><A NAME="933802"><PRE><B>               integer nchr,
</B></PRE><A NAME="933803"><PRE><B>               character rname,
</B></PRE><A NAME="933804"><PRE><B>               integer rp,
</B></PRE><A NAME="933806"><PRE><B>               real*8 rm,
</B></PRE><A NAME="933807"><PRE><B>               integer pim)
</B></PRE><A NAME="933745"><B>
</B><HR><A NAME="933742"><PRE>       integer </a>pfwran
</PRE><A NAME="934075"><PRE>       integer fileid, i, pim, rp(5)
</PRE><A NAME="934100"><PRE>       double precision rm(0:99)
</PRE><A NAME="934102"><PRE>             .
</PRE><A NAME="934103"><PRE>             .
</PRE><A NAME="934104"><PRE>             .
</PRE><A NAME="934105"><PRE>       pim = 0
</PRE><A NAME="934121"><PRE>       rp(1) = 6
</PRE><A NAME="934108"><PRE>       rp(2) = 1
</PRE><A NAME="934109"><PRE>       rp(3) = 1
</PRE><A NAME="934110"><PRE>       rp(4) = 100
</PRE><A NAME="934111"><PRE>       rp(5) = 100
</PRE><A NAME="934112"><PRE> 
</PRE><A NAME="934113"><PRE>       do 100 i = 0, 99
</PRE><A NAME="934115"><PRE>          rm(i) = sin(6.28*float(i)/99.)
</PRE><A NAME="934116"><PRE>  100  continue
</PRE><A NAME="934117"><PRE> 
</PRE><A NAME="934120"><PRE> c     &#145;Domain&#146; written previously by pfwset
</PRE><A NAME="934122"><PRE>       if (</a>pfwran(fileid, &#145;Domain&#146;, 6, &#145;Range&#146;, rp, rm, pim)
</PRE><A NAME="934114"><PRE>      $    .eq. 0)
</PRE><A NAME="934118"><PRE>      $     call errproc
</PRE><A NAME="934119"><PRE>             .
</PRE><A NAME="934106"><PRE>             .
</PRE><A NAME="934107"><PRE>             .
</PRE></dl>
<a name="936705">
<h2>6.36   PFWRAS  &#151; (PD_write_as)</h2>
</a>
<A NAME="936706"><PRE><B>
</B></PRE><A NAME="936707"><PRE><B>integer </a>PFWRAS(integer fileid,
</B></PRE><A NAME="936708"><PRE><B>               integer nchr,
</B></PRE><A NAME="936709"><PRE><B>               character name,
</B></PRE><A NAME="936653"><PRE><B>               integer ntypin,
</B></PRE><A NAME="936710"><PRE><B>               character intype,
</B></PRE><A NAME="936654"><PRE><B>               integer ntypout,
</B></PRE><A NAME="936711"><PRE><B>               character outtype,
</B></PRE><A NAME="936712"><PRE><B>               void space)
</B></PRE><a name="936714">
Write the data of type intype to the PDB file as data of type outtype.<p>
</a>
<a name="936656">
The rationale for this function is that in some situations, it is desirable to not only convert the formats of data of a specified type, but to convert between types. An example that occurs in practice often enough is converting a 32 bit int to a 32 bit long on a machine which only has a 16 bit int.<p>
</a>
<a name="936663">
The arguments to PFWRAS are: fileid, an integer identifier which designates the PDB file to which to write; nchr, an integer number of characters in the name string; name, an ASCII string containing the name of the variable to install in the symbol table; ntypin, an integer number of characters in the intype string; intype, an ASCII string specifying the variable type in space; ntypout, an integer number of characters in the outtype string; outtype, an ASCII string specifying the variable type in the PDB file; and space, the data to be written.<p>
</a>
<a name="936719">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR<p>
</a>
<a name="936821">
See also PFAPAS, PFAPAD, PFAPPA, PFAPPD, PFWRAD, PFWRTA, and PFWRTD.<p>
</a>
<a name="936720">
<p>
</a>
<A NAME="936721"><PRE><B>integer </a>PFWRAS(integer fileid,
</B></PRE><A NAME="936722"><PRE><B>               integer nchr,
</B></PRE><A NAME="936723"><PRE><B>               character name,
</B></PRE><A NAME="936724"><PRE><B>               integer ntypin,
</B></PRE><A NAME="936725"><PRE><B>               character intype,
</B></PRE><A NAME="936667"><PRE><B>               integer ntypout,
</B></PRE><A NAME="936668"><PRE><B>               character outtype,
</B></PRE><A NAME="936726"><PRE><B>               void space)
</B></PRE><A NAME="936727"><B>
</B><HR><A NAME="936728"><PRE>       integer </a>pfwras
</PRE><A NAME="936729"><PRE>       integer fileid
</PRE><A NAME="936730"><PRE>       real*8 x(20)
</PRE><A NAME="936731"><PRE>                     .
</PRE><A NAME="936734"><PRE>             .
</PRE><A NAME="936735"><PRE>             .
</PRE><A NAME="936736"><PRE> c     write array x of type double as type float
</PRE><A NAME="936737"><PRE>       if (</a>pfwras(fileid, 5, &#145;x(20)&#146;, 6, &#145;double&#146;, 
</PRE><A NAME="936666"><PRE>      $                               5, &#145;float&#146;, x) .eq. 0)
</PRE><A NAME="936738"><PRE>      $     call errproc
</PRE><A NAME="936743"><PRE>             .
</PRE><A NAME="936744"><PRE>             .
</PRE><A NAME="936745"><PRE>             .
</PRE><a name="935094">
<h2>6.37   PFWRTA  &#151; (PD_write)</h2>
</a>
<A NAME="935098"><PRE><B>
</B></PRE><A NAME="932822"><PRE><B>integer </a>PFWRTA(integer fileid,
</B></PRE><A NAME="932823"><PRE><B>               integer nchr,
</B></PRE><A NAME="932828"><PRE><B>               character name,
</B></PRE><A NAME="932826"><PRE><B>               integer ntype,
</B></PRE><A NAME="932829"><PRE><B>               character type,
</B></PRE><A NAME="932827"><PRE><B>               void space)
</B></PRE><a name="935109">
</a>Write data to a PDB file. Before writing data to the PDB file an entry is prepared for the symbol table consisting of the name, the type, the </a>dimension information, the disk address to which the data will be written, and the total number of bytes as computed with the help of the structure chart. After the entry is installed in the symbol table the data from memory is converted (only if the </a>target machine type is different from the current machine type) and then written out to disk starting at the current disk address. <p>
</a>
<a name="935115">
The </a>primitive </a>data types which the PDBLib system knows about by default are: &#145;short&#146;, &#145;integer&#146;, &#145;long&#146;, &#145;float&#146;, &#145;double&#146;, and &#145;char&#146; for short integer, integer, long integer, floating point or real*8 number, double precision floating point number, and character or single byte respectively.<p>
</a>
<a name="935121">
Rationale: When writing out scalar variables (i.e. non-dimensioned variables - structured variables are scalars unless specifically dimensioned) or arrays with fixed dimensions this function is the most convenient to use. Dimension information can be encoded in the name of the entry. PDBLib will strip that information off the name before creating the symbol table entry.<p>
</a>
<a name="935126">
Dimensions can be given in two ways. If the default offset value for the PDB file can be taken as the minimum value for the range which a dimension index can legally run, the maximum value may be specified alone. Alternatively, the minimum value, maximum value, and stride (separated by colons) may be specified. The stride is optional and defaults to 1. For example:<p>
</a>
<a name="933627">
<dd>    pfwrta(pid, 10, &#145;u(30,1:10)&#146;, 5, &#145;float&#146;, u)<P>
</a>
<a name="934323">
The arguments to PFWRTA are: fileid, an integer identifier which designates the PDB file to which to write; nchr, an integer number of characters in the name string; name, an ASCII string containing the name of the variable to install in the symbol table; ntype, an integer number of characters in the type string; type, an ASCII string specifying the variable type; and space, the data to be written.<p>
</a>
<a name="934324">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="936820">
See also PFAPAS, PFAPAD, PFAPPA, PFAPPD, PFWRAD, PFWRAS, and PFWRTD.<p>
</a>
<a name="933748">
<p>
</a>
<A NAME="933749"><PRE><B>integer </a>PFWRTA(integer fileid,
</B></PRE><A NAME="933824"><PRE><B>               integer nchr,
</B></PRE><A NAME="933825"><PRE><B>               character name,
</B></PRE><A NAME="933826"><PRE><B>               integer ntype,
</B></PRE><A NAME="933827"><PRE><B>               character type,
</B></PRE><A NAME="933828"><PRE><B>               void space)
</B></PRE><A NAME="933750"><B>
</B><HR><A NAME="933747"><PRE>       integer </a>pfwrta
</PRE><A NAME="933625"><PRE>       integer fileid
</PRE><A NAME="934018"><PRE>       real x(20)
</PRE><A NAME="934019"><PRE>       common /abc/ a(2), b, c(2,2:4)
</PRE><A NAME="934020"><PRE>       real a, b, c
</PRE><A NAME="934024"><PRE>             .
</PRE><A NAME="934025"><PRE>             .
</PRE><A NAME="934026"><PRE>             .
</PRE><A NAME="934023"><PRE> c     write array x
</PRE><A NAME="934043"><PRE>       if (</a>pfwrta(fileid, 5, &#145;x(20)&#146;, 5, &#145;float&#146;, x) .eq. 0)
</PRE><A NAME="934031"><PRE>      $     call errproc
</PRE><A NAME="934032"><PRE> 
</PRE><A NAME="934059"><PRE> c     write entire structure abc (previous defined with pfdefs)
</PRE><A NAME="934035"><PRE>       if (</a>pfwrta(fileid, 3, &#145;abc&#146;, 3, &#145;abc&#146;, a) .eq. 0)
</PRE><A NAME="934036"><PRE>      $     call errproc
</PRE><A NAME="934001"><PRE>             .
</PRE><A NAME="934041"><PRE>             .
</PRE><A NAME="934042"><PRE>             .
</PRE><a name="935156">
<h2>6.38   PFWRTD  &#151; (PD_write_alternate)</h2>
</a>
<A NAME="935163"><PRE><B>
</B></PRE><A NAME="932830"><PRE><B>integer </a>PFWRTD(integer fileid,
</B></PRE><A NAME="932832"><PRE><B>               integer nchr,
</B></PRE><A NAME="932837"><PRE><B>               character name,
</B></PRE><A NAME="932833"><PRE><B>               integer ntype,
</B></PRE><A NAME="932836"><PRE><B>               character type,
</B></PRE><A NAME="932834"><PRE><B>               void space,
</B></PRE><A NAME="932838"><PRE><B>               integer nd,
</B></PRE><A NAME="932840"><PRE><B>               integer ind)
</B></PRE><a name="935174">
</a>Write data to a PDB file. Before writing data to the PDB file an entry is prepared for the symbol table consisting of the name, the type, the </a>dimension information, the disk address to which the data will be written, and the total number of bytes as computed with the help of the structure chart. After the entry is installed in the symbol table the data from memory is converted (only if the </a>target machine type is different from the current machine type) and then written out to disk starting at the current disk address.<p>
</a>
<a name="934050">
The </a>primitive </a>data types which the PDBLib system knows about by default are: &#145;short&#146;, &#145;integer&#146;, &#145;long&#146;, &#145;float&#146;, &#145;double&#146;, and &#145;char&#146; for short integer, integer, long integer, floating point or real number, double precision floating point number, and character or single byte respectively.<p>
</a>
<a name="934051">
The rationale for this function is that in some situations, it is desirable to be able to specify the dimensions without building them into an ASCII string.<p>
</a>
<a name="934072">
The arguments to </a>PFWRTD are: fileid, an integer identifier which designates the PDB file to which to write; nchr, an integer number of characters in the name string; name, an ASCII string containing the name of the variable to install in the symbol table; ntype, an integer number of characters in the type string; type, an ASCII string specifying the variable type; space, the data to be written; nd, an integer number of dimensions; and ind, an array of nd integer triples containing the minimum and maximum index and the stride for each dimension.<p>
</a>
<a name="936822">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="936823">
See also PFAPAS, PFAPAD, PFAPPA, PFAPPD, PFWRAD, PFWRAS, and PFWRTA.<p>
</a>
<a name="935206">
<p>
</a>
<a name="933752">
<p>
</a>
<A NAME="933753"><PRE><B>integer </a>PFWRTD(integer fileid,
</B></PRE><A NAME="933829"><PRE><B>               integer nchr,
</B></PRE><A NAME="933830"><PRE><B>               character name,
</B></PRE><A NAME="933832"><PRE><B>               integer ntype,
</B></PRE><A NAME="933833"><PRE><B>               character type,
</B></PRE><A NAME="933835"><PRE><B>               void space,
</B></PRE><A NAME="933836"><PRE><B>               integer nd,
</B></PRE><A NAME="933837"><PRE><B>               integer ind)
</B></PRE><A NAME="933754"><B>
</B><HR><A NAME="934053"><PRE>       integer </a>pfwrtd
</PRE><A NAME="933626"><PRE>       integer fileid, nd, ind(6)
</PRE><A NAME="934046"><PRE>       real c(2,2:4)
</PRE><A NAME="934022"><PRE>             .
</PRE><A NAME="934033"><PRE>             .
</PRE><A NAME="934037"><PRE>             .
</PRE><A NAME="934060"><PRE> c     write array c
</PRE><A NAME="933751"><PRE>       nd = 2
</PRE><A NAME="934038"><PRE>       ind(1) = 1
</PRE><A NAME="934039"><PRE>       ind(2) = 2
</PRE><A NAME="933622"><PRE>       ind(3) = 1
</PRE><A NAME="934047"><PRE>       ind(4) = 2
</PRE><A NAME="934049"><PRE>       ind(5) = 4
</PRE><A NAME="934325"><PRE>       ind(6) = 1
</PRE><A NAME="934055"><PRE>       if (</a>pfwrtd(fileid, 1, &#145;c&#146;, 5, &#145;float&#146;, c, nd, ind) .eq. 0)
</PRE><A NAME="934054"><PRE>      $     call errproc
</PRE><A NAME="934048"><PRE>             .
</PRE><A NAME="934045"><PRE>             .
</PRE><A NAME="934044"><PRE>             .
</PRE><a name="932841">
<h2>6.39   PFWSET)</h2>
</a>
<A NAME="932842"><PRE><B>
</B></PRE><A NAME="932844"><PRE><B>integer </a>PFWSET(integer fileid,
</B></PRE><A NAME="932845"><PRE><B>               character dname,
</B></PRE><A NAME="933623"><PRE><B>               integer dp,
</B></PRE><A NAME="933649"><PRE><B>               real*8 dm)
</B></PRE><a name="933653">
</a>Build a PM_set structure out of the given input data and write it to a PDB file.<p>
</a>
<a name="933665">
Rationale: The </a>PM_set structure is a fundamental component of the </a>PM_mapping structure which is a convenient medium of exchange between data production systems such as simulation codes, storage systems such as PDBLib, and </a>visualization systems such as PDBView. Although the function </a>PFWMAP most conveniently writes a mapping out to a PDB file, it does not make the best use of limited storage space. In many cases a number of PM_mapping&#146;s share a common </a>domain set. It is therefore more efficient to write the unique domain </a>sets out separately and use </a>PFWRAN to write out the PM_mapping&#146;s without their domains. Post processor codes such as PDBView (by definition) know how to put the full PM_mapping back together. Note: the domain name given for </a>PFWSET must be the same as the domain name passed to the corresponding </a>PFWRAN call!<p>
</a>
<a name="933666">
For each PM_set the following information is given: a name; an array of integer quantities specifying such information as the dimensionality of the set, the dimensionality of the elements, the number of elements, etc.; and a linear array containing the elements of the set.<p>
</a>
<a name="933667">
The entries in the array dp are as follows:<p>
</a>
<dl>
<a name="933668">
<dt>1		- the number of characters in the corresponding set name
</a>
<a name="933669">
<dt>2		- the dimensionality of the set, nd
</a>
<a name="933670">
<dt>3		- the dimensionality of the set elements, nde
</a>
<a name="933671">
<dt>4		- the number of elements in the set, ne
</a>
<a name="933673">
<dt>5 thru 5+nd-1		- the sizes in each dimension
</a>
<a name="933674">
The layout of the set elements in dm is:<p>
</a>
<a name="933675">
<dt>1 thru ne					- values of the first component
</a>
<a name="933676">
<dt>ne+1 thru 2*ne					- values of the second component
</a>
<a name="933678">
<dt>...					- values of components
</a>
<a name="933679">
<dt>(nde-1)*ne+1 thru nde*ne					- values of the nde&#146;th component
</a>
<a name="933680">
The arguments to </a>PFWSET are: fileid, an integer identifier which designates the PDB file to which to write; dname, an ASCII string containing the name of the PM_set; dp, an integer array of parameters defining the PM_set; and dm, an array of real*8 values containing the set elements component by component.<p>
</a>
<a name="933681">
The return value is 1, if successful; otherwise, 0 is returned and an error message may be retrieved by invoking function PFGERR.<p>
</a>
<a name="933756">
<p>
</a>
<A NAME="933757"><PRE><B>integer </a>PFWSET(integer fileid,
</B></PRE><A NAME="933838"><PRE><B>               character dname,
</B></PRE><A NAME="933839"><PRE><B>               integer dp,
</B></PRE><A NAME="933840"><PRE><B>               real*8 dm)
</B></PRE><A NAME="933759"><B>
</B><HR><A NAME="933755"><PRE>       integer </a>pfwset
</PRE><A NAME="934123"><PRE>       integer fileid, i, dp(5)
</PRE><A NAME="934124"><PRE>       double precision dm(0:99)
</PRE><A NAME="934126"><PRE>             .
</PRE><A NAME="934127"><PRE>             .
</PRE><A NAME="934128"><PRE>             .
</PRE><A NAME="934132"><PRE>       dp(1) = 6
</PRE><A NAME="934133"><PRE>       dp(2) = 1
</PRE><A NAME="934134"><PRE>       dp(3) = 1
</PRE><A NAME="934135"><PRE>       dp(4) = 100
</PRE><A NAME="934136"><PRE>       dp(5) = 100
</PRE><A NAME="934137"><PRE> 
</PRE><A NAME="934143"><PRE>       do 100 i = 0, 99
</PRE><A NAME="934129"><PRE>          dm(i) = 6.28*float(i)/99.
</PRE><A NAME="934139"><PRE>  100  continue
</PRE><A NAME="934140"><PRE> 
</PRE><A NAME="934142"><PRE>       if (</a>pfwset(fileid, &#145;Domain&#146;, dp, dm) .eq. 0)
</PRE><A NAME="934138"><PRE>      $     call errproc
</PRE><A NAME="934141"><PRE>             .
</PRE><A NAME="934130"><PRE>             .
</PRE><A NAME="934131"><PRE>             .
</PRE></dl>
<a name="935279">
<h1>7.0   </a>PDBLib </a>Design Philosophy</h1>
</a>
<a name="935281">
<h2>7.1   Overview</h2>
</a>
<a name="935286">
Perhaps the most fundamental element in the design of PDBLib is the concept of </a>modularity through </a>abstraction barriers. In essence, the functionality is broken down into modular units and abstraction barriers are used to preserve the integrity of the units.<p>
</a>
<a name="935295">
An abstraction barrier is simply a technique or device which allows a section of code to be written assuming other functions or routines are defined and that their internal workings are irrelevant to their use. In this way a routine or module can be changed without any other part of the code which uses it being affected (so long as the definition of its function does not change). Abstraction barriers are most effectively created by a careful choice of the basic functional units and by the interfaces between them.<p>
</a>
<a name="935303">
For example, if all variables in the code were global there would be little or no chance of having any abstraction barriers at all. Similarly, monolithic functions which are defined to &#145;solve the worlds problems&#146; do not lend themselves to the more easy maintenance that abstraction barriers afford a program. For a good discussion of the principles and applications of these ideas see Abelson and Sussman&#146;s marvelous book, The Structure and Interpretation of Computer Programs.<p>
</a>
<a name="935310">
The main </a>functional units in the PDBLib system are: the </a>hash package which controls the maintenance of the data in both the symbol table and structure chart; the </a>conversion package which handles all data format conversions; the </a>data reading routine which is defined to bring data in from the disk, perform any necessary conversion, and store it in the specified location(s) of memory; and the </a>data writing routine which does the reverse of the reading routine.<p>
</a>
<a name="935314">
These units are put together in such a way that they are used over and over again in the process of doing any of the high level functions. In this way the code size was kept relatively small. Again this is one of the rewards of modularity.<p>
</a>
<a name="935316">
<h2>7.2   </a>Data Conversion and </a>Compression</h2>
</a>
<a name="935339">
PDBLib has a quasi-universal </a>data </a>translation capability. It is called </a>Parametrized </a>Data </a>Conversion (</a>PDC). A set of parameters which characterizes a large set of integer and floating point formats was developed. It describes the byte size and order of integer types.	For floating point data it describes the bit location and width of the sign, exponent, and mantissa field as well as the byte size and order of the data. Using this information a single integer conversion routine and a single floating point conversion routine handle all of the data conversions in PDBLib. The advantage of this approach is that there is no increase in the size of the library for each port to a new environment. Furthermore, it will allow future releases to auto-configure themselves to the machines on which they run. Another benefit is that a data representation may be targeted without regard to its implementation. This provides a vehicle for developing data representations, evaluating them, or using them in a highly abstract manner. The sole drawback of this approach is that it makes assumptions about the representation of data in computers. While the assumptions are general and the result of incorporating data representations outside these assumptions is more work on the library itself, it is philosophically unsatisfying to make any assumptions about how things are to be done or data to be represented. The other drawback is that by being general purpose the conversion routines are slightly slower than specific ones. This is more than made up for in the saving in library size and ease of porting the library.<p>
</a>
<a name="935345">
Alternative data conversion strategies are either hub and spoke (such as Sun&#146;s </a>XDR) or specific format to format. The latter suffers from an N2 growth in the number of conversion routines where N is the number of machine/architectures which the library supports. On the other hand, hub and spoke strategies necessitate a conversion on each read or write operation.<p>
</a>
<a name="935352">
PDC prevents the conversion problem from being N2. At worst, the PDC method should grow like N in the number of parameter sets required. In practice, it is even better than that. Most computer systems today are based on a handful of CPU&#146;s which are the most constraining factor in binary data formats. For the convenience of the users of PDBLib, several </a>data_standard&#146;s and </a>data_alignment&#146;s are predefined by the library itself.<p>
</a>
<a name="932584">
A significant advantage to PDC is that a class of data compression algorithms is implicit in the method. By simply describing a format which describes data in the correct range (up to a possible overall offset for each type), PDBLib can do all of the work to store and retrieve the data in a compressed form.<p>
</a>
<a name="935358">
<h3>7.2.1   DATA_STANDARD&#146;S</h3>
</a>
<a name="935363">
See the section on the </a>data_standard structure for a detailed discussion of its members. The following is a list of the data_standard&#146;s which PDBLib provides by default. The purpose is twofold: to help users identify target formats; and to guide users who wish to create their own data_standard&#146;s.<p>
</a>
<a name="932530">
The members of the data_standard are indicated in the template:<p>
</a>
<dl>
<a name="932538">
<dt> STAND
</a>
<a name="932548">
<dd>{size of pointer,<P>
</a>
<a name="932539">
<dd> 	size and order of short,<P>
</a>
<a name="932540">
<dd> 	size and order of int,<P>
</a>
<a name="932541">
<dd> 	size and order of long,<P>
</a>
<a name="932542">
<dd> 	size, format, and order of float,<P>
</a>
<a name="932543">
<dd> 	size, format, and order of double}<P>
</a>
<a name="932544">
The various variables indicated are defined by PDBLib.<p>
</a>
<a name="932547">
<p>
</a>
<a name="932532">
<dt></a>DEF_STD
</a>
<a name="932550">
<dd>{4,<P>
</a>
<a name="935364">
<dd> 	2, NORMAL_ORDER,<P>
</a>
<a name="935365">
<dd> 	4, NORMAL_ORDER,<P>
</a>
<a name="935366">
<dd> 	4, NORMAL_ORDER,<P>
</a>
<a name="935367">
<dd> 	4, def_float, def_float_order,<P>
</a>
<a name="935368">
<dd> 	8, def_double, def_double_order}<P>
</a>
<a name="932455">
<p>
</a>
<a name="932531">
<dt> </a>IEEEA_STD
</a>
<a name="932551">
<dd>{4,<P>
</a>
<a name="935370">
<dd> 2, NORMAL_ORDER,<P>
</a>
<a name="935371">
<dd> 4, NORMAL_ORDER,<P>
</a>
<a name="935372">
<dd> 4, NORMAL_ORDER,<P>
</a>
<a name="935373">
<dd> 4, ieee_float, ieee_float_order,<P>
</a>
<a name="935374">
<dd> 8, ieeea_double, ieeea_double_order}<P>
</a>
<a name="932533">
<p>
</a>
<a name="932545">
<dt> </a>IEEEB_STD
</a>
<a name="932559">
<dd>{4,<P>
</a>
<a name="935376">
<dd> 2, NORMAL_ORDER,<P>
</a>
<a name="935377">
<dd> 2, NORMAL_ORDER,<P>
</a>
<a name="935378">
<dd> 4, NORMAL_ORDER,<P>
</a>
<a name="935379">
<dd> 4, ieee_float, ieee_float_order,<P>
</a>
<a name="935380">
<dd> 12, ieeeb_double, ieeeb_double_order}<P>
</a>
<a name="935381">
<p>
</a>
<a name="932534">
<dt> </a>IEEEC_STD
</a>
<a name="932560">
<dd>{4,<P>
</a>
<a name="935382">
<dd> 2, NORMAL_ORDER,<P>
</a>
<a name="935383">
<dd> 4, NORMAL_ORDER,<P>
</a>
<a name="935384">
<dd> 4, NORMAL_ORDER,<P>
</a>
<a name="935385">
<dd> 4, ieee_float, ieee_float_order,<P>
</a>
<a name="935386">
<dd> 12, ieeeb_double, ieeeb_double_order}<P>
</a>
<a name="935387">
<p>
</a>
<a name="932535">
<dt> </a>INTELA_STD
</a>
<a name="932561">
<dd>{4,<P>
</a>
<a name="935388">
<dd> 2, REVERSE_ORDER,<P>
</a>
<a name="935389">
<dd> 2, REVERSE_ORDER,<P>
</a>
<a name="935390">
<dd> 4, REVERSE_ORDER,<P>
</a>
<a name="935391">
<dd> 4, intel_float, intel_float_order,<P>
</a>
<a name="935393">
<dd> 8, intel_double, intel_double_order}<P>
</a>
<a name="932557">
<p>
</a>
<a name="932537">
<dt> </a>INTELB_STD
</a>
<a name="932553">
<dd>{4,<P>
</a>
<a name="935394">
<dd> 2, REVERSE_ORDER,<P>
</a>
<a name="935395">
<dd> 4, REVERSE_ORDER,<P>
</a>
<a name="935396">
<dd> 4, REVERSE_ORDER,<P>
</a>
<a name="935397">
<dd> 4, intel_float, intel_float_order,<P>
</a>
<a name="935398">
<dd> 8, intel_double, intel_double_order},<P>
</a>
<a name="935399">
<p>
</a>
<a name="932556">
<dt> </a>VAX_STD
</a>
<a name="932552">
<dd>{4,<P>
</a>
<a name="935400">
<dd> 2, REVERSE_ORDER,<P>
</a>
<a name="935401">
<dd> 4, REVERSE_ORDER,<P>
</a>
<a name="935402">
<dd> 4, REVERSE_ORDER,<P>
</a>
<a name="935403">
<dd> 4, vax_float, vax_float_order,<P>
</a>
<a name="935404">
<dd> 8, vax_double, vax_double_order}<P>
</a>
<a name="935405">
<p>
</a>
<a name="932555">
<dt> </a>CRAY_STD
</a>
<a name="932554">
<dd>{8,<P>
</a>
<a name="935406">
<dd> 8, NORMAL_ORDER,<P>
</a>
<a name="935407">
<dd> 8, NORMAL_ORDER,<P>
</a>
<a name="935408">
<dd> 8, NORMAL_ORDER,<P>
</a>
<a name="935409">
<dd> 8, cray_float, cray_float_order,<P>
</a>
<a name="935410">
<dd> 8, cray_float, cray_float_order}<P>
</a>
</dl>
<a name="935417">
<h4>7.2.1.1   </a>Floating Point Format Descriptor</h4>
</a>
<a name="935418">
 The description of a floating point number consists of an array of 8 long integer parameters. The parameters are:<p>
</a>
<a name="935419">
<dd>format[0] = # of bits per number<P>
</a>
<a name="935420">
<dd>format[1] = # of bits in exponent<P>
</a>
<a name="935421">
<dd>format[2] = # of bits in mantissa<P>
</a>
<a name="935422">
<dd>format[3] = start bit of sign<P>
</a>
<a name="935423">
<dd>format[4] = start bit of exponent<P>
</a>
<a name="935424">
<dd>format[5] = start bit of mantissa<P>
</a>
<a name="935425">
<dd>format[6] = high order mantissa bit<P>
</a>
<a name="935426">
<dd>format[7] = bias of exponent<P>
</a>
<a name="935429">
The following floating point format descriptors are defined in PDBLib and used in the </a>data_standard&#146;s described in the last section:<p>
</a>
<a name="935441">
<dd> </a>ieee_float			= {32L, 8L, 23L, 0L, 1L, 9L, 0L, 0x7FL}<P>
</a>
<a name="935442">
<dd> </a>ieeea_double			= {64L, 11L, 52L, 0L, 1L, 12L, 0L, 0x3FFL}<P>
</a>
<a name="935443">
<dd> </a>ieeeb_double			= {96L, 15L, 64L, 0L, 1L, 32L, 1L, 0x3FFEL}<P>
</a>
<a name="935444">
<dd> </a>intel_float			= {32L, 8L, 23L, 0L, 1L, 9L, 0L, 0x7FL}<P>
</a>
<a name="935445">
<dd> </a>intel_double			= {64L, 11L, 52L, 0L, 1L, 12L, 0L, 0x3FFL}<P>
</a>
<a name="935455">
<dd> </a>cray_float			= {64L, 15L, 48L, 0L, 1L, 16L, 1L, 0x4000L}<P>
</a>
<a name="932572">
Note: There are several variants of floating type format on the VAX. Accordingly the user must decide which one to use and PDBLib has the descriptions:<p>
</a>
<a name="932581">
When using GFLOATs<p>
</a>
<a name="932574">
<dd> </a>vax_float			= {32L, 8L, 23L, 0L, 1L, 9L, 0L, 0x81L}<P>
</a>
<a name="932576">
<dd> </a>vax_double			= {64L, 11L, 52L, 0L, 1L, 12L, 0L, 0x401L}<P>
</a>
<a name="932577">
otherwise<p>
</a>
<a name="932578">
<dd> </a>vax_float			= {32L, 8L, 23L, 0L, 1L, 9L, 0L, 0x81L}<P>
</a>
<a name="932580">
<dd> </a>vax_double			= {64L, 8L, 55L, 0L, 1L, 9L, 0L, 0x81L}<P>
</a>
<a name="935461">
<h4>7.2.1.2   </a>Byte Ordering</h4>
</a>
<a name="932573">
There is much discussion in the literature about </a>little endian and </a>big endian machines. Those two refer to two possible byte orderings for binary data. That is not the most general way to talk about byte ordering however. In fact the VAX format exemplifies the need for generality. PDBLib simply uses an array of integers which describe the order of the bytes in memory relative to CPU&#146;s such as the Motorola and SPARC families.<p>
</a>
<a name="932563">
<dd> </a>ieee_float_order				= {1, 2, 3, 4}<P>
</a>
<a name="932564">
<dd> </a>ieeea_double_order				= {1, 2, 3, 4, 5, 6, 7, 8}<P>
</a>
<a name="932565">
<dd> </a>ieeeb_double_order				= {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}<P>
</a>
<a name="932566">
<dd> </a>intel_float_order				= {4, 3, 2, 1}<P>
</a>
<a name="932567">
<dd> </a>intel_double_order				= {8, 7, 6, 5, 4, 3, 2, 1}<P>
</a>
<a name="932568">
<dd> </a>vax_float_order				= {2, 1, 4, 3}<P>
</a>
<a name="932570">
<dd> </a>vax_double_order				= {2, 1, 4, 3, 6, 5, 8, 7}<P>
</a>
<a name="932571">
<dd> </a>cray_float_order				= {1, 2, 3, 4, 5, 6, 7, 8}<P>
</a>
<a name="935463">
<h3>7.2.2   </a>DATA_ALIGNMENTS</h3>
</a>
<a name="935466">
The term </a>alignment refers to the fact that many CPU&#146;s require certain data types to begin at memory locations whose addresses are even multiples of some integer number of bytes. So for example, to say that the alignment of a double is 8 means that a double must begin at an address which is a multiple of 8.<p>
</a>
<a name="932562">
Compilers hide this concept from almost all applications. PDBLib is one that must know data alignments precisely. It employs a structure called a </a>data_alignment to record the alignments of the default </a>primitive </a>data types which PDBLib supports. See the discussion of the </a>data_alignment structure in the section on data structures.<p>
</a>
<a name="935482">
The following is the list of </a>data_alignment&#146;s which PDBLib provides automatically (applications can add their own as needed):<p>
</a>
<a name="935485">
<dd> </a>SPARC_ALIGNMENT				= {1, 4, 2, 4, 4, 4, 8}<P>
</a>
<a name="933405">
<dd> </a>MIPS_ALIGNMENT				= {1, 4, 2, 4, 4, 4, 8}<P>
</a>
<a name="933450">
<dd></a>RS6000_ALIGNMENT				= {1, 4, 2, 4, 4, 4, 4}<P>
</a>
<a name="935487">
<dd> </a>CRAY_ALIGNMENT				= {8, 8, 8, 8, 8, 8, 8}<P>
</a>
<a name="935488">
<dd> </a>UNICOS_ALIGNMENT				= {1, 8, 8, 8, 8, 8, 8}<P>
</a>
<a name="935489">
<dd> </a>M68000_ALIGNMENT				= {1, 2, 2, 2, 2, 2, 2}<P>
</a>
<a name="935490">
<dd> </a>INTELA_ALIGNMENT				= {1, 2, 2, 2, 2, 2, 2}<P>
</a>
<a name="932442">
<dd> </a>INTELB_ALIGNMENT				= {4, 4, 4, 4, 4, 4, 4}<P>
</a>
<a name="932443">
<dd> </a>INTELC_ALIGNMENT				= {2, 4, 2, 4, 4, 4, 4}<P>
</a>
<a name="935491">
<dd> </a>DEF_ALIGNMENT				= {1, 4, 4, 4, 4, 4, 4}<P>
</a>
<a name="935508">
<h1>8.0   </a>Data Structures in PDBLib</h1>
</a>
<a name="935515">
The data structures with which the PDBLib system works are passed back to the application program as the result of the high level calls. This gives the programmer access to a great deal of information about the PDB file, the symbol table and the structure chart. Hopefully, this also makes the package more powerful without pushing any special responsibility onto the programmer. <p>
</a>
<a name="935520">
For application developers who require all of the information from a PDB file, the hash lookup function, </a>SC_def_lookup, can be used to obtain symbol table entries (</a>syment) and structure definitions (</a>defstr) from the symbol table or structure chart. Examples can be found in the section at the end of the manual.<p>
</a>
<a name="935525">
<h2>8.1   </a>DATA_ALIGNMENT</h2>
</a>
<a name="935528">
The set of </a>alignments for the primitive types is kept in a structure called </a>data_alignment. Its actual definition is:<p>
</a>
<A NAME="932586"><PRE> struct s_data_alignment
</PRE><A NAME="935532"><PRE>    {int char_alignment;
</PRE><A NAME="935533"><PRE>     int ptr_alignment;
</PRE><A NAME="935534"><PRE>     int short_alignment;
</PRE><A NAME="935535"><PRE>     int int_alignment;
</PRE><A NAME="935536"><PRE>     int long_alignment;
</PRE><A NAME="935537"><PRE>     int float_alignment;
</PRE><A NAME="935538"><PRE>     int double_alignment;};
</PRE><A NAME="935539"><PRE> 
</PRE><A NAME="935540"><PRE> typedef struct s_data_alignment </a>data_alignment;
</PRE><a name="935547">
Each member is an integer which specifies the alignment for a primitive type. The alignment is a number of bytes such that a piece of data of this type must begin at an address which is an even multiple of that number. For example, if ptr_alignment is 4, a pointer must begin at an address divisible by 4.<p>
</a>
<a name="935552">
<h2>8.2   </a>DATA_STANDARD</h2>
</a>
<a name="935557">
The set of information describing all of the </a>primitive </a>data types is organized into a structure called a </a>data_standard. The </a>data_standard characterizes the CPU architecture because all types are either primitive or derived from known types.<p>
</a>
<a name="935558">
Its actual definition is:<p>
</a>
<A NAME="935561"><PRE> struct s_data_standard
</PRE><A NAME="935562"><PRE>    {int ptr_bytes;
</PRE><A NAME="935563"><PRE>     int short_bytes;
</PRE><A NAME="935564"><PRE>     int short_order;
</PRE><A NAME="935565"><PRE>     int int_bytes;
</PRE><A NAME="935566"><PRE>     int int_order;
</PRE><A NAME="935567"><PRE>     int long_bytes;
</PRE><A NAME="935568"><PRE>     int long_order;
</PRE><A NAME="935569"><PRE>     int float_bytes;
</PRE><A NAME="935570"><PRE>     long *float_format;
</PRE><A NAME="935571"><PRE>     int *float_order;
</PRE><A NAME="935572"><PRE>     int double_bytes;
</PRE><A NAME="935573"><PRE>     long *double_format;
</PRE><A NAME="935574"><PRE>     int *double_order;};
</PRE><A NAME="935575"><PRE> 
</PRE><A NAME="935576"><PRE> typedef struct s_data_standard </a>data_standard;
</PRE><a name="935582">
The integer types only require a number of bytes and their order. The floating point types require additional information describing the bit layout of the components of the number: the sign bit; the exponent; and the mantissa. These are given as an array of 8 integers as follows:<p>
</a>
<a name="935585">
<dd> format[0] = # of bits per number<P>
</a>
<a name="935586">
<dd> format[1] = # of bits in exponent<P>
</a>
<a name="935587">
<dd> format[2] = # of bits in mantissa<P>
</a>
<a name="935588">
<dd> format[3] = start bit of sign<P>
</a>
<a name="935589">
<dd> format[4] = start bit of exponent<P>
</a>
<a name="935590">
<dd> format[5] = start bit of mantissa<P>
</a>
<a name="935591">
<dd> format[6] = high order mantissa bit<P>
</a>
<a name="935592">
<dd> format[7] = bias of exponent<P>
</a>
<a name="932467">
<h2>8.3   </a>DEFSTR</h2>
</a>
<a name="935601">
An entry in the structure chart is represented by a structure called a </a>defstr. It contains information about the </a>data type such as the type name, the byte size and alignment, and a list of members.<p>
</a>
<a name="932468">
<h2>8.4   </a>DIMDES</h2>
</a>
<a name="935634">
A </a>dimdes or </a>dimension descriptor contains the information necessary to characterize a list of dimension specifications. It contains such information as the minimum and maximum values the dimension index may have and the net size of the dimension index range.<p>
</a>
<a name="932469">
<h2>8.5   </a>MEMDES</h2>
</a>
<a name="935658">
A </a>memdes or </a>member descriptor is the structure used to contain the information about a member of a </a>defstr. It contains information about the type of the member, the name of the member, any dimensions which the member may have, and any casts which have been defined via </a>PD_cast.<p>
</a>
<a name="933300">
<h2>8.6   </a>PDBFILE</h2>
</a>
<a name="933301">
The </a>PDBfile is the analog to the </a>FILE structure in standard C I/O. In fact, the PDBfile contains a FILE pointer to access the file via the standard C library functions. In addition, the PDBfile contains information such as: the symbol table, the structure charts for the file and the host platform; </a>data_standard&#146;s and </a>data_alignment&#146;s for the file and the host platform; and a modification date.<p>
</a>
<a name="935775">
<h2>8.7   </a>SYMENT</h2>
</a>
<a name="935779">
Just as the </a>defstr type describes entries in the structure chart the </a>syment type describes entries in the symbol table. The </a>syment includes information about the data type of the entry, the number of elements, the dimensions of the entry, and its disk address.<p>
</a>
<a name="935803">
<h1>9.0   </a>PDBLib by </a>Example</h1>
</a>
<a name="935807">
The following code fragments illustrate the functionality of PDBLib. Some of the code is taken from the validation suite and some from the library itself.<p>
</a>
<a name="935809">
<h2>9.1   Working with PDB files</h2>
</a>
<a name="935820">
This routine is taken from the validation suite for PDBLib. In it, a target for the PDB file is chosen with the routine <em>test_target</em> (see the section on </a><em>PD_target</em> for the definition of this function), a PDB file created, some structures defined, data written, and the file closed. The file is then reopened in append mode, some more data written to the file, and the file is closed again. Finally, the file is opened in read mode, the data read, some comparisons done, and the file is closed. The read and write operations are hidden in this example. The significance of the example is that a PDB file is created, closed, and opened in both append and read-only mode.<p>
</a>
<a name="935823">
<p>
</a>
<A NAME="935824"><PRE> test_1(base, tgt, n)
</PRE><A NAME="935825"><PRE>    char *base, *tgt;
</PRE><A NAME="935826"><PRE>    int n;
</PRE><A NAME="935827"><PRE>    {PDBfile *strm;
</PRE><A NAME="935828"><PRE>     char datfile[MAXLINE], fname[MAXLINE];
</PRE><A NAME="935829"><PRE>     int err;
</PRE><A NAME="935830"><PRE>     FILE *fp;
</PRE><A NAME="935831"><PRE> 
</PRE><A NAME="935832"><PRE> /* target the file as asked */
</PRE><A NAME="935833"><PRE>     test_target(tgt, base, n, fname, datfile);
</PRE><A NAME="935834"><PRE> 
</PRE><A NAME="935835"><PRE>     fp = fopen(fname, &#147;w&#148;);
</PRE><A NAME="935836"><PRE> 
</PRE><A NAME="935837"><PRE> /* create the named file */
</PRE><A NAME="935838"><PRE>     if ((strm = </a>PD_open(datfile, &#147;w&#148;)) == NULL)
</PRE><A NAME="935839"><PRE>        {fprintf(fp, &#147;Test couldn&#146;t create file %s\r\n&#148;, datfile);
</PRE><A NAME="935840"><PRE>         exit(1);};
</PRE><A NAME="935841"><PRE>     fprintf(fp, &#147;File %s created\n&#148;, datfile);
</PRE><A NAME="935842"><PRE> 
</PRE><A NAME="935843"><PRE>     prep_test_1_data();
</PRE><A NAME="935844"><PRE> 
</PRE><A NAME="935845"><PRE> /* make a few defstructs */
</PRE><A NAME="935846"><PRE>     </a>PD_defstr(strm, &#147;l_frame&#148;,
</PRE><A NAME="935847"><PRE>               &#147;float x_min&#148;, &#147;float x_max&#148;, &#147;float y_min&#148;,
</PRE><A NAME="935848"><PRE>               &#147;float y_max&#148;, LAST);
</PRE><A NAME="935849"><PRE>     </a>PD_defstr(strm, &#147;plot&#148;,
</PRE><A NAME="935850"><PRE>               &#147;float x_axis(10)&#148;, &#147;float y_axis(10)&#148;, &#147;integer npts&#148;, 
</PRE><A NAME="935851"><PRE>               &#147;char * label&#148;, &#147;l_frame view&#148;, LAST);
</PRE><A NAME="935852"><PRE> 
</PRE><A NAME="935853"><PRE> /* write the test data */
</PRE><A NAME="935854"><PRE>     write_test_1_data(strm);
</PRE><A NAME="935855"><PRE> 
</PRE><A NAME="935856"><PRE> /* close the file */
</PRE><A NAME="935857"><PRE>     if (!</a>PD_close(strm))
</PRE><A NAME="935858"><PRE>        {fprintf(fp, &#147;Test couldn&#146;t close file %s\r\n&#148;, datfile);
</PRE><A NAME="935859"><PRE>         exit(1);};
</PRE><A NAME="935860"><PRE>     fprintf(fp, &#147;File %s closed\n&#148;, datfile);
</PRE><A NAME="935861"><PRE> 
</PRE><A NAME="935862"><PRE> /* reopen the file to append */
</PRE><A NAME="935863"><PRE>     if ((strm = </a>PD_open(datfile, &#147;a&#148;)) == NULL)
</PRE><A NAME="935864"><PRE>        {fprintf(fp, &#147;Test couldn&#146;t open file %s to append\r\n&#148;,
</PRE><A NAME="932485"><PRE>                 datfile);
</PRE><A NAME="935865"><PRE>         exit(1);};
</PRE><A NAME="935866"><PRE>     fprintf(fp, &#147;File %s opened to append\n&#148;, datfile);
</PRE><A NAME="935867"><PRE> 
</PRE><A NAME="935868"><PRE>     append_test_1_data(strm);
</PRE><A NAME="935869"><PRE> 
</PRE><A NAME="935870"><PRE> /* close the file after append */
</PRE><A NAME="935871"><PRE>     if (!</a>PD_close(strm))
</PRE><A NAME="935872"><PRE>        {fprintf(fp, &#147;Test couldn&#146;t close file %s after append\r\n&#148;,
</PRE><A NAME="935873"><PRE>                 datfile);
</PRE><A NAME="935874"><PRE>         exit(1);};
</PRE><A NAME="935875"><PRE>     fprintf(fp, &#147;File %s closed after append\n&#148;, datfile);
</PRE><A NAME="935876"><PRE> 
</PRE><A NAME="935877"><PRE> /* reopen the file */
</PRE><A NAME="935878"><PRE>     if ((strm = </a>PD_open(datfile, &#147;r&#148;)) == NULL)
</PRE><A NAME="935879"><PRE>        {fprintf(fp, &#147;Test couldn&#146;t open file %s\r\n&#148;, datfile);
</PRE><A NAME="935880"><PRE>         exit(1);};
</PRE><A NAME="935881"><PRE>     fprintf(fp, &#147;File %s opened\n&#148;, datfile);
</PRE><A NAME="935882"><PRE> 
</PRE><A NAME="935883"><PRE> /* dump the symbol table */
</PRE><A NAME="935884"><PRE>     dump_test_symbol_table(fp, strm-&gt;symtab, 1);
</PRE><A NAME="935885"><PRE> 
</PRE><A NAME="935886"><PRE> /* read the data from the file */
</PRE><A NAME="935887"><PRE>     read_test_1_data(strm);
</PRE><A NAME="935888"><PRE> 
</PRE><A NAME="935889"><PRE> /* compare the original data with that read in */
</PRE><A NAME="935890"><PRE>     err = compare_test_1_data(strm, fp);
</PRE><A NAME="935891"><PRE> 
</PRE><A NAME="935892"><PRE> /* close the file */
</PRE><A NAME="935893"><PRE>     if (!</a>PD_close(strm))
</PRE><A NAME="935894"><PRE>       {fprintf(fp, &#147;Test couldn&#146;t close file %s\r\n&#148;, datfile);
</PRE><A NAME="935895"><PRE>        exit(1);};
</PRE><A NAME="935896"><PRE>     fprintf(fp, &#147;File %s closed\n&#148;, datfile);
</PRE><A NAME="935897"><PRE> 
</PRE><A NAME="935898"><PRE> /* print it out to stdout */
</PRE><A NAME="935899"><PRE>     print_test_1_data(fp);
</PRE><A NAME="935900"><PRE> 
</PRE><A NAME="935901"><PRE>     fclose(fp);
</PRE><A NAME="935902"><PRE> 
</PRE><A NAME="935903"><PRE>     return(err);}
</PRE><a name="935908">
<h2>9.2   </a>Writing Data to PDB files</h2>
</a>
<a name="935913">
These two routines exemplify the various write routines of PDBLib. In particular, they were built to test the spectrum of write calls. Notice their demonstration of the rules for write operations: the variable must be a pointer to data of the type specified.<p>
</a>
<a name="935916">
The identifiers beginning with &#145;N_&#146; are &#145;#defined&#146; constants whose values are irrelevant to these examples.<p>
</a>
<a name="935919">
<p>
</a>
<A NAME="935920"><PRE> static char
</PRE><A NAME="935921"><PRE>  cs_w,
</PRE><A NAME="935922"><PRE>  ca_w[N_CHAR],
</PRE><A NAME="935923"><PRE>  *cap_w[N_DOUBLE];
</PRE><A NAME="935924"><PRE> 
</PRE><A NAME="935925"><PRE> static short
</PRE><A NAME="935926"><PRE>  ss_w,
</PRE><A NAME="935927"><PRE>  sa_w[N_INT];
</PRE><A NAME="935928"><PRE> 
</PRE><A NAME="935929"><PRE> static int
</PRE><A NAME="935930"><PRE>  is_w,
</PRE><A NAME="935931"><PRE>  ia_w[N_INT],
</PRE><A NAME="935932"><PRE>  p_w[N_INT],
</PRE><A NAME="935933"><PRE>  len;
</PRE><A NAME="935934"><PRE> 
</PRE><A NAME="935935"><PRE> static float
</PRE><A NAME="935936"><PRE>  fs_w,
</PRE><A NAME="935937"><PRE>  fa2_w[N_FLOAT][N_DOUBLE];
</PRE><A NAME="935938"><PRE> 
</PRE><A NAME="935939"><PRE> static double
</PRE><A NAME="935940"><PRE>  ds_w,
</PRE><A NAME="935941"><PRE>  da_w[N_FLOAT];
</PRE><A NAME="935942"><PRE> 
</PRE><A NAME="935943"><PRE> static plot
</PRE><A NAME="935944"><PRE>  graph_w;
</PRE><A NAME="935945"><PRE> 
</PRE><A NAME="935946"><PRE> static l_frame
</PRE><A NAME="935947"><PRE>  view_w;
</PRE><A NAME="935948"><PRE> 
</PRE><A NAME="935949"><PRE> static lev1
</PRE><A NAME="935950"><PRE>  *tar_w;
</PRE><A NAME="935951"><PRE> 
</PRE><A NAME="935952"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="935953"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="935954"><PRE> 
</PRE><A NAME="935955"><PRE> void write_test_1_data(strm)
</PRE><A NAME="935956"><PRE>    PDBfile *strm;
</PRE><A NAME="935957"><PRE>    {
</PRE><A NAME="935958"><PRE> 
</PRE><A NAME="935959"><PRE> /* write scalars into the file */
</PRE><A NAME="935960"><PRE>     </a>PD_write(strm, &#147;cs&#148;, &#147;char&#148;, &amp;cs_w);
</PRE><A NAME="935961"><PRE>     PD_write(strm, &#147;ss&#148;, &#147;short&#148;, &amp;ss_w);
</PRE><A NAME="935962"><PRE>     PD_write(strm, &#147;is&#148;, &#147;integer&#148;, &amp;is_w);
</PRE><A NAME="935963"><PRE>     PD_write(strm, &#147;fs&#148;, &#147;float&#148;, &amp;fs_w);
</PRE><A NAME="935964"><PRE>     PD_write(strm, &#147;ds&#148;, &#147;double&#148;, &amp;ds_w);
</PRE><A NAME="935965"><PRE> 
</PRE><A NAME="935966"><PRE> /* write primitive arrays into the file */
</PRE><A NAME="935968"><PRE>     PD_write(strm, &#147;sa(5)&#148;, &#147;short&#148;, sa_w);
</PRE><A NAME="935969"><PRE>     PD_write(strm, &#147;ia(5)&#148;, &#147;integer&#148;, ia_w);
</PRE><A NAME="935973"><PRE> 
</PRE><A NAME="935974"><PRE> /* write structures into the file */
</PRE><A NAME="935975"><PRE>     PD_write(strm, &#147;view&#148;, &#147;l_frame&#148;, &amp;view_w);
</PRE><A NAME="935976"><PRE>     PD_write(strm, &#147;graph&#148;, &#147;plot&#148;, &amp;graph_w);
</PRE><A NAME="935977"><PRE> 
</PRE><A NAME="935978"><PRE>     return;}
</PRE><A NAME="935979"><PRE> 
</PRE><A NAME="935980"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="935981"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="935982"><PRE> 
</PRE><A NAME="935983"><PRE> void write_test_2_data(strm)
</PRE><A NAME="935984"><PRE>    PDBfile *strm;
</PRE><A NAME="933624"><PRE>    {
</PRE><A NAME="933628"><PRE> 
</PRE><A NAME="935986"><PRE>    </a>PD_write(strm, &#147;tar&#148;, &#147;lev1 *&#148;, &amp;tar_w);
</PRE><A NAME="932486"><PRE> 
</PRE><A NAME="932487"><PRE>     return;}
</PRE><A NAME="935987"><PRE> 
</PRE><A NAME="935988"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="935989"><PRE> /*-----------------------------------------------------------------*/
</PRE><a name="935994">
<h2>9.3   </a>Reading Data from PDB files</h2>
</a>
<a name="936002">
These two routines exemplify the various read routines of PDBLib. In particular, they were built to test the spectrum of read operations. They read the data written out in the previous example. Notice their demonstration of the rules for read operations: the variable must be a pointer to data of the type specified. This is often a more difficult proposition for reads since the type information isn&#146;t supplied in the read call.<p>
</a>
<a name="936006">
The member read operations at the end of the first routine should be studied carefully. They are not the most general read example, but they are among the most useful.<p>
</a>
<a name="936011">
The second routine reads not only the entire structure, but picks out each part individually. It demonstrates the rule about dereferencing pointers in the partial read operation. Study the structures of this example carefully!<p>
</a>
<a name="936016">
The identifiers beginning with &#145;N_&#146; are &#145;#defined&#146; constants whose values are irrelevant to these examples. Also, take for granted that the unspecified variables to contain parts of the structures have the correct declarations.<p>
</a>
<A NAME="936020"><PRE> 
</PRE><A NAME="932484"><PRE> struct s_lev2
</PRE><A NAME="936021"><PRE>  {char **s;
</PRE><A NAME="936022"><PRE>  int type;};
</PRE><A NAME="936023"><PRE> 
</PRE><A NAME="936024"><PRE> typedef struct s_lev2 lev2;
</PRE><A NAME="936025"><PRE> 
</PRE><A NAME="936026"><PRE> struct s_lev1
</PRE><A NAME="936027"><PRE>  {int *a;
</PRE><A NAME="936028"><PRE>  double *b;
</PRE><A NAME="936029"><PRE>  lev2 *c;};
</PRE><A NAME="936030"><PRE> 
</PRE><A NAME="936031"><PRE> typedef struct s_lev1 lev1;
</PRE><A NAME="936032"><PRE> 
</PRE><A NAME="936033"><PRE> static char
</PRE><A NAME="936034"><PRE>  cs_r,
</PRE><A NAME="936035"><PRE>  ca_r[N_CHAR],
</PRE><A NAME="936036"><PRE>  *cap_r[N_DOUBLE];
</PRE><A NAME="936037"><PRE> 
</PRE><A NAME="936038"><PRE> static short
</PRE><A NAME="936039"><PRE>  ss_r,
</PRE><A NAME="936040"><PRE>  sa_r[N_INT];
</PRE><A NAME="936041"><PRE> 
</PRE><A NAME="936042"><PRE> static int
</PRE><A NAME="936043"><PRE>  is_r,
</PRE><A NAME="936044"><PRE>  ia_r[N_INT];
</PRE><A NAME="936045"><PRE> 
</PRE><A NAME="936046"><PRE> static float
</PRE><A NAME="936047"><PRE>  fs_r,
</PRE><A NAME="936048"><PRE>  fs_app_r,
</PRE><A NAME="936049"><PRE>  fs_p1_r,
</PRE><A NAME="936050"><PRE>  fs_p2_r,
</PRE><A NAME="936051"><PRE>  fs_p3_r,
</PRE><A NAME="936052"><PRE>  fa2_r[N_FLOAT][N_DOUBLE],
</PRE><A NAME="936053"><PRE>  fa2_app_r[N_FLOAT][N_DOUBLE];
</PRE><A NAME="936054"><PRE> 
</PRE><A NAME="936055"><PRE> static double
</PRE><A NAME="936056"><PRE>  ds_r,
</PRE><A NAME="936057"><PRE>  da_r[N_FLOAT];
</PRE><A NAME="936058"><PRE> 
</PRE><A NAME="936059"><PRE> static plot
</PRE><A NAME="936060"><PRE>  graph_r;
</PRE><A NAME="936061"><PRE> 
</PRE><A NAME="936062"><PRE> static l_frame
</PRE><A NAME="936063"><PRE>  view_r;
</PRE><A NAME="936064"><PRE> 
</PRE><A NAME="936065"><PRE> static lev1
</PRE><A NAME="936066"><PRE>  *tar_r;
</PRE><A NAME="936067"><PRE> 
</PRE><A NAME="936068"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="936069"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="936070"><PRE> 
</PRE><A NAME="936071"><PRE> void read_test_1_data(strm)
</PRE><A NAME="936072"><PRE>    PDBfile *strm;
</PRE><A NAME="936073"><PRE>    {
</PRE><A NAME="936074"><PRE> 
</PRE><A NAME="936075"><PRE> /* read the scalar data from the file */
</PRE><A NAME="936076"><PRE>     </a>PD_read(strm, &#147;cs&#148;, &amp;cs_r);
</PRE><A NAME="936077"><PRE>     PD_read(strm, &#147;ss&#148;, &amp;ss_r);
</PRE><A NAME="936078"><PRE>     PD_read(strm, &#147;is&#148;, &amp;is_r);
</PRE><A NAME="936079"><PRE>     PD_read(strm, &#147;fs&#148;, &amp;fs_r);
</PRE><A NAME="936080"><PRE>     PD_read(strm, &#147;ds&#148;, &amp;ds_r);
</PRE><A NAME="936081"><PRE> 
</PRE><A NAME="936082"><PRE> /* read the primitive arrays from the file */
</PRE><A NAME="936083"><PRE>     PD_read(strm, &#147;ca&#148;, ca_r);
</PRE><A NAME="936084"><PRE>     PD_read(strm, &#147;sa&#148;, sa_r);
</PRE><A NAME="936085"><PRE>     PD_read(strm, &#147;ia&#148;, ia_r);
</PRE><A NAME="936086"><PRE>     PD_read(strm, &#147;fa2&#148;, fa2_r);
</PRE><A NAME="936087"><PRE>     PD_read(strm, &#147;da&#148;, da_r);
</PRE><A NAME="936088"><PRE>     PD_read(strm, &#147;cap&#148;, cap_r);
</PRE><A NAME="936089"><PRE> 
</PRE><A NAME="936090"><PRE> /* read the entire structures from the file */
</PRE><A NAME="936091"><PRE>     PD_read(strm, &#147;view&#148;, &amp;view_r);
</PRE><A NAME="936092"><PRE>     PD_read(strm, &#147;graph&#148;, &amp;graph_r);
</PRE><A NAME="936093"><PRE> 
</PRE><A NAME="936094"><PRE> /* read the appended data from the file */
</PRE><A NAME="936095"><PRE>     PD_read(strm, &#147;fs_app&#148;, &amp;fs_app_r);
</PRE><A NAME="936096"><PRE>     PD_read(strm, &#147;fa2_app&#148;, fa2_app_r);
</PRE><A NAME="936100"><PRE> 
</PRE><A NAME="936101"><PRE> /* struct member test */
</PRE><A NAME="936103"><PRE>     PD_read(strm, &#147;graph.view.x_max&#148;, &amp;fs_p2_r);
</PRE><A NAME="936104"><PRE>     </a>PD_read(strm, &#147;view.y_max&#148;, &amp;fs_p3_r);
</PRE><A NAME="936105"><PRE> 
</PRE><A NAME="936106"><PRE>     return;}
</PRE><A NAME="936107"><PRE> 
</PRE><A NAME="936108"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="936109"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="936110"><PRE> 
</PRE><A NAME="936111"><PRE> /* READ_TEST_2_DATA - read the test data from the file */
</PRE><A NAME="936112"><PRE> 
</PRE><A NAME="936113"><PRE> void read_test_2_data(strm)
</PRE><A NAME="936114"><PRE>    PDBfile *strm;
</PRE><A NAME="936115"><PRE>    {do_r = strm-&gt;default_offset;
</PRE><A NAME="936116"><PRE> 
</PRE><A NAME="936117"><PRE>     </a>PD_read(strm, &#147;tar&#148;, &amp;tar_r);
</PRE><A NAME="936118"><PRE>     PD_read(strm, &#147;p&#148;, p_r);
</PRE><A NAME="936119"><PRE> 
</PRE><A NAME="936120"><PRE>     PD_read(strm, &#147;tar(0).a&#148;, &amp;ap1);
</PRE><A NAME="936121"><PRE>     PD_read(strm, &#147;tar(1).a&#148;, &amp;ap2);
</PRE><A NAME="936122"><PRE> 
</PRE><A NAME="936123"><PRE>     PD_read(strm, &#147;tar(0).a(0)&#148;, &amp;aa[0]);
</PRE><A NAME="936124"><PRE>     PD_read(strm, &#147;tar(0).a(1)&#148;, &amp;aa[1]);
</PRE><A NAME="936125"><PRE>     PD_read(strm, &#147;tar(1).a(0)&#148;, &amp;aa[2]);
</PRE><A NAME="936126"><PRE>     PD_read(strm, &#147;tar(1).a(1)&#148;, &amp;aa[3]);
</PRE><A NAME="936127"><PRE> 
</PRE><A NAME="936128"><PRE>     PD_read(strm, &#147;tar(0).b&#148;, &amp;bp1);
</PRE><A NAME="936129"><PRE>     PD_read(strm, &#147;tar(1).b&#148;, &amp;bp2);
</PRE><A NAME="936130"><PRE> 
</PRE><A NAME="936131"><PRE>     PD_read(strm, &#147;tar(0).b(0)&#148;, &amp;ba[0]);
</PRE><A NAME="936132"><PRE>     PD_read(strm, &#147;tar(0).b(1)&#148;, &amp;ba[1]);
</PRE><A NAME="936133"><PRE>     PD_read(strm, &#147;tar(1).b(0)&#148;, &amp;ba[2]);
</PRE><A NAME="936134"><PRE>     PD_read(strm, &#147;tar(1).b(1)&#148;, &amp;ba[3]);
</PRE><A NAME="936135"><PRE> 
</PRE><A NAME="936136"><PRE>     PD_read(strm, &#147;tar(0).c&#148;, &amp;cp1);
</PRE><A NAME="936137"><PRE>     PD_read(strm, &#147;tar(1).c&#148;, &amp;cp2);
</PRE><A NAME="936138"><PRE> 
</PRE><A NAME="936139"><PRE>     PD_read(strm, &#147;tar(0).c(0)&#148;, &amp;ca[0]);
</PRE><A NAME="936140"><PRE>     PD_read(strm, &#147;tar(0).c(1)&#148;, &amp;ca[1]);
</PRE><A NAME="936141"><PRE>     PD_read(strm, &#147;tar(1).c(0)&#148;, &amp;ca[2]);
</PRE><A NAME="936142"><PRE>     PD_read(strm, &#147;tar(1).c(1)&#148;, &amp;ca[3]);
</PRE><A NAME="936143"><PRE> 
</PRE><A NAME="936144"><PRE>     PD_read(strm, &#147;tar(0).c(0).s&#148;, &amp;sp1);
</PRE><A NAME="936145"><PRE>     PD_read(strm, &#147;tar(0).c(1).s&#148;, &amp;sp2);
</PRE><A NAME="936146"><PRE>     PD_read(strm, &#147;tar(1).c(0).s&#148;, &amp;sp3);
</PRE><A NAME="936147"><PRE>     PD_read(strm, &#147;tar(1).c(1).s&#148;, &amp;sp4);
</PRE><A NAME="936148"><PRE> 
</PRE><A NAME="936149"><PRE>     PD_read(strm, &#147;tar(0).c(0).s(0)&#148;, &amp;tp1);
</PRE><A NAME="936150"><PRE>     PD_read(strm, &#147;tar(0).c(0).s(1)&#148;, &amp;tp2);
</PRE><A NAME="936151"><PRE>     PD_read(strm, &#147;tar(0).c(1).s(0)&#148;, &amp;tp3);
</PRE><A NAME="936152"><PRE>     PD_read(strm, &#147;tar(0).c(1).s(1)&#148;, &amp;tp4);
</PRE><A NAME="936153"><PRE> 
</PRE><A NAME="936154"><PRE>     PD_read(strm, &#147;tar(0).c(0).s(0)(2)&#148;, &amp;ta[0]);
</PRE><A NAME="936155"><PRE>     PD_read(strm, &#147;tar(0).c(0).s(1)(1)&#148;, &amp;ta[1]);
</PRE><A NAME="936156"><PRE>     PD_read(strm, &#147;tar(0).c(1).s(0)(3)&#148;, &amp;ta[2]);
</PRE><A NAME="936157"><PRE>     PD_read(strm, &#147;tar(0).c(1).s(1)(2)&#148;, &amp;ta[3]);
</PRE><A NAME="936158"><PRE> 
</PRE><A NAME="936159"><PRE>     PD_read(strm, &#147;tar(1).c(0).s(0)&#148;, &amp;tp5);
</PRE><A NAME="936160"><PRE>     PD_read(strm, &#147;tar(1).c(0).s(1)&#148;, &amp;tp6);
</PRE><A NAME="936161"><PRE>     PD_read(strm, &#147;tar(1).c(1).s(0)&#148;, &amp;tp7);
</PRE><A NAME="936162"><PRE>     </a>PD_read(strm, &#147;tar(1).c(1).s(1)&#148;, &amp;tp8);
</PRE><A NAME="936163"><PRE> 
</PRE><A NAME="936164"><PRE>     return;}
</PRE><a name="936172">
<h2>9.4   </a>Inquiries in PDBLib</h2>
</a>
<a name="936176">
The following fragments show how to obtain information about PDB files and their contents.<p>
</a>
<A NAME="936179"><PRE> 
</PRE><A NAME="932488"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="936180"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="936181"><PRE> 
</PRE><A NAME="936182"><PRE> myread(file, name, var, offset, number)
</PRE><A NAME="936183"><PRE>    PDBfile *file;
</PRE><A NAME="936184"><PRE>    char *name;
</PRE><A NAME="936185"><PRE>    void *var;
</PRE><A NAME="936186"><PRE>    long offset, number;
</PRE><A NAME="936187"><PRE>    {long addr, num;
</PRE><A NAME="936188"><PRE>     char *token, *type, memb[MAXLINE];
</PRE><A NAME="936189"><PRE>     dimdes *dims;
</PRE><A NAME="936190"><PRE>     syment *ep;
</PRE><A NAME="936191"><PRE> 
</PRE><A NAME="936192"><PRE>     strcpy(memb, name);
</PRE><A NAME="936193"><PRE>     token = strtok(memb, &#147;.([&#147;);
</PRE><A NAME="936194"><PRE> 
</PRE><A NAME="936195"><PRE> /* look up the variable name */
</PRE><A NAME="936196"><PRE>     ep = </a>PD_inquire_entry(file, token);
</PRE><A NAME="932716"><PRE>     if (ep == NULL)
</PRE><A NAME="936197"><PRE>         PD_error(&#147;VARIABLE NOT IN SYMBOL TABLE - MYREAD&#148;,
</PRE><A NAME="932489"><PRE>                  READ);
</PRE><A NAME="936198"><PRE> 
</PRE><A NAME="936199"><PRE>     addr = </a>PD_entry_address(ep);
</PRE><A NAME="936200"><PRE>     dims = </a>PD_entry_dimensions(ep);
</PRE><A NAME="936201"><PRE>     num  = </a>PD_entry_number(ep);
</PRE><A NAME="936202"><PRE>     type = </a>PD_entry_type(ep);
</PRE><A NAME="936203"><PRE> 
</PRE><A NAME="936204"><PRE> /* with ep in hand, we know the variable type, number of elements,
</PRE><A NAME="936205"><PRE>  * dimensions, and disk address
</PRE><A NAME="936206"><PRE>  */
</PRE><A NAME="936207"><PRE>               .
</PRE><A NAME="936208"><PRE>               .
</PRE><A NAME="936209"><PRE>               .
</PRE><A NAME="936210"><PRE> 
</PRE><A NAME="936211"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="936212"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="936213"><PRE> 
</PRE><A NAME="936214"><PRE> _PD_wr_leaf(file, var, nitems, type)
</PRE><A NAME="936215"><PRE>    PDBfile *file;
</PRE><A NAME="936216"><PRE>    char *var;
</PRE><A NAME="936217"><PRE>    long nitems;
</PRE><A NAME="936218"><PRE>    char *type;
</PRE><A NAME="936219"><PRE>    {char *svar;
</PRE><A NAME="936220"><PRE>     int size;
</PRE><A NAME="936221"><PRE>     FILE *fp;
</PRE><A NAME="936222"><PRE>     defstr *dp;
</PRE><A NAME="936223"><PRE>     memdes *desc, *mem_lst;
</PRE><A NAME="936224"><PRE> 
</PRE><A NAME="936225"><PRE>     fp = file-&gt;stream;
</PRE><A NAME="936226"><PRE>            .
</PRE><A NAME="936227"><PRE>            .
</PRE><A NAME="936228"><PRE>            .
</PRE><A NAME="936229"><PRE> 
</PRE><A NAME="936230"><PRE> /* dispatch all other writes */
</PRE><A NAME="936231"><PRE>     if (file-&gt;conversions)
</PRE><A NAME="936232"><PRE>            .
</PRE><A NAME="936233"><PRE>            .
</PRE><A NAME="936234"><PRE>            .
</PRE><A NAME="936235"><PRE> 
</PRE><A NAME="932492"><PRE> /* obtain a pointer to the defstr associated with type */
</PRE><A NAME="932493"><PRE>     dp = PD_inquire_host_type(file, type);
</PRE><A NAME="932495"><PRE>     if (dp == NULL)
</PRE><A NAME="932494"><PRE>        PD_error(&#147;BAD TYPE - WR-LEAF&#148;, WRITE);
</PRE><A NAME="936239"><PRE> 
</PRE><A NAME="936240"><PRE> /* if the structure has any pointered members loop over the members */
</PRE><A NAME="936241"><PRE>     if (dp-&gt;n_indirects &amp;&amp; ((mem_lst = dp-&gt;members) != NULL))
</PRE><A NAME="936242"><PRE>        {size = dp-&gt;size;
</PRE><A NAME="936243"><PRE>         for (svar = var, offset = 0L, i = 0L; i &lt; nitems; i++)
</PRE><A NAME="936244"><PRE>             {for (desc = mem_lst; desc != NULL; desc = desc-&gt;next)
</PRE><A NAME="936245"><PRE>                  { ... };
</PRE><A NAME="936246"><PRE>              svar += size;};};
</PRE><A NAME="936248"><PRE>            .
</PRE><A NAME="936249"><PRE>            .
</PRE><A NAME="936250"><PRE>            .
</PRE><A NAME="936251"><PRE> 
</PRE><A NAME="936252"><PRE> /*-----------------------------------------------------------------*/
</PRE><A NAME="936253"><PRE> /*-----------------------------------------------------------------*/
</PRE><a name="936259">
<h2>9.5   </a>Writing PM_mappings with </a>PFWMAP</h2>
</a>
<a name="936266">
The following fragment shows how to write a </a>PM_mapping to a PDB file from a FORTRAN program. This example uses PFWMAP. PFWMAP writes out both </a>domain and </a>range as a complete mapping. The drawback to this approach is that many mappings might have the same domain which would be written out over and over again. This could lead to unacceptably large data files. See the next example for a more space saving approach.<p>
</a>
<A NAME="936269"><PRE> c
</PRE><A NAME="936270"><PRE> c************************************************************
</PRE><A NAME="936271"><PRE> c************************************************************
</PRE><A NAME="936272"><PRE> c
</PRE><A NAME="936273"><PRE>  subroutine sxdmp(namesx, namelen)
</PRE><A NAME="936274"><PRE> 
</PRE><A NAME="936275"><PRE> c traverse plot list to make dumps suitable for sx
</PRE><A NAME="936276"><PRE> 
</PRE><A NAME="936277"><PRE>  integer </a>pfopen, </a>pfclos, </a>pfgerr, </a>pfwmap, </a>pfwset, </a>pfwran
</PRE><A NAME="936278"><PRE>  integer zscanleq
</PRE><A NAME="936279"><PRE>  
</PRE><A NAME="936280"><PRE>  integer pderr(32), rp(6), dp(6)
</PRE><A NAME="936281"><PRE>  integer fileid, pim, dmnsn
</PRE><A NAME="936282"><PRE> 
</PRE><A NAME="936283"><PRE>  double precision rm(nsavept), dm(nsavept)
</PRE><A NAME="936284"><PRE> 
</PRE><A NAME="936285"><PRE> c ... set up
</PRE><A NAME="936286"><PRE>             .
</PRE><A NAME="936287"><PRE>             .
</PRE><A NAME="936288"><PRE>             .
</PRE><A NAME="936289"><PRE> 
</PRE><A NAME="936290"><PRE> c ... open the file
</PRE><A NAME="936291"><PRE>  fileid = </a>pfopen(namelen, namesx, &#146;w&#146;)
</PRE><A NAME="936292"><PRE>  if (fileid .eq. -1) then
</PRE><A NAME="936293"><PRE>     iplpderr = </a>pfgerr(nchr, pderr)
</PRE><A NAME="936294"><PRE>     call errproc(pderr, nchr, 0, 0)
</PRE><A NAME="936295"><PRE>  endif
</PRE><A NAME="936296"><PRE> 
</PRE><A NAME="936297"><PRE>  pim = 0
</PRE><A NAME="936298"><PRE> 
</PRE><A NAME="936299"><PRE> c ... loop over plots
</PRE><A NAME="936300"><PRE>  do ...
</PRE><A NAME="936301"><PRE> 
</PRE><A NAME="936302"><PRE> c ... setup domain
</PRE><A NAME="936303"><PRE>  dname = &lt;domain name&gt;
</PRE><A NAME="936304"><PRE>  dp(1) = &lt;length of domain name&gt;
</PRE><A NAME="936305"><PRE> 
</PRE><A NAME="936306"><PRE>  select case (dmnsn)
</PRE><A NAME="936307"><PRE>  case (&#146;d2r1&#146;)
</PRE><A NAME="936308"><PRE>     dp(2) = 2
</PRE><A NAME="936309"><PRE>     dp(3) = 2
</PRE><A NAME="936310"><PRE>     dp(4) = nr
</PRE><A NAME="936311"><PRE>     dp(5) = kmax
</PRE><A NAME="936312"><PRE>     dp(6) = lmax
</PRE><A NAME="936313"><PRE>     call zmovewrd(dm(1), x2d, nr)
</PRE><A NAME="936314"><PRE>     call zmovewrd(dm(nr+1), y2d, nr)
</PRE><A NAME="936315"><PRE>  case (&#146;d1r1&#146;)
</PRE><A NAME="936316"><PRE>     dp(2) = 1
</PRE><A NAME="936317"><PRE>     dp(3) = 1
</PRE><A NAME="936318"><PRE>     dp(4) = nr
</PRE><A NAME="936319"><PRE>     dp(5) = nr
</PRE><A NAME="936320"><PRE>     call zmovewrd(dm(1), &lt;domain data&gt;, nr)
</PRE><A NAME="936321"><PRE>  endselect
</PRE><A NAME="936322"><PRE> 
</PRE><A NAME="936323"><PRE> c ... set up range
</PRE><A NAME="936324"><PRE>  rname = &lt;range name&gt;
</PRE><A NAME="936325"><PRE>  rp(1) = &lt;length of range name&gt;
</PRE><A NAME="936326"><PRE> 
</PRE><A NAME="936327"><PRE>  rp(2) = dp(2)
</PRE><A NAME="936328"><PRE>  rp(3) = 1
</PRE><A NAME="936329"><PRE>  rp(4) = nr
</PRE><A NAME="936330"><PRE>  rp(5) = dp(5)
</PRE><A NAME="936331"><PRE>  rp(6) = dp(6)
</PRE><A NAME="936332"><PRE>  call zmovewrd(rm(1), &lt;range data&gt;, nr)
</PRE><A NAME="936333"><PRE> 
</PRE><A NAME="936334"><PRE> c ... write the mapping
</PRE><A NAME="936335"><PRE>  ierr = </a>pfwmap(fileid, dname, dp, dm, rname, rp, rm, pim)
</PRE><A NAME="936336"><PRE>  if (ierr.eq.0) then
</PRE><A NAME="936337"><PRE>     </a>pfgerr(nchr, pderr)
</PRE><A NAME="936338"><PRE>     call errproc(pderr, nchr, 0, 0)
</PRE><A NAME="936339"><PRE>  endif
</PRE><A NAME="936340"><PRE>  pim = pim + 1
</PRE><A NAME="936341"><PRE>  repeat
</PRE><A NAME="936342"><PRE> 
</PRE><A NAME="936343"><PRE> c ... close the file
</PRE><A NAME="936344"><PRE>  icloseok = </a>pfclos(fileid)
</PRE><A NAME="936345"><PRE>  if (icloseok.eq.0) then
</PRE><A NAME="936346"><PRE>     </a>pfgerr(nchr, pderr)
</PRE><A NAME="936347"><PRE>     call errproc(pderr, nchr, 0, 0)
</PRE><A NAME="936348"><PRE>  endif
</PRE><A NAME="936349"><PRE> 
</PRE><A NAME="936350"><PRE>  return
</PRE><A NAME="936351"><PRE>  end
</PRE><a name="936356">
<h2>9.6   </a>Writing PM_mappings with </a>PFWSET and </a>PFWRAN</h2>
</a>
<a name="936370">
The following fragment shows how to write a </a>PM_mapping to a PDB file from a FORTRAN program. This example uses </a>PFWSET and </a>PFWRAN. With PFWSET and PFWRAN an application can write mappings in the most space efficient way. Instead of writing the same domains over and over again as would be done with </a>PFWMAP, the application can select the unique domains and write them out with PFWSET. Then all mappings can be written using PFWRAN which writes out a PM_mapping with a null </a>domain. The post processing tools (such as PDBView) reconstruct the complete PM_mapping by looking for the domain as a variable with the same name as the domain component of the mapping name. This approach is clearly a little more involved than using PFWMAP and application developers should weigh the advantages and disadvantages before selecting one method over the other. See the previous example for an illustration of the use of PFWMAP.<p>
</a>
<A NAME="936373"><PRE> c
</PRE><A NAME="936374"><PRE> c************************************************************
</PRE><A NAME="936375"><PRE> c************************************************************
</PRE><A NAME="936376"><PRE> c
</PRE><A NAME="936377"><PRE>  subroutine sxdmp(namesx, namelen)
</PRE><A NAME="936378"><PRE> 
</PRE><A NAME="936379"><PRE> c traverse plot list to make dumps suitable for sx
</PRE><A NAME="936380"><PRE> 
</PRE><A NAME="936381"><PRE>  integer </a>pfopen, </a>pfclos, </a>pfgerr, </a>pfwmap, </a>pfwset, </a>pfwran
</PRE><A NAME="936382"><PRE>  integer zscanleq
</PRE><A NAME="936383"><PRE>  
</PRE><A NAME="936384"><PRE>  integer pderr(32), rp(6), dp(6)
</PRE><A NAME="936385"><PRE>  integer fileid, pim, dmnsn
</PRE><A NAME="936386"><PRE> 
</PRE><A NAME="936387"><PRE>  double precision rm(nsavept), dm(nsavept)
</PRE><A NAME="936388"><PRE> 
</PRE><A NAME="936389"><PRE> c ... set up
</PRE><A NAME="936390"><PRE>             .
</PRE><A NAME="936391"><PRE>             .
</PRE><A NAME="936392"><PRE>             .
</PRE><A NAME="936393"><PRE> 
</PRE><A NAME="936394"><PRE> c ... open the file
</PRE><A NAME="936395"><PRE>  fileid = </a>pfopen(namelen, namesx, &#146;w&#146;)
</PRE><A NAME="936396"><PRE>  if (fileid .eq. -1) then
</PRE><A NAME="936397"><PRE>     iplpderr = </a>pfgerr(nchr, pderr)
</PRE><A NAME="936398"><PRE>     call errproc(pderr, nchr, 0, 0)
</PRE><A NAME="936399"><PRE>  endif
</PRE><A NAME="936400"><PRE> 
</PRE><A NAME="936401"><PRE>  pim = 0
</PRE><A NAME="936402"><PRE> 
</PRE><A NAME="936403"><PRE> c ... loop over plots
</PRE><A NAME="936404"><PRE>  do ...
</PRE><A NAME="936405"><PRE> 
</PRE><A NAME="936406"><PRE> c ... setup domain
</PRE><A NAME="936407"><PRE>  dname = &lt;domain name&gt;
</PRE><A NAME="936408"><PRE>  dp(1) = &lt;length of domain name&gt;
</PRE><A NAME="936409"><PRE> 
</PRE><A NAME="936410"><PRE>  select case (dmnsn)
</PRE><A NAME="936411"><PRE>  case (&#146;d2r1&#146;)
</PRE><A NAME="936412"><PRE>     dp(2) = 2
</PRE><A NAME="936413"><PRE>     dp(3) = 2
</PRE><A NAME="936414"><PRE>     dp(4) = nr
</PRE><A NAME="936415"><PRE>     dp(5) = kmax
</PRE><A NAME="936416"><PRE>     dp(6) = lmax
</PRE><A NAME="936417"><PRE>     call zmovewrd(dm(1), x2d, nr)
</PRE><A NAME="936418"><PRE>     call zmovewrd(dm(nr+1), y2d, nr)
</PRE><A NAME="936419"><PRE>  case (&#146;d1r1&#146;)
</PRE><A NAME="936420"><PRE>     dp(2) = 1
</PRE><A NAME="936421"><PRE>     dp(3) = 1
</PRE><A NAME="936422"><PRE>     dp(4) = nr
</PRE><A NAME="936423"><PRE>     dp(5) = nr
</PRE><A NAME="936424"><PRE>     call zmovewrd(dm(1), &lt;domain data&gt;, nr)
</PRE><A NAME="936425"><PRE>  endselect
</PRE><A NAME="936426"><PRE> 
</PRE><A NAME="936427"><PRE>  if &lt;unique domain&gt; then
</PRE><A NAME="936428"><PRE>     ierr = </a>pfwset(fileid, dname, dp, dm)
</PRE><A NAME="936429"><PRE>     if (ierr.eq.0) then
</PRE><A NAME="936430"><PRE>        iplpderr = </a>pfgerr(nchr, pderr)
</PRE><A NAME="936431"><PRE>        call errproc(pderr, nchr, 0, 0)
</PRE><A NAME="936432"><PRE>     endif
</PRE><A NAME="936433"><PRE>  endif
</PRE><A NAME="936434"><PRE> 
</PRE><A NAME="936435"><PRE> c ... set up range
</PRE><A NAME="936436"><PRE>  rname = &lt;range name&gt;
</PRE><A NAME="936437"><PRE>  rp(1) = &lt;length of range name&gt;
</PRE><A NAME="936438"><PRE> 
</PRE><A NAME="936439"><PRE>  rp(2) = dp(2)
</PRE><A NAME="936440"><PRE>  rp(3) = 1
</PRE><A NAME="936441"><PRE>  rp(4) = nr
</PRE><A NAME="936442"><PRE>  rp(5) = dp(5)
</PRE><A NAME="936443"><PRE>  rp(6) = dp(6)
</PRE><A NAME="936444"><PRE>  call zmovewrd(rm(1), &lt;range data&gt;, nr)
</PRE><A NAME="936445"><PRE> 
</PRE><A NAME="936446"><PRE> c ... write out range
</PRE><A NAME="936447"><PRE>  ierr = </a>pfwran(fileid, dname, dp(1), rname, rp, rm, pim)
</PRE><A NAME="936448"><PRE>  if (ierr.eq.0) then
</PRE><A NAME="936449"><PRE>     </a>pfgerr(nchr, pderr)
</PRE><A NAME="936450"><PRE>     call errproc(pderr, nchr, 0, 0)
</PRE><A NAME="936451"><PRE>  endif
</PRE><A NAME="936452"><PRE>  pim = pim+1
</PRE><A NAME="936453"><PRE>  repeat
</PRE><A NAME="936454"><PRE> 
</PRE><A NAME="936455"><PRE> c ... close the file
</PRE><A NAME="936456"><PRE>  icloseok = </a>pfclos(fileid)
</PRE><A NAME="936457"><PRE>  if (icloseok.eq.0) then
</PRE><A NAME="936458"><PRE>     </a>pfgerr(nchr, pderr)
</PRE><A NAME="936459"><PRE>     call errproc(pderr, nchr, 0, 0)
</PRE><A NAME="936460"><PRE>  endif
</PRE><A NAME="936461"><PRE> 
</PRE><A NAME="936462"><PRE>  return
</PRE><A NAME="936463"><PRE>  end
</PRE><a name="936477">
<h1>10.0   Related </a>Documentation</h1>
</a>
<a name="932583">
PDBLib is one part of a collection of libraries called </a>PACT. PDBLib uses the </a>SCORE library in PACT for memory management, hash table, and string handling support. Interested readers should consult the SCORE manual as well as the PDBView manual, the ULTRA II manual, and the PANACEA manual for more information on how PDBLib is used.<p>
</a>
<a name="933048">
The list of </a>PACT documents is:<p>
</a>
<A NAME="933615"><PRE>   PACT User&#146;s Guide, UCRL-MA-112087
</PRE><A NAME="934299"><PRE>   SCORE User&#146;s Manual, UCRL-MA-108976 Rev.1
</PRE><A NAME="934300"><PRE>   PPC User&#146;s Manual UCRL-MA-108964 Rev.1
</PRE><A NAME="932596"><PRE>   PML User&#146;s Manual, UCRL-MA-108965 Rev.1
</PRE><A NAME="932597"><PRE>   PDBLib User&#146;s Manual, M-270 Rev.2 (this document)
</PRE><A NAME="932719"><PRE>   PGS User&#146;s Manual, UCRL-MA-108966 Rev.1
</PRE><A NAME="934304"><PRE>   PANACEA User&#146;s Manual, M-276 Rev.2
</PRE><A NAME="934305"><PRE>   ULTRA II User&#146;s Manual, UCRL-MA-108967 Rev.1
</PRE><A NAME="934306"><PRE>   PDBDiff User&#146;s Manual, UCRL-MA-108975 Rev.1
</PRE><A NAME="934307"><PRE>   PDBView User&#146;s Manual, UCRL-MA-108968 Rev.1
</PRE><A NAME="934308"><PRE>   SX User&#146;s Manual, UCRL-MA-112315
</PRE><a name="932582">
<p>
</a>

<p><hr>

</body></html>