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
//! # DAS Required Reading
//!
//! Last revised on 2021 DEC 31 by B. V. Semenov.
//!
//!
//!
//!
//!
//! ## Abstract
//!
//! The "Direct Access Segregated" (DAS) SPICE file architecture stores
//! arrays of integer, double precision, and character data. SPICE DSK, EK
//! and DBK files, and type 1 star catalogs use the DAS architecture and
//! associated software.
//!
//!
//!
//!
//!
//! ## Notes for Fortran Users
//!
//! This document currently discusses only the Fortran version of the SPICE
//! DAS subsystem.
//!
//! For a given platform, DAS files used by the Fortran, C, IDL, and MATLAB
//! SPICE Toolkits are identical.
//!
//!
//!
//!
//!
//! ## Intended audience
//!
//! This document is intended for SPICE users who need to use lower-level,
//! segment-oriented Digital Shape Kernel (DSK) interface routines. It is
//! also for sophisticated SPICE users who wish to create their own
//! DAS-based file formats. Users of SPICE kernels based on the DAS format
//! can find documentation for those kernels in the Required Reading for the
//! appropriate kernel type.
//!
//!
//!
//!
//!
//! ## Related Documents
//!
//! The following documents pertinent to DAS usage are included in the SPICE
//! Toolkit:
//!
//!
//!
//! * DLA Required Reading ([dla.req](crate::required_reading::dla))
//!
//! * Convert User's Guide ([convert.ug](crate::raw::convert.ug))
//!
//! * COMMNT User's Guide ([commnt.ug](crate::raw::commnt.ug))
//!
//!
//! ## Introduction
//!
//! The SPICELIB "DAS" subsystem consists of a Fortran 77 direct access
//! file architecture and a set of subroutines that make it convenient to
//! create, read, annotate, and transport files having this architecture.
//!
//! The purpose of the DAS subsystem is to provide SPICELIB users with a
//! simple way to create and efficiently use their own portable, high-level,
//! binary, direct access file formats. The DAS architecture is meant to
//! serve as a foundation for these high-level formats, providing services
//! and capabilities required by all of them.
//!
//! The principal advantage of building a new file format based on DAS is
//! that most of the new access routines---the new code needed to support
//! reading, writing, and porting files having the new format---can be built
//! out of DAS routines. Thus a great deal of the design, coding,
//! documentation and testing that accompanies the development of new access
//! routines is automatically eliminated. In addition, because files
//! conforming to the new format are also DAS files, they inherit the
//! features common to all DAS files:
//!
//!
//!
//! * Direct file access
//!
//! * Simple interface---data is referenced by "logical address"
//!
//! * Support for character, double precision, and integer data types
//!
//! * Built-in portability
//!
//! * Built-in file annotation capability
//!
//! * System-independent I/O buffering
//!
//! The acronym "DAS" stands for "direct access, segregated." The DAS
//! subsystem enables application programs to view data in a DAS file as
//! though the data were segregated into three separate, possibly empty,
//! one-dimensional arrays: one of integers, one of double precision
//! numbers, and one of characters. Each element of these virtual arrays is
//! pointed to by an integer known as a "logical address." The logical
//! addresses for each data type are independent: for each data type, the
//! range of logical addresses starts at 1 and ends with the count of scalar
//! data elements of that type. Thus an application program can, by calling
//! DAS interface routines, read the "100th through 200th integers" or
//! "first through 3000th characters" from a DAS file.
//!
//! This simple view of the organization of data within a DAS file is
//! independent of the order in which data are written to the file when it
//! is created: double precision numbers, integers, and characters can be
//! written to the file in an interleaved fashion, but the data of each type
//! will still appear to be contiguous to a program reading the file.
//!
//! The DAS suite of routines includes routines that convert DAS files
//! between binary and transfer formats. DAS files in transfer format can be
//! easily ported between computer systems having different binary numeric
//! and character data representations. The SPICE Toolkit's TOBIN, TOXFR,
//! and SPACIT utilities allow users to carry out these conversions via
//! command-line or menu-based programs. Therefore, any high-level file
//! format based on DAS can be ported using existing SPICE utilities.
//!
//! The task of adding annotation, sometimes called "comments" or
//! "metadata," to data files is also solved by using the DAS format. The
//! SPICE Toolkit's COMMNT utility can insert annotation into, or extract
//! annotation from, any DAS file, so this capability is automatically
//! available for any files having a format based on DAS.
//!
//! Because speed of file access can be important for programs that use
//! large files, the DAS subsystem buffers in memory data that it reads from
//! or writes to a DAS file. This buffering operation is completely
//! independent of the I/O mechanism of the computer system on which a
//! DAS-based application program runs. User-written access routines for any
//! file format based on DAS will automatically support I/O buffering simply
//! by calling DAS routines to carry out their I/O operations.
//!
//!
//!
//!
//!
//! # DAS Concepts
//!
//!
//!
//!
//!
//! ## Logical Addresses
//!
//! The DAS subsystem makes a DAS file look to an application program as
//! though the data in the file were segregated into three virtual arrays,
//! one each of character, integer, and double precision type. Any or all of
//! these arrays may be empty. In DAS terminology, each element of any of
//! these "logical" arrays is called a "word." The phrases "integer
//! word," "character word," and "double precision word" are used when
//! specific data types are of interest. Character words are single
//! characters.
//!
//! The DAS logical address of a given word is the index of that word within
//! its virtual array. When necessary to avoid ambiguity, we'll use the
//! phrases "integer logical address," "double precision logical
//! address," or "character logical address" to denote logical addresses
//! of words of each data type. Logical addresses themselves, wherever
//! they're used in DAS routines, are represented by integers.
//!
//! The valid range of indices for each non-empty virtual array starts at 1
//! and ends at the word count for that array. There are no "holes" in the
//! arrays; every logical address in the valid range for an array points to
//! data. This property of the virtual arrays is enforced by the mechanism
//! by which DAS files are populated with data: data may be placed in a
//! virtual array either by appending or by updating a range of valid
//! logical addresses. Random write access to array addresses outside of the
//! valid range is not supported.
//!
//! The word counts for each logical array can be obtained via the routine
//! [DASLLA](crate::raw::daslla) ("DAS, last logical addresses").
//!
//! The ordering of the data within each virtual array is controlled by the
//! order in which data are appended to that array. Each append operation
//! adds the contents of an array in memory to the DAS virtual array of the
//! same data type. An append operation appends the elements of the array in
//! memory, preserving order, to a contiguous range of logical addresses,
//! starting with the successor of the highest logical address already
//! occupied in the virtual array. In the case of arrays of strings, the
//! order of characters within an array increases from left to right, and
//! all characters within an array element precede those belonging to any
//! higher-indexed element.
//!
//!
//!
//!
//!
//! ## Read and Write Access
//!
//! The DAS subsystem provides a measure of system-independent protection
//! for files that are intended to be accessed in a "read only" fashion. A
//! program can open a DAS file for "read access" or "write access";
//! when a DAS file is opened for read access, it cannot be modified by the
//! DAS routines. A DAS file opened for write access can be read as well as
//! written.
//!
//! A program selects the access type of a DAS file by opening it with a
//! call to the appropriate DAS routine: DASOPR opens files for read access;
//! DASOPW opens existing DAS files for write access; and DASONW opens a new
//! DAS file for write access. The routine DASOPS opens a new scratch DAS
//! file for write access.
//!
//! "Opening" a DAS file via one of the DAS file opening routines makes
//! the file available for I/O, but the file is not necessarily physically
//! opened from the perspective of the host file system. SPICE manages DAS
//! files opened by any of these routines so the files behave as though
//! they're physically open, as far as user application software is
//! concerned.
//!
//! For convenience, we still use the term "open" to refer to a DAS file
//! that has been made available for read or write access by a call to a DAS
//! file open routine.
//!
//! A program is allowed to open a DAS file for read access multiple times
//! during a single run, but once a file is opened for write access, any
//! subsequent attempts to open it before it has been closed again cause an
//! error to be signaled.
//!
//! The file access restrictions imposed by the DAS subsystem do not pertain
//! to access of a single DAS file by multiple programs. Limitations on this
//! type of file access are system-dependent. However, NAIF recommends
//! avoiding arrangements involving access by multiple programs to a DAS
//! file that has been opened for writing by any one of them.
//!
//!
//!
//!
//!
//! ### Access to Non-Native DAS Files
//!
//! As of the N0066 version of the SPICE Toolkit, the DAS subsystem supports
//! reading DAS files having certain non-native binary file formats: IEEE
//! big-endian DAS files can be read on IEEE little-endian host systems, and
//! vice versa. This capability involves run-time translation of numeric
//! data.
//!
//! Reading non-native DAS files may be substantially slower than reading
//! native files; the performance cost of run-time translation depends in
//! part on the fraction of read operations that reference buffered data.
//!
//! Writing non-native DAS files is not supported. Non-native DAS files must
//! be converted to native format in order to update or add to their data,
//! or to modify their comment areas. See the Convert User's Guide
//! ([convert.ug](crate::raw::convert.ug)) or the BINGO User's Guide for details.
//!
//!
//!
//!
//!
//! ## File Handles
//!
//! DAS routines that open DAS files return an integer argument called a
//! "file handle." Most DAS routines use file handles rather than file
//! names or Fortran logical units to specify DAS files. File handles can be
//! compared more reliably and quickly than file names. Unlike logical
//! units, the characteristics of DAS file handles are system-independent.
//!
//! There is a one-to-one correspondence between file handles and DAS files
//! that are known to a program. In particular, when a DAS file is opened
//! for read access multiple times during a single program run, the same
//! handle is returned each time.
//!
//! The DAS subsystem does not recycle handles: once a file handle is
//! assigned to a file, that integer will not be assigned to a different
//! file during the same program run, even if the file to which the handle
//! was assigned has been closed. At any time, a list of handles of open DAS
//! files can be obtained by calling the DAS utility DASHOF.
//!
//!
//!
//!
//!
//! ## The DAS Comment Area
//!
//! The DAS file architecture supports a data structure called the "comment
//! area." This feature allows DAS files to store free-form text comments,
//! also known as metadata. Comments may be labels or other descriptive text
//! that fully identifies the file and indicates its intended purpose.
//!
//! The contents of the comment area must be printable text. The comment
//! area is line-oriented; text inserted into the comment area can be
//! retrieved with the original line breaks preserved.
//!
//! The DAS file architecture itself imposes no limits on lengths of comment
//! lines. However, one of the SPICE Toolkit DAS comment area writer
//! routines, [DASACU](crate::raw::dasacu), does have a 255 character limit. In general, as the
//! length of comment lines increases, the portability of the formatting of
//! the comment text decreases. Limiting comment line lengths to 80
//! characters, and avoiding use of tab characters, enhances the probability
//! that comments will appear as intended when displayed.
//!
//!
//!
//!
//!
//! ## Internal File Names
//!
//! The DAS file format allows a 60-character string called an "internal
//! file name" to be stored in a DAS file. Normally, this string is placed
//! in the file when the file is created. The name may be retrieved at any
//! time by calling [DASRFR](crate::raw::dasrfr).
//!
//! The internal file name provides a mechanism for attaching an identifier
//! to a DAS file in a manner independent of the file system on which the
//! DAS file was created.
//!
//! The internal file name capability existed before the DAS comment area
//! feature was developed; the comment area provides much greater
//! flexibility in annotating DAS files. NAIF suggests the comment area,
//! rather than the internal file name, be used for system-independent file
//! identification.
//!
//!
//!
//!
//!
//! ## Binary and Transfer DAS files
//!
//! The DAS subsystem provides routines that convert a binary DAS file to an
//! equivalent transfer file, as well as routines that perform the inverse
//! conversion. These routines can be used when it is necessary to move DAS
//! files between platforms having incompatible binary architectures, and
//! when run-time translation is not adequate because the files must be
//! writable or efficiently readable on the target platform. In theory, it
//! could also be the case that there are pairs of platforms for which
//! run-time translation cannot be performed; this situation has existed in
//! the past, but does not currently exist at the time of release of the
//! N0066 SPICE Toolkit.
//!
//! No SPICELIB routines other than the DAS conversion routines themselves
//! depend on the DAS transfer format, and this format is not considered
//! part of the DAS subsystem specification. Non-SPICELIB applications
//! should avoid reliance on the specific format of DAS transfer files; this
//! format may be updated by NAIF, though any previous transfer formats will
//! continue to be supported.
//!
//! The transfer format has the property of preserving all of the character,
//! double precision, and integer information in the virtual arrays of DAS
//! files; in particular, the full precision of all numeric quantities is
//! preserved when a binary DAS file is converted to transfer format and
//! then back to binary format on the same computer.
//!
//!
//!
//!
//!
//! ## Buffering
//!
//! When the DAS subsystem reads a physical record from a DAS file, or when
//! it writes a physical record, a copy of the data in that record is saved
//! in memory. We call this "buffering" the record. The subsystem buffers
//! a limited number of the most recently accessed records of each data
//! type.
//!
//! Because the DAS subsystem buffers records, successive reads from or
//! writes to the same record are generally more efficient than they would
//! be if file I/O were performed in response to each read or write request.
//! Because the DAS subsystem uses its own declared storage for buffering,
//! this capability is guaranteed to be supported, regardless of the I/O
//! buffering capabilities of the computer system on which the DAS subsystem
//! is used.
//!
//! The buffering performed by the DAS subsystem is automatic, and the
//! existence of this feature can normally be safely ignored. The cases
//! where it must be taken into account are:
//!
//!
//!
//! * When the creation of a DAS file terminates abnormally
//!
//! * When DAS file access speed must be optimized
//!
//! In the first case, the contents of the DAS file may not contain all of
//! the data "written" to the file by the DAS writing routines (DASADx and
//! DASUDx), because some of that data may have been buffered but not
//! written at the time the file creation was terminated.
//!
//! In the second case, adjusting the sizes of the buffer arrays in [DASRWR](crate::raw::dasrwr)
//! may improve performance. The sizes of the arrays are parameterized, so
//! it is easy to change them. However, modifying SPICELIB code can create a
//! maintenance burden for the owner of the modified code, because in order
//! to accept a SPICELIB update (which could contain bug fixes), it will be
//! necessary to modify the new versions of any previously modified SPICELIB
//! routines.
//!
//!
//!
//!
//!
//! ## Using Multiple DAS Files Concurrently
//!
//! SPICE limits the total number of concurrently open DAS and DAF files to
//! 5000.
//!
//! Accessing multiple DAS files concurrently may affect a program's speed
//! of execution, since all of the files compete for the same space in the
//! DAS record buffers.
//!
//!
//!
//!
//!
//! ## DAS vs DAF
//!
//! The DAS subsystem is, roughly speaking, a generalization of the DAF
//! subsystem, since DAS supports storage of integer and character data as
//! well as double precision data, whereas the DAF subsystem supports
//! storage of double precision data only. The DAF format can easily be
//! "simulated" using a DAS file.
//!
//! On the other hand, the DAF subsystem provides higher-level services that
//! are not built into DAS: in the DAF subsystem, the data are partitioned
//! into a linked list of virtual arrays, each one having its own name and
//! descriptor, and the subsystem provides routines to manipulate the arrays
//! and their descriptive information.
//!
//! As of the N0066 version of the SPICE Toolkit, a virtual array capability
//! for DAS files is provided by the SPICE DLA subsystem. The DLA file
//! format is a special case of the DAS format. DLA files enable user
//! application software to view the data in a DAS file as a doubly linked
//! list of virtual arrays, also called "segments," where each segment may
//! have character, double precision, and integer components. See the DLA
//! Required Reading, [dla.req](crate::required_reading::dla), for details.
//!
//!
//!
//!
//!
//! # Using the DAS Subsystem
//!
//! This chapter explains how to use the DAS subsystem in your own
//! application program. The preceding chapter, "DAS Concepts," contains
//! prerequisite information for the following discussion.
//!
//! In the code examples shown in this chapter, we'll display a brief phrase
//! describing the function of each DAS routine that appears in the code, as
//! shown below:
//!
//!
//!
//! ```text
//! CALL DASCLS ( HANDLE ) {Close DAS file}
//! ```
//!
//!
//! ## Creating a New DAS File
//!
//! New DAS files are created by calling DASONW:
//!
//!
//!
//! ```text
//! CALL DASOPN ( FNAME, FTYPE, IFNAME, NCOMR, HANDLE )
//!
//! {Open new DAS file}
//! ```
//!
//! Here FNAME, FTYPE, IFNAME and NCOMR are inputs, and HANDLE is an output.
//! FNAME is the name of the new file to be created, IFNAME is the internal
//! file name of the new file, and NCOMR is the number of comment records to
//! reserve. HANDLE is the integer handle assigned to the DAS file by
//! DASOPN.
//!
//! After this call, the DAS file is ready to be populated with data.
//!
//!
//!
//!
//!
//! ## Writing DAS Files
//!
//! There are two ways to write data to a DAS file: data can be added to the
//! file by appending it to the virtual arrays, and data already in the
//! virtual arrays can be updated.
//!
//! The routines [DASADC](crate::raw::dasadc), [DASADD](crate::raw::dasadd), and [DASADI](crate::raw::dasadi) are used to add data to DAS
//! files. These routines append data to the file's character, double
//! precision, or integer logical arrays. As an example, we'll add some data
//! of each type to the file FNAME from the example above. We'll start out
//! with integer data.
//!
//! [DASADI](crate::raw::dasadi) adds the contents of an integer array to a DAS file. In the call
//! below, the argument HANDLE identifies the file, the number 100 is the
//! number of elements in the data array, and DATAI is an array of integers
//! whose contents are to be appended to the file's integer virtual array.
//!
//!
//!
//! ```text
//! DO I = 1, 100
//! DATAI(I) = I
//! END DO
//!
//! CALL DASADI ( HANDLE, 100, DATAI ) {Add data, integer}
//! ```
//!
//! [DASADD](crate::raw::dasadd) is the double precision analog of [DASADI](crate::raw::dasadi). Since the logical
//! arrays of different data types are independent, the double precision
//! data from the array DATAD will occupy double precision logical addresses
//! 1 through 100.
//!
//!
//!
//! ```text
//! DO I = 1, 100
//! DATAD(I) = DBLE(I)
//! END DO
//!
//! CALL DASADD ( HANDLE, 100, DATAD ) {Add data, double precision}
//! ```
//!
//! [DASADC](crate::raw::dasadc) is the character analog of [DASADI](crate::raw::dasadi). The second argument to DASADC
//! indicates the total number of character logical addresses to be filled. [DASADC](crate::raw::dasadc) has two additional input arguments that DASADI and [DASADD](crate::raw::dasadd) do not
//! have: begin and end substring bounds that indicate from which portion of
//! the array of input strings to transfer data.
//!
//! In this case, we'll presume that the array DATAC is declared
//!
//!
//!
//! ```text
//! CHARACTER*(80) DATAC ( 2 )
//! ```
//!
//! ```text
//! DATAC(1) = 'Here''s the first line of character data.'
//! DATAC(2) = 'And here''s the second line.'
//! ```
//! The call below will write the contents of elements 1:2 of DATAC to DAS
//! logical character addresses 1:160, because all of the characters of each
//! element of DATAC are written to the file.
//!
//!
//!
//! ```text
//! CALL DASADC ( HANDLE, 160, 1, 80, DATAC ) {Add data, character}
//! ```
//!
//! If we don't wish to write out all 80 characters of each element of
//! DATAC, we can use different substring bounds in the call to [DASADC](crate::raw::dasadc). As
//! an example, we'll add two more lines to the file, this time using only
//! characters 1 through 50 in each element of DATAC:
//!
//!
//!
//! ```text
//! DATAC(1) = 'This is the third line.'
//! DATAC(2) = 'This is the fourth line.'
//!
//! CALL DASADC ( HANDLE, 100, 1, 50, DATAC ) {Add data, character}
//! ```
//!
//! This call added only 100 characters to the file.
//!
//! We can continue to add data of any type to the file at this point. As an
//! example, we'll add 100 more integers to the file.
//!
//!
//!
//! ```text
//! DO I = 1, 100
//! DATAI(I) = I + 100
//! END DO
//!
//! CALL DASADI ( HANDLE, 100, DATAI ) {Add data, integer}
//! ```
//!
//! In addition to appending data to the virtual arrays in a DAS file, you
//! can update array elements whose values have already been set. The DAS
//! update routines are [DASUDC](crate::raw::dasudc), [DASUDD](crate::raw::dasudd), and [DASUDI](crate::raw::dasudi), which accept input
//! arrays of character strings, double precision numbers, and integers,
//! respectively.
//!
//! It is not always convenient to set the values of the elements of a DAS
//! file's virtual arrays in strictly increasing order; using the update
//! capability, a program can fill in array elements with placeholder
//! values, then update those values when their actual values are known.
//!
//! To continue the example, we could update the first 100 integers in the
//! file by negating them:
//!
//!
//!
//! ```text
//! DO I = 1, 100
//! DATA(I) = -I
//! END DO
//!
//! CALL DASUDI ( HANDLE, 1, 100, DATA ) {Update data,
//! integer}
//! ```
//!
//! The routines [DASUDD](crate::raw::dasudd) and [DASUDC](crate::raw::dasudc) update double precision and character
//! data in an analogous way.
//!
//! To complete the new DAS file we've created, we close it using the
//! routine [DASCLS](crate::raw::dascls):
//!
//!
//!
//! ```text
//! CALL DASCLS ( HANDLE ) {Close DAS file}
//! ```
//!
//! DAS files should never be closed directly by a Fortran CLOSE statement.
//! In particular, DAS files that have been written to may not contain all
//! of the data written unless [DASCLS](crate::raw::dascls) is used to close them.
//!
//! At this point, the virtual arrays in our example DAS file have the
//! following contents:
//!
//!
//!
//! ```text
//! Integer virtual array
//! ---------------------
//!
//! +-----+
//! Integer logical address #1 | -1 |
//! +-----+
//! .
//! .
//! .
//! +-----+
//! Integer logical address #100 |-100 |
//! +-----+
//! Integer logical address #101 | 101 |
//! +-----+
//! .
//! .
//! .
//! +-----+
//! Integer logical address #200 | 200 |
//! +-----+
//!
//! ```
//!
//! ```text
//! Double precision virtual array
//! ------------------------------
//!
//! +-----+
//! Double precision logical address #1 |1.D0 |
//! +-----+
//! .
//! .
//! .
//! +-----+
//! Double precision logical address #100 |1.D2 |
//! +-----+
//! ```
//! ```text
//! Character virtual array
//! -----------------------
//!
//! +---+
//! Character logical address #1 | H |
//! +---+
//! | e |
//! +---+
//! | r |
//! +---+
//! | e |
//! +---+
//! | ' |
//! +---+
//! | s |
//! +---+
//! .
//! .
//! .
//! +---+
//! Character logical address #80 | |
//! +---+
//! Character logical address #81 | A |
//! +---+
//! | n |
//! +---+
//! | d |
//! +---+
//! .
//! .
//! .
//! +---+
//! Character logical address #160 | |
//! +---+
//! Character logical address #161 | T |
//! +---+
//! | h |
//! +---+
//! | i |
//! +---+
//! | s |
//! +---+
//! .
//! .
//! .
//! +---+
//! Character logical address #210 | |
//! +---+
//! Character logical address #211 | T |
//! +---+
//! | h |
//! +---+
//! | i |
//! +---+
//! | s |
//! +---+
//! .
//! .
//! .
//! +---+
//! Character logical address #260 | |
//! +---+
//!
//! ```
//!
//! ## Writing to an Existing DAS file
//!
//! The DASADx and DASUDx routines described above can be used to write to
//! an old DAS file (one that contains data and is not currently open), as
//! well as to a newly created one. To write to an old DAS file, open it for
//! writing using DASOPW:
//!
//!
//!
//! ```text
//! CALL DASOPW ( FNAME, HANDLE ) {Open DAS file for
//! writing}
//! ```
//!
//! After this call, the DASADx and DASUDx routines can be used to add data
//! to the file and update data in the file.
//!
//! When the modification of the DAS file is complete, the file should be
//! closed using [DASCLS](crate::raw::dascls).
//!
//!
//!
//!
//!
//! ## Reading DAS Files
//!
//! The DAS reading routines are [DASRDC](crate::raw::dasrdc), [DASRDD](crate::raw::dasrdd), and [DASRDI](crate::raw::dasrdi). Each of these
//! routines reads data from a range of logical addresses. These routines
//! can read from a DAS file that is open for reading or writing.
//!
//! We'll continue our example by showing the results of reading the file we
//! created.
//!
//! We start out by reading a range of integer addresses. After the
//! following sequence of calls, the array DATAI will contain the integers
//! 101 through 200.
//!
//!
//!
//! ```text
//! CALL DASOPR ( FNAME, HANDLE ) {Open DAS file for reading}
//!
//! CALL DASRDI ( HANDLE, 101, 200, DATAI ) {Read data, integer}
//! ```
//!
//! The following call will fill the array DATAI with the integers -1
//! through -100:
//!
//!
//!
//! ```text
//! CALL DASRDI ( HANDLE, 1, 100, DATAI ) {Read data, integer}
//! ```
//!
//! We can retrieve the double precision data from the file using [DASRDD](crate::raw::dasrdd).
//! The following call will fill the array DATAD with the values 1.D0
//! through 1.D2:
//!
//!
//!
//! ```text
//! CALL DASRDD ( HANDLE, 1, 100, DATAD ) {Read data, double
//! precision}
//! ```
//!
//! Now for the character data: we'll read the data written by [DASADC](crate::raw::dasadc) using [DASRDC](crate::raw::dasrdc). After the call
//!
//!
//!
//! ```text
//! CALL DASRDC ( HANDLE, 1, 160, 1, 80, DATAC ) {Read data, character}
//! ```
//!
//! the array DATAC (whose elements have a length of 80 characters) will
//! contain the lines
//!
//!
//!
//! ```text
//! DATAC(1) = 'Here''s the first line of character data.'
//! DATAC(2) = 'And here''s the second line.'
//! ```
//!
//! Both elements of DATAC will be padded with trailing blanks.
//!
//! A second call
//!
//!
//!
//! ```text
//! CALL DASRDC ( HANDLE, 161, 260, 1, 50, DATAC )
//! ```
//!
//! will make the substring assignments
//!
//!
//!
//! ```text
//! DATAC(1)(1:50) = 'This is the third line.'
//! DATAC(2)(1:50) = 'This is the fourth line.'
//! ```
//!
//! The character substrings DATAC(1)(51:80) and DATAC(2)(51:80) are left
//! unchanged by this call.
//!
//!
//!
//!
//!
//! ## Converting Between Binary and Transfer Format
//!
//! The DAS subsystem contains two routines that convert between DAS binary
//! and transfer format. These are:
//!
//!
//!
//! ```text
//! DASBT
//! DASTB
//! ```
//!
//! [DASBT](crate::raw::dasbt) converts a binary DAS file to transfer format.
//!
//!
//!
//! ```text
//! CALL DASBT ( DAS, XFRLUN ) {Convert DAS to transfer file}
//!
//! ```
//!
//! .
//!
//! [DASTB](crate::raw::dastb) is the inverse of this routine.
//!
//!
//!
//! ```text
//! CALL DASTB( XFRLUN, DAS ) {Convert transfer file to DAS}
//!
//! ```
//!
//! Since the SPICE Toolkit utility programs TOBIN and TOXFR are able to
//! convert between binary and transfer DAS formats, SPICE Toolkit users
//! should rarely need to make direct use of these conversion routines.
//!
//!
//!
//!
//!
//! ## Annotating DAS Files
//!
//! The comment area of a DAS file may be used to store comments, also known
//! as metadata, in an encoded form. This capability is supported by the
//! SPICELIB routines
//!
//!
//!
//! * [DASAC](crate::raw::dasac)
//!
//!
//! Add comments to comment area.
//!
//! * [DASDC](crate::raw::dasdc)
//!
//!
//! Delete comments from comment area.
//!
//! * [DASEC](crate::raw::dasec)
//!
//!
//! Extract comments from comment area to a character array.
//!
//! Normally, SPICELIB users will not need to manipulate the comment area
//! using DAS API routines; the basic functionality of storing comments in a
//! DAS file and extracting stored comments is provided by the SPICE Toolkit
//! utility COMMNT. See the COMMNT user's guide, [commnt.ug](crate::raw::commnt.ug), for details.
//!
//!
//!
//!
//!
//! ## Mapping Between Handles, File Names, and Units
//!
//! Given a valid DAS handle, the corresponding file name and Fortran
//! logical unit can be found by calling the appropriate DAS routine:
//!
//!
//!
//! ```text
//! CALL DASHFN ( HANDLE, FNAME ) { Handle to file name }
//! CALL DASHLU ( HANDLE, UNIT ) { Handle to logical unit }
//! ```
//!
//! For completeness, the inverse mapping routines are supplied:
//!
//!
//!
//! ```text
//! CALL DASFNH ( FNAME, HANDLE ) { File name to handle }
//! CALL DASLUH ( UNIT, HANDLE ) { Logical unit to handle }
//! ```
//!
//!
//! ## Obtaining a DAS File Summary
//!
//! Occasionally, an application program may need to know the range of
//! logical addresses in use within a DAS file. This information can be
//! obtained from the file's summary, which is returned by DASHFS:
//!
//!
//!
//! ```text
//! CALL DASHFS ( HANDLE, NRESV, FREE, LASTLA, LASTRC, LASTWD )
//!
//! { Handle to file summary }
//! ```
//!
//! The desired information is in the output argument LASTLA, which is an
//! array of the last logical addresses of character, double precision, and
//! integer types, in that order. Given only this information, a program can
//! read the contents of the file by using the DASRDx routines.
//!
//! The other arguments of DASHFS will probably be of interest only to
//! programmers creating new DAS subroutines. See the header of DASHFS for
//! further information.
//!
//!
//!
//!
//!
//! ## Using Scratch DAS Files
//!
//! DAS files can be opened with a Fortran status of 'SCRATCH'. Scratch DAS
//! files are always opened for write access. When they are closed, they are
//! automatically deleted.
//!
//! To obtain a scratch DAS file, use the routine DASOPS:
//!
//!
//!
//! ```text
//! CALL DASOPS ( HANDLE ) { Open scratch DAS file }
//! ```
//!
//! Here HANDLE is an output argument. DASOPS does not take a file name
//! input argument because ANSI Standard Fortran 77 does not allow
//! assignment of file names to scratch files. Since the file is temporary,
//! there is no need to give it an internal file name or to reserve records
//! in it.
//!
//! As with any other DAS file, scratch DAS files should be closed by
//! calling [DASCLS](crate::raw::dascls).
//!
//! Application programs that need large amounts of temporary work space and
//! that must be able to access that work space randomly can take advantage
//! of the DAS subsystem: scratch DAS files are direct access files, provide
//! buffered read and write access, and have the same simple interface as do
//! permanent DAS files.
//!
//!
//!
//!
//!
//! # DAS Architecture
//!
//! The information in this section is provided for the sake of
//! completeness; most SPICELIB users, including those designing their own
//! DAS-based formats, will not need to know the details of the DAS
//! architecture. NAIF strongly recommends that SPICELIB-based application
//! programs access DAS files only through SPICELIB DAS access routines,
//! which make the DAS format transparent to the calling program.
//!
//!
//!
//!
//!
//! ## Overview of DAS Architecture
//!
//! DAS files are Fortran direct access files having a record length long
//! enough so that NWD double precision numbers, NWI integers, or NWC
//! characters can fit in a single record. The values of these parameters
//! are:
//!
//!
//!
//! ```text
//! NWC = 1024
//! NWD = 128
//! NWI = 256
//! ```
//!
//! Each record in a DAS file is dedicated to a specific purpose; records
//! either contain data or control information that describes the structure
//! and contents of the file. The types of records are:
//!
//!
//!
//! * File records
//!
//! * Comment records
//!
//! * Directory records
//!
//! * Character data records
//!
//! * Double precision data records
//!
//! * Integer data records
//!
//! As the above list implies, each data record contains data of only one
//! type.
//!
//! Every DAS file contains one file record, which is always the first
//! record of the DAS file. Comment records are optional. All DAS files
//! contain at least one directory record, and useful DAS files also contain
//! at least one data record.
//!
//! The diagram below shows how records of different types are grouped
//! within a general binary DAS file. The parenthesized numbers at the right
//! indicate the number of records within the named group on the left.
//!
//!
//!
//! ```text
//! +------------------------+
//! | file record | ( 1 )
//! +------------------------+
//! | reserved records | ( NRESVR )
//! +------------------------+
//! | |
//! | |
//! | comment records | ( NCOMR )
//! | |
//! | |
//! +------------------------+
//! | first data directory | ( 1 )
//! +------------------------+
//! | data records |
//! | | ( variable )
//! | |
//! +------------------------+
//! .
//! .
//! .
//! +------------------------+
//! | last data directory | ( 1 )
//! +------------------------+
//! | data records |
//! | | ( variable )
//! | |
//! +------------------------+
//! ```
//!
//! Normally, when a new DAS file is closed, the data records are segregated
//! into contiguous sets of records of each data type present in the file.
//! The format of a DAS file after this re-organization is shown below:
//!
//!
//!
//! ```text
//! +------------------------+
//! | file record | ( 1 )
//! +------------------------+
//! | reserved records | ( variable )
//! +------------------------+
//! | comment records |
//! | | ( variable )
//! | |
//! +------------------------+
//! | first data directory | ( 1 )
//! +------------------------+
//! | character data records |
//! | | ( variable )
//! | |
//! +------------------------+
//! | d.p. data records |
//! | | ( variable )
//! | |
//! +------------------------+
//! | integer data records |
//! | | ( variable )
//! | |
//! +------------------------+
//! ```
//!
//! The purpose of the re-organization is to simplify the process of mapping
//! logical addresses to physical locations in the file, thereby speeding up
//! access to data.
//!
//! Note that the structure of the re-organized DAS file is just a special
//! case of the general structure. All of the DAS routines that make
//! explicit use of the structure of DAS files are equipped to work with the
//! general structure: it is never assumed that data segregation has taken
//! place.
//!
//!
//!
//!
//!
//! ## The File Record
//!
//! The file record contains the following information about the DAS file
//! containing it:
//!
//!
//!
//! * An ID word
//!
//! * The internal file name
//!
//! * The reserved record count
//!
//! * The reserved character count
//!
//! * The comment record count
//!
//! * The comment character count
//!
//! * The binary file format identification string
//!
//! * The FTP error detection string
//!
//! The ID word is a character string that identifies the file as a DAS
//! file, as opposed to a DAF or some other type of file. The ID word
//! contains eight characters, the first four of which are
//!
//!
//!
//! ```text
//! DAS/
//! ```
//!
//! The contents of the file record are organized as follows:
//!
//!
//!
//! ```text
//! +-----------------------------------------------------+
//! |IDWORD|IFNAME|NRR|NRC|NCR|NCC|BFF|<nulls>|FTP|<nulls>|
//! +-----------------------------------------------------+
//! ```
//!
//! where the abbreviations represent:
//!
//!
//!
//! * IDWORD
//!
//!
//! is the DAS ID word.
//!
//! * IFNAME
//!
//!
//! is the internal file name.
//!
//! * NRR
//!
//!
//! is the number of reserved records.
//!
//! * NRC
//!
//!
//! is the number of reserved characters---the number of characters in use
//! in the reserved record area.
//!
//! * NCR
//!
//!
//! is the number of comment records.
//!
//! * NCC
//!
//!
//! is the number of comment characters---the number of characters in use
//! in the comment area.
//!
//! * BFF
//!
//!
//! is the binary file format identifier.
//!
//! * FTP
//!
//!
//! is the FTP error detection string.
//!
//! The file record can be read and updated at run time using [DASRFR](crate::raw::dasrfr) and [DASWFR](crate::raw::daswfr). [DASRFR](crate::raw::dasrfr) is normally used to read the internal file name of a DAS
//! file. On the other hand, non-SPICELIB code should rarely, if ever, need
//! to update the file record.
//!
//!
//!
//!
//!
//! ## Reserved Records
//!
//! The reserved record area is a data structure that serves as a hook for
//! future development. SPICE users normally will have no reason to access
//! reserved records, and indeed the DAS API supplies no access methods for
//! these records.
//!
//! Reserved records play no role in DAS operations, but their number must
//! be known by the DAS subsystem. The number is set when a DAS file is
//! created, and is automatically updated at run time if reserved records
//! are added by calling DASARR.
//!
//!
//!
//!
//!
//! ## Comment Records
//!
//! Comment records are character records that constitute the DAS comment
//! area.
//!
//!
//!
//!
//!
//! ## Directory Records
//!
//! Directory records, or "directories," are records that allow the DAS
//! subsystem to find the physical location in a DAS file corresponding to a
//! specified logical address.
//!
//! Each directory record describes the data types of a number of data
//! records that follow. Each directory also contains, for each data type,
//! the lowest and highest logical address occurring in any of the records
//! described by the directory.
//!
//! The directories in a DAS file form a doubly linked list: each directory
//! contains forward and backward pointers to the next and previous
//! directories. Thus the list of directory records in a DAS can be viewed
//! as shown below:
//!
//!
//!
//! ```text
//! NIL
//! ^ +---------------------------------------------------+
//! | | |
//! `-----| |
//! | First Directory Record |
//! .---->| |
//! | .--| |
//! | | +---------------------------------------------------+
//! | | .
//! | | .
//! | | .
//! | | +---------------------------------------------------+
//! | `->| |
//! `-----| |
//! | Second Directory Record |
//! .---->| |
//! | .--| |
//! | | +---------------------------------------------------+
//! | |
//!
//! . . .
//! . . .
//! . . .
//!
//! | |
//! | | +---------------------------------------------------+
//! | `->| |
//! `-----| |
//! | Last Directory Record |
//! | |
//! .--| |
//! | +---------------------------------------------------+
//! V
//! NIL
//! ```
//!
//! After data segregation, the list of directories contains a single
//! record.
//!
//! The structure of each directory record is as follows:
//!
//!
//!
//! ```text
//! +-----------------------------------------------------------------+
//! | <pointers> | <address ranges> | <cluster descriptors> |
//! +-----------------------------------------------------------------+
//! ```
//!
//! where the
//!
//!
//!
//! ```text
//! <pointers>
//! ```
//!
//! section looks like
//!
//!
//!
//! ```text
//! +-----------------------------------------+
//! | <backward pointer> | <forward pointer> |
//! +-----------------------------------------+
//! ```
//!
//! the
//!
//!
//!
//! ```text
//! <address ranges>
//! ```
//!
//! section looks like
//!
//!
//!
//! ```text
//! +-------------------------------------------+
//! | <char range> | <d.p. range> | <int range> |
//! +-------------------------------------------+
//! ```
//!
//! and each range looks like one of:
//!
//!
//!
//! ```text
//! +------------------------------------------------+
//! | <lowest char address> | <highest char address> |
//! +------------------------------------------------+
//!
//! +------------------------------------------------+
//! | <lowest d.p. address> | <highest d.p. address> |
//! +------------------------------------------------+
//!
//! +------------------------------------------------+
//! | <lowest int address> | <highest int address> |
//! +------------------------------------------------+
//! ```
//!
//! When the set of data records described by a directory record contains no
//! data of a given type, the address range corresponding to that type is
//! 0:0.
//!
//! Following the pointers and address range information is a sequence of
//! cluster descriptors. "Clusters" are maximal, contiguous sequences of
//! data records of a given data type. By "maximal" we mean that each
//! cluster is preceded and followed by a record that is not a data record
//! of the cluster's type. Each cluster descriptor indicates the data type
//! and record count of the cluster it describes. Successive cluster
//! descriptors map to successive clusters of data records in the file, as
//! shown below:
//!
//!
//!
//! ```text
//! +---------------------------------------------------+
//! | . . . | DESCR(i) | DESCR(i+1) | . . . | Directory
//! +---------------|----------|------------------------+
//! | . |
//! | . |
//! | . |
//! +---------------|----------|------------------------+
//! | | | | Data records
//! | V | Cluster (i) |
//! | | |
//! +--------------------------|------------------------+
//! | | |
//! | V Cluster (i+1) |
//! | |
//! | |
//! | |
//! +---------------------------------------------------+
//! .
//! .
//! .
//! ```
//!
//! Note that although the number of cluster descriptors in a directory
//! record is limited, the number of records described by a directory is
//! virtually arbitrary, because the number of records in each cluster may
//! vary. In particular, after data segregation is performed, a DAS file
//! contains only three clusters and requires a single directory in order to
//! describe those clusters.
//!
//! The cluster descriptors are implemented using a run-length encoding
//! scheme. The first element of the series of descriptors occupies two
//! integers; these represent a type code and a count. The rest of the
//! descriptors are just signed counts; the data types of the clusters they
//! describe are determined by the sign of the count and the data type of
//! the previous descriptor.
//!
//!
//!
//!
//!
//! ## Data Records
//!
//! Each DAS data record contains data of only one type.
//!
//! Within each DAS data record, word numbers start at one and increase up
//! to NWI, NWD, or NWC: the number of words in an integer, double
//! precision, or character data record. The organization of data records
//! can be thought of as follows:
//!
//!
//!
//! ```text
//!
//! Character records
//! -----------------
//!
//! +------------------------------------+
//! | | | ... | |
//! +------------------------------------+
//! 1 2 NWC
//!
//!
//! Double precision records
//! ------------------------
//!
//! +--------------------------------+
//! | | | ... | |
//! +--------------------------------+
//! 1 2 NWD
//!
//!
//! Integer records
//! ---------------
//!
//! +--------------------------------+
//! | | | ... | |
//! +--------------------------------+
//! 1 2 NWI
//!
//! ```
//!
//! Each data word in a DAS file is unambiguously specified by its type, the
//! number of the record containing it, and its word number.
//!
//!
//!
//!
//!
//! # DAS Routines
//!
//!
//!
//!
//!
//! ## Summary of Mnemonics
//!
//! All of the subroutines in the DAS family have names beginning with the
//! letters "DAS," followed by a two- or three-character mnemonic. For
//! example, the routine that reads integer data from a DAS file is named
//! [DASRDI](crate::raw::dasrdi), pronounced "DAS-R-D-I." The following is a complete list of
//! mnemonics and translations, in alphabetical order.
//!
//!
//!
//! ```text
//! A2L Map logical address to physical location
//! AC Add comments from buffer to file
//! ACR Add comment records to file
//! ACU Add comment records from logical unit to DAS file
//! ADC Add character data to file
//! ADD Add double precision data to file
//! ADI Add integer data to file
//! BT Convert binary to transfer format file
//! CLS Close file
//! CUD Create and update directories
//! DC Delete comments
//! EC Extract DAS comments into buffer
//! ECU Extract DAS comments to logical unit
//! FM File manager
//! FNH Map file name to handle
//! HAM Map file handle to access method
//! HFN Map handle to file name
//! HFS Map handle to file summary
//! HLU Map handle to logical unit
//! HOF Return handles of open DAS files
//! IOC Low-level character record I/O
//! IOD Low-level double precision record I/O
//! IOI Low-level integer record I/O
//! LLA Last logical addresses of each data type
//! LLC Low-level file close
//! LUH Map logical unit to handle
//! ONW Open a new DAS file.
//! OPN Open a new DAS file (obsolete: use DASONW)
//! OPR Open a DAS file for reading
//! OPS Open a scratch DAS file
//! OPW Open an existing DAS file for writing
//! RCR Remove comment records
//! RDC Read character data
//! RDD Read double precision data
//! RDI Read integer data
//! RFR Read file record
//! RRC Perform buffered read of character record
//! RRD Perform buffered read of double precision record
//! RRI Perform buffered read of integer record
//! RWR Read and write records
//! SDR Segregate data records
//! SIH Signal invalid handles
//! TB Convert transfer format file to binary
//! UDC Update character data
//! UDD Update double precision data
//! UDI Update integer data
//! UFS Update file summary
//! URC Update character record
//! URD Update double precision record
//! URI Update integer record
//! WBR Write buffered records
//! WFR Write file record
//! WRC Perform buffered write of character record
//! WRD Perform buffered write of double precision record
//! WRI Perform buffered write of integer record
//! ```
//!
//!
//! ## Summary of Calling Sequences
//!
//! Calling sequences of the DAS family of routines are given below.
//! Routines are grouped according to function.
//!
//! The following routines are intended for use by both SPICELIB users'
//! application programs and by SPICELIB routines.
//!
//! Opening and closing files:
//!
//!
//!
//! ```text
//! DASONW ( FNAME, FTYPE, IFNAME, NCOMR, HANDLE )
//! DASOPN ( FNAME, IFNAME, NRESV, HANDLE )
//! DASOPW ( FNAME, HANDLE )
//! DASOPR ( FNAME, HANDLE )
//! DASOPS ( HANDLE )
//! DASCLS ( HANDLE )
//! ```
//!
//! Adding data to files:
//!
//!
//!
//! ```text
//! DASADC ( HANDLE, N, BPOS, EPOS, DATA )
//! DASADD ( HANDLE, N, DATA )
//! DASADI ( HANDLE, N, DATA )
//! ```
//!
//! Updating data in files:
//!
//!
//!
//! ```text
//! DASUDC ( HANDLE, FIRST, LAST, BPOS, EPOS, DATA )
//! DASUDD ( HANDLE, FIRST, LAST, DATA )
//! DASUDI ( HANDLE, FIRST, LAST, DATA )
//! ```
//!
//! Reading data from files:
//!
//!
//!
//! ```text
//! DASRDC ( HANDLE, FIRST, LAST, BPOS, EPOS, DATA )
//! DASRDD ( HANDLE, FIRST, LAST, DATA )
//! DASRDI ( HANDLE, FIRST, LAST, DATA )
//! ```
//!
//! Mapping between file names, handles, and logical units:
//!
//!
//!
//! ```text
//! DASHLU ( HANDLE, UNIT )
//! DASHFN ( HANDLE, FNAME )
//! DASLUH ( UNIT, HANDLE )
//! DASFNH ( FNAME, HANDLE )
//! ```
//!
//! Conversion between binary and transfer format:
//!
//!
//!
//! ```text
//! DASBT ( BINARY, UNIT )
//! DASTB ( UNIT, BINARY )
//! ```
//!
//! File record (and internal file name) access:
//!
//!
//!
//! ```text
//! DASRFR ( HANDLE, IDWORD, IFNAME, NRESVR, NRESVC, NCOMR, NCOMC )
//! DASWFR ( HANDLE, IDWORD, IFNAME, NRESVR, NRESVC, NCOMR, NCOMC )
//! ```
//!
//! File summary access:
//!
//!
//!
//! ```text
//! DASHFS ( HANDLE, NRESVR, NRESVC, NCOMR, NCOMC,
//! FREE, LASTLA, LASTRC, LASTWD )
//! DASLLA ( HANDLE, LASTC, LASTD, LASTI )
//! DASUFS ( HANDLE, NRESVR, NRESVC, NCOMR, NCOMC,
//! FREE, LASTLA, LASTRC, LASTWD )
//! ```
//!
//! Adding and extracting comment records:
//!
//!
//!
//! ```text
//! DASAC ( HANDLE, N, BUFFER )
//! DASACR ( HANDLE, N )
//! DASACU ( COMLUN, BEGMRK, ENDMRK, INSBLN, HANDLE )
//! DASEC ( HANDLE, BUFSIZ, N, BUFFER, DONE )
//! DASECU ( HANDLE, UNIT, FOUND )
//! ```
//!
//! The following routines are considered to be utilities and generally will
//! not need to be called by application programs.
//!
//! Buffered writing, updating, and reading of records:
//!
//!
//!
//! ```text
//! DASWRC ( HANDLE, RECNO, RECC )
//! DASWRD ( HANDLE, RECNO, RECD )
//! DASWRI ( HANDLE, RECNO, RECI )
//! DASURC ( HANDLE, RECNO, FIRST, LAST, DATAC )
//! DASURD ( HANDLE, RECNO, FIRST, LAST, DATAD )
//! DASURI ( HANDLE, RECNO, FIRST, LAST, DATAI )
//! DASRRC ( HANDLE, RECNO, FIRST, LAST, DATAC )
//! DASRRD ( HANDLE, RECNO, FIRST, LAST, DATAD )
//! DASRRI ( HANDLE, RECNO, FIRST, LAST, DATAI )
//! ```
//!
//! Flushing buffer contents to files:
//!
//!
//!
//! ```text
//! DASWBR ( HANDLE )
//! ```
//!
//! Low-level file I/O:
//!
//!
//!
//! ```text
//! DASIOC ( ACTION, UNIT, RECNO, RECC )
//! DASIOD ( ACTION, UNIT, RECNO, RECD )
//! DASIOI ( ACTION, UNIT, RECNO, RECI )
//! ```
//!
//! Logical address to physical location mapping:
//!
//!
//!
//! ```text
//! DASA2L ( HANDLE, TYPE, ADDRSS, CLBASE, CLSIZE, RECNO, WORDNO )
//! ```
//!
//! Directory creation and updating:
//!
//!
//!
//! ```text
//! DASCUD ( HANDLE, TYPE, NWORDS )
//! ```
//!
//! Segregating data records:
//!
//!
//!
//! ```text
//! DASSDR ( HANDLE )
//! ```
//!
//! File handle verification:
//!
//!
//!
//! ```text
//! DASHOF ( HSET )
//! DASSIH ( HANDLE, ACCESS )
//! DASHAM ( HANDLE, ACCESS )
//! ```
//!
//! Low-level file close utility:
//!
//!
//!
//! ```text
//! DASLLC ( HANDLE )
//! ```
//!
//! The following routines are umbrella subroutines. These should never be
//! called, but their headers may be of interest to general SPICELIB users,
//! since they contain "global" documentation pertaining to the routines'
//! entry points.
//!
//!
//!
//! ```text
//! DASFM
//! DASRWR
//! ```
//!
//!
//! # Examples
//!
//!
//!
//!
//!
//! ## Storing a Symbol Table in a DAS File
//!
//! This example shows how the contents of a SPICELIB double precision
//! symbol table can be stored in and retrieved from a DAS file. The source
//! code for two subroutines WRSYMD and RDSYMD that perform the write and
//! read functions is listed below. With a small number of changes, the code
//! shown here could be modified to deal with integer or character symbol
//! tables.
//!
//! An important fact about user-designed, DAS-based formats is illustrated
//! by this example: the high level format of a file must be understood by
//! the code that reads the file, as well as the code that writes it.
//! Therefore, most non-trivial user-designed formats will need to include a
//! data structure that describes the rest of the file, thereby allowing the
//! user's file reader to know how to read the file. In the following
//! example, this data structure is very simple: it is a series of three
//! integers whose meanings are known to the reader.
//!
//! A SPICELIB double precision symbol consists of three arrays: an array of
//! symbol names, an array of integers that serves to map names to their
//! associated values, and an array of double precision values. WRSYMD adds
//! the contents of a symbol table to a DAS file opened by the calling
//! application. For each symbol, WRSYMD will add to the DAS file the
//! symbol's name, the count of the values associated with that symbol, and
//! the values associated with the symbol. In addition, the number of
//! symbols in the symbol table, the total number of values associated with
//! the symbols, and the length of the strings containing the symbols' names
//! will be added to the file. The logical format of the resulting file can
//! be thought of as follows:
//!
//!
//!
//! ```text
//!
//!
//! +----------------+ +----------------+ +----------------+
//! | Symbol Names | | Symbol Count | | D.P. Values |
//! | | +----------------+ | Associated |
//! | | | Value Count | | With Symbols |
//! | | +----------------+ | |
//! | | | Name Length | | (possibly |
//! | | +----------------+ | multiple |
//! | | | | | values per |
//! | | | Value Counts | | symbol) |
//! | | | For Each Symbol| | |
//! | | | | | |
//! | | | | | |
//! | | | | | |
//! | | +----------------+ | |
//! | | | |
//! +----------------+ | |
//! | |
//! | |
//! +----------------+
//! DAS Character DAS integer DAS double precision
//! virtual array virtual array virtual array
//!
//! ```
//!
//! The source code of WRSYMD is shown below:
//!
//!
//!
//! ```text
//!
//!
//! SUBROUTINE WRSYMD ( HANDLE, SYMNAM, SYMPTR, SYMVAL )
//! IMPLICIT NONE
//! C
//! C Write a double precision symbol table to a DAS file.
//! C
//! INTEGER LBCELL
//! PARAMETER ( LBCELL = - 5)
//!
//! INTEGER HANDLE
//! CHARACTER*(*) SYMNAM ( LBCELL : * )
//! INTEGER SYMPTR ( LBCELL : * )
//! DOUBLE PRECISION SYMVAL ( LBCELL : * )
//!
//! C$ Brief_I/O
//! C
//! C VARIABLE I/O DESCRIPTION
//! C -------- --- ----------------------------------------------
//! C HANDLE I Handle of DAS file opened for writing.
//! C SYMSYM,
//! C SYMPTR,
//! C SYMVAL I Components of the symbol table.
//! C
//!
//! C
//! C SPICELIB functions
//! C
//! INTEGER CARDC
//! INTEGER CARDD
//! INTEGER SYDIMD
//!
//! LOGICAL RETURN
//!
//! C
//! C Local parameters
//! C
//! INTEGER MAXVAL
//! PARAMETER ( MAXVAL = 5000 )
//!
//! C
//! C Local variables
//! C
//! DOUBLE PRECISION VALUES ( MAXVAL )
//!
//! INTEGER I
//! INTEGER N
//! INTEGER NAMLEN
//! INTEGER NSYM
//! INTEGER NVAL
//!
//! LOGICAL FOUND
//!
//! C
//! C Standard SPICELIB error handling.
//! C
//! IF ( RETURN() ) THEN
//! RETURN
//! END IF
//!
//! CALL CHKIN ( 'WRSYMD' )
//!
//! C
//! C Write the symbol and symbol value counts to the file. Also
//! C write out the length of the symbol name strings, so a reader
//! C program can know how many characters to read to obtain each
//! C name.
//! C
//! NSYM = CARDC (SYMNAM)
//! NVAL = CARDD (SYMVAL)
//! NAMLEN = LEN ( SYMNAM(1) )
//!
//! CALL DASADI ( HANDLE, 1, NSYM )
//! CALL DASADI ( HANDLE, 1, NVAL )
//! CALL DASADI ( HANDLE, 1, NAMLEN )
//! C
//! C Now write out the symbol table entries. For each symbol,
//! C we'll append the symbol's name to the DAS's virtual character
//! C array, the value count to the virtual integer array, and the
//! C values to the virtual double precision array.
//! C
//! DO I = 1, NSYM
//! C
//! C Look up the values associated with each symbol. We don't
//! C need to check the FOUND flag because we already know the
//! C symbols exist. Check the count of values; we must be able
//! C to fit them into our local VALUES array.
//! C
//! N = SYDIMD ( SYMNAM(I), SYMNAM, SYMPTR, SYMVAL )
//!
//! IF ( N .GT. MAXVAL ) THEN
//!
//! CALL SETMSG ( 'Symbol # has too many values: '
//! . // 'value count = #; array size = '
//! . // '#.' )
//! CALL ERRCH ( '#', SYMNAM(I) )
//! CALL ERRINT ( '#', N )
//! CALL ERRINT ( '#', MAXVAL )
//! CALL SIGERR ( 'ARRAYOVERFLOW' )
//! CALL CHKOUT ( 'WRSYMD' )
//! RETURN
//!
//! END IF
//!
//! CALL SYGETD ( SYMNAM(I),
//! . SYMNAM, SYMPTR, SYMVAL,
//! . N, VALUES, FOUND )
//! C
//! C Add the symbol's name to the DAS file.
//! C
//! CALL DASADC ( HANDLE, NAMLEN, 1, NAMLEN, SYMNAM(I) )
//! C
//! C Now the value count.
//! C
//! CALL DASADI ( HANDLE, 1, N )
//! C
//! C Finally, the values themselves.
//! C
//! CALL DASADD ( HANDLE, N, VALUES )
//!
//! END DO
//!
//! CALL CHKOUT ( 'WRSYMD' )
//! RETURN
//! END
//!
//! ```
//!
//! The symbol table placed in a DAS file by WRSYMD may be extracted by
//! RDSYMD, shown below:
//!
//!
//!
//! ```text
//! SUBROUTINE RDSYMD ( HANDLE, SYMNAM, SYMPTR, SYMVAL )
//! IMPLICIT NONE
//! C
//! C Read a double precision symbol table from a DAS file.
//! C
//! INTEGER LBCELL
//! PARAMETER ( LBCELL = - 5)
//!
//! INTEGER HANDLE
//! CHARACTER*(*) SYMNAM ( LBCELL : * )
//! INTEGER SYMPTR ( LBCELL : * )
//! DOUBLE PRECISION SYMVAL ( LBCELL : * )
//!
//! C$ Brief_I/O
//! C
//! C VARIABLE I/O DESCRIPTION
//! C -------- --- ----------------------------------------------
//! C HANDLE I Handle of DAS file opened for writing.
//! C SYMSYM,
//! C SYMPTR,
//! C SYMVAL O Components of the symbol table. These cells
//! C are presumed to be initialized on input.
//! C
//!
//! C
//! C SPICELIB functions
//! C
//! LOGICAL RETURN
//!
//! C
//! C Local parameters
//! C
//! INTEGER CHAR
//! PARAMETER ( CHAR = 1 )
//!
//! INTEGER DP
//! PARAMETER ( DP = 2 )
//!
//! INTEGER INT
//! PARAMETER ( INT = 3 )
//!
//! INTEGER MAXVAL
//! PARAMETER ( MAXVAL = 5000 )
//!
//! INTEGER MAXLEN
//! PARAMETER ( MAXLEN = 80 )
//!
//! C
//! C Local variables
//! C
//! CHARACTER*(MAXLEN) VARNAM
//!
//! DOUBLE PRECISION VALUES ( MAXVAL )
//!
//! INTEGER FIRST ( 3 )
//! INTEGER I
//! INTEGER L
//! INTEGER LAST ( 3 )
//! INTEGER N
//! INTEGER NAMLEN
//! INTEGER NSYM
//! INTEGER NVAL
//!
//! C
//! C Standard SPICELIB error handling.
//! C
//! IF ( RETURN() ) THEN
//! RETURN
//! END IF
//!
//! CALL CHKIN ( 'RDSYMD' )
//!
//! C
//! C Read the symbol and symbol value counts from the file. Also
//! C get the length of the symbol name strings.
//! C
//! CALL DASRDI ( HANDLE, 1, 1, NSYM )
//! CALL DASRDI ( HANDLE, 2, 2, NVAL )
//! CALL DASRDI ( HANDLE, 3, 3, NAMLEN )
//! C
//! C Now read the symbols, their value counts, and their values.
//! C Add each symbol to the output symbol table.
//! C
//! C Obtain the length of the names in the symbol table. Check
//! C that the elements of the input name array are long enough.
//! C
//! L = LEN ( SYMNAM(1) )
//!
//! IF ( L .LT. NAMLEN ) THEN
//!
//! CALL SETMSG ( 'Name array has width #; required width '
//! . // 'is #' )
//! CALL ERRINT ( '#', L )
//! CALL ERRINT ( NAMLEN )
//! CALL SIGERR ( 'NAMEARRAYTOONARROW' )
//! CALL CHKOUT ( 'RDSYMD' )
//! RETURN
//!
//! END IF
//!
//! C
//! C Initialize our logical address ranges.
//! C
//! CALL CLEARI ( 3, FIRST )
//!
//! LAST(CHAR) = 0
//! LAST(DP) = 0
//! LAST(INT) = 3
//!
//! DO I = 1, NSYM
//! C
//! C Obtain the symbol's name.
//! C
//! FIRST(CHAR) = LAST(CHAR) + 1
//! LAST (CHAR) = LAST(CHAR) + NAMLEN
//!
//! CALL DASRDC ( HANDLE,
//! . FIRST(CHAR), LAST(CHAR),
//! . 1, NAMLEN, VARNAM )
//! C
//! C Now obtain the symbol's value count.
//! C
//! FIRST(INT) = LAST(INT) + 1
//! LAST (INT) = LAST(INT) + 1
//!
//! CALL DASRDI ( HANDLE, FIRST(INT), LAST(INT), N )
//!
//! IF ( N .GT. MAXVAL ) THEN
//!
//! CALL SETMSG ( 'Symbol # has too many values: '
//! . // 'value count = #; array size = '
//! . // '#.' )
//! CALL ERRCH ( '#', VARNAM )
//! CALL ERRINT ( '#', N )
//! CALL ERRINT ( '#', MAXVAL )
//! CALL SIGERR ( 'ARRAYOVERFLOW' )
//! CALL CHKOUT ( 'RDSYMD' )
//! RETURN
//!
//! END IF
//! C
//! C Now get the symbol's values.
//! C
//! FIRST(DP) = LAST(DP) + 1
//! LAST (DP) = LAST(DP) + N
//!
//! CALL DASRDD ( HANDLE, FIRST(DP), LAST(DP), VALUES )
//! C
//! C Add the symbol to the output symbol table.
//! C
//! CALL SYPUTD ( VARNAM(1:NAMLEN), VALUES, N,
//! . SYMNAM, SYMPTR, SYMVAL )
//!
//! END DO
//!
//! CALL CHKOUT ( 'RDSYMD' )
//! RETURN
//! END
//! ```
//!
//!
//! # Appendix A --- Revision History
//!
//!
//!
//!
//!
//! ### 2021 DEC 31 by B. V. Semenov.
//!
//! Removed bingo"dot"ug string which was causing broken links in HTML
//! documentation in CSPICE-based packages that did not include BINGO.
//!
//!
//!
//!
//!
//! ### 2021 NOV 01 by N. J. Bachman.
//!
//! Corrected the diagram showing the layout of DAS file records. Reordered
//! lists of file record elements to match the actual order of the elements
//! in the records.
//!
//!
//!
//!
//!
//! ### 2017 MAR 23 by N. J. Bachman.
//!
//! Updated to mention:
//!
//!
//!
//! * run-time translation
//!
//! * handle management
//!
//! * new limit on number of open DAS files
//!
//! * DSK files
//!
//! * the DLA format
//!
//! * DAS comment area access routines
//!
//! Errors in example code were corrected. Document organization was
//! updated. Revision history was added.
//!
//!
//!
//!
//!
//! ### 2009 APR 01 by B. V. Semenov.
//!
//! Edits to conform to current NAIF standards for Required Reading
//! documents.
//!
//!
//!
//!
//!
//! ### 2002 JAN 15 by N. J. Bachman
//!
//! Initial release.
//!
//!
//!
//!
//!