1 /*
2 
3 -Procedure dskcls_c ( DSK, close file )
4 
5 -Abstract
6 
7    Close a DSK file.
8 
9 -Disclaimer
10 
11    THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE
12    CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S.
13    GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE
14    ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE
15    PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS"
16    TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY
17    WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A
18    PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC
19    SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE
20    SOFTWARE AND RELATED MATERIALS, HOWEVER USED.
21 
22    IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA
23    BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT
24    LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND,
25    INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS,
26    REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE
27    REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY.
28 
29    RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF
30    THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY
31    CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE
32    ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE.
33 
34 -Required_Reading
35 
36    DAS
37    DSK
38 
39 -Keywords
40 
41    DAS
42    DSK
43    FILES
44    TOPOGRAPHY
45 
46 */
47 
48    #include "SpiceUsr.h"
49    #include "SpiceZfc.h"
50    #include "SpiceZst.h"
51 
dskcls_c(SpiceInt handle,SpiceBoolean optmiz)52    void dskcls_c ( SpiceInt      handle,
53                    SpiceBoolean  optmiz )
54 
55 /*
56 
57 -Brief_I/O
58 
59    Variable  I/O  Description
60    --------  ---  --------------------------------------------------
61    handle     I   Handle assigned to the opened DSK file.
62    optmiz     I   Flag indicating whether to segregate the DSK.
63 
64 -Detailed_Input
65 
66    handle      is the DAS file handle associated with the file.
67                The file may be open for read or write access.
68 
69    optmiz      is a logical flag indicating whether the DSK
70                should be segregated before it is closed. This
71                option applies only to files open for write
72                access. The value of `optmiz' has no effect for
73                files opened for read access.
74 
75                See the DAS Required Reading das.req for a
76                discussion of segregation of DAS files.
77 
78 -Detailed_Output
79 
80    None. This routine operates by side effects.
81 
82 -Parameters
83 
84    None.
85 
86 -Exceptions
87 
88    1) If an error occurs when the file is closed, the error will be
89       diagnosed by routines in the call tree of this routine.
90 
91 -Files
92 
93    See argument `handle'.
94 
95 -Particulars
96 
97    This routine provides a DSK-level interface for closing DSK files.
98 
99    In cases where DSKs opened for write access are to be closed
100    without segregation, this interface is slightly simpler than that
101    available at the DAS level.
102 
103 -Examples
104 
105    1) Close a new DSK file using DAS segregation. `handle'
106       is the DAS file handle of the DSK.
107 
108       This is the normal choice for DSK creation.
109 
110          dskcls_c ( HANDLE, SPICETRUE )
111 
112    2) Close a new DSK file without using DAS segregation. The
113       close operation will be fast, but reading the file will be
114       less efficient than if the file had been segregated.
115 
116          dskcls_c ( HANDLE, SPICETRUE )
117 
118    3) Close an existing DSK file that had been opened
119       for read access. In this case `optmiz' is ignored:
120 
121          dskcls_c ( HANDLE, SPICEFALSE )
122 
123       or
124 
125          dskcls_c ( HANDLE, SPICETRUE )
126 
127 -Restrictions
128 
129    1) This routine should not be called by user applications
130       that have loaded a DSK file via furnsh_c. Such applications
131       should call the functions unload_c or kclear_c instead.
132 
133 -Literature_References
134 
135    None.
136 
137 -Author_and_Institution
138 
139    N.J. Bachman    (JPL)
140 
141 -Version
142 
143    -CSPICE Version 1.0.0, 23-JAN-2016 (NJB)
144 
145 -Index_Entries
146 
147    close a dsk file
148 
149 -&
150 */
151 
152 { /* Begin dskcls_c */
153 
154    /*
155    Local constants
156    */
157    logical                 optflg;
158 
159 
160 
161    /*
162    Participate in error tracing.
163    */
164    chkin_c ( "dskcls_c" );
165 
166    optflg = (logical) optmiz;
167 
168    dskcls_ ( (integer  *) &handle,
169              (logical  *) &optflg  );
170 
171    chkout_c ( "dskcls_c" );
172 
173 } /* End dskcls_c */
174