示例#1
0
文件: dafrfr.c 项目: Dbelsa/coft
/* $Procedure DAFRFR ( DAF, read file record ) */
/* Subroutine */ int dafrfr_(integer *handle, integer *nd, integer *ni, char *
	ifname, integer *fward, integer *bward, integer *free, ftnlen 
	ifname_len)
{
    /* Builtin functions */
    /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);

    /* Local variables */
    extern /* Subroutine */ int zzdafgfr_(integer *, char *, integer *, 
	    integer *, char *, integer *, integer *, integer *, logical *, 
	    ftnlen, ftnlen), chkin_(char *, ftnlen);
    logical found;
    extern logical failed_(void);
    extern /* Subroutine */ int dafsih_(integer *, char *, ftnlen);
    char idword[8];
    extern /* Subroutine */ int sigerr_(char *, ftnlen), chkout_(char *, 
	    ftnlen), setmsg_(char *, ftnlen), errint_(char *, integer *, 
	    ftnlen);
    extern logical return_(void);

/* $ Abstract */

/*     Read the contents of the file record of a DAF. */

/* $ Disclaimer */

/*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
/*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
/*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
/*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
/*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
/*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
/*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
/*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
/*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
/*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */

/*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
/*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
/*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
/*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
/*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
/*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */

/*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
/*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
/*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
/*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */

/* $ Required_Reading */

/*     DAF */

/* $ Keywords */

/*     FILES */

/* $ Declarations */
/* $ Brief_I/O */

/*     Variable  I/O  Description */
/*     --------  ---  -------------------------------------------------- */
/*     HANDLE     I   Handle of an open DAF file. */
/*     ND         O   Number of double precision components in summaries. */
/*     NI         O   Number of integer components in summaries. */
/*     IFNAME     O   Internal file name. */
/*     FWARD      O   Forward list pointer. */
/*     BWARD      O   Backward list pointer. */
/*     FREE       O   Free address pointer. */

/* $ Detailed_Input */

/*     HANDLE      is the handle assigned to a DAF file opened for */
/*                 reading. */

/* $ Detailed_Output */

/*     ND, */
/*     NI          are the numbers of double precision and integer */
/*                 components, respectively, in each array summary in */
/*                 the specified file. */

/*     IFNAME      is the internal file name stored in the first */
/*                 (or file) record of the specified file. */

/*     FWARD       is the forward list pointer. This points to the */
/*                 first summary record in the file. (Records between */
/*                 the first record and the first summary record are */
/*                 reserved when the file is created, and are invisible */
/*                 to DAF routines.) */

/*     BWARD       is the backward list pointer. This points */
/*                 to the final summary record in the file. */

/*     FREE        is the free address pointer. This contains the */
/*                 first free address in the file. (That is, the */
/*                 initial address of the next array to be added */
/*                 to the file.) */

/* $ Parameters */

/*      None. */

/* $ Exceptions */

/*     1) If the handle passed to this routine is not the handle of an */
/*        open DAF file, the error will be signaled by a routine called */
/*        by this routine. */

/*     2) If the specified DAF file is not open for read access, the */
/*        error will be diagnosed by a routine called by this routine. */

/*     3) If the specified record cannot (for some reason) be read, */
/*        the error SPICE(DAFFRNOTFOUND) is signaled. */

/* $ Files */

/*     None. */

/* $ Particulars */

/*     The file record of a DAF is the only record that contains */
/*     any global information about the file. This record is created */
/*     when the file is created, and is updated only when new arrays */
/*     are added. */

/*     Like character records, file records are not buffered. */

/* $ Examples */

/*     In the following example, the value of the forward list */
/*     pointer is examined in order to determine the number of */
/*     reserved records in the DAF. These records are then read */
/*     and the contents printed to the screen. */

/*        CALL DAFRFR ( HANDLE, ND, NI, IFNAME, FWARD, BWARD, FREE ) */
/*        CALL DAFHLU ( HANDLE, UNIT ) */

/*        DO I = 2, FWARD - 1 */
/*           READ  (UNIT,REC=I) PRIVATE(1:1000) */
/*           WRITE (*,*)        PRIVATE(1:1000) */
/*        END DO */

/* $ Restrictions */

/*     None. */

/* $ Literature_References */

/*     NAIF Document 167.0, "Double Precision Array Files (DAF) */
/*     Specification and User's Guide" */

/* $ Author_and_Institution */

/*     K.R. Gehringer  (JPL) */
/*     I.M. Underwood  (JPL) */

/* $ Version */

/* -    SPICELIB Version 3.1.0, 30-DEC-2009 (EDW) */

/*        Expanded DAFFRNOTFOUND error message to identify the file */
/*        handle corresponding to the error condition. */

/*        Reordered header sections to conform to SPICE format. */
/*        Merged the Revisions sections, now deleted, with Version. */

/* -    SPICELIB Version 3.0.0, 16-NOV-2001 (FST) */

/*        Updated this routine to utilize interfaces built on */
/*        the new handle manager to perform I/O operations. */

/*        This routine now utilizes ZZDAFGFR to retrieve information */
/*        from the file record.  As this private interface takes a */
/*        handle and performs the necessary logical unit to handle */
/*        mapping, the call to DAFHLU was removed.  The DAFSIH call */
/*        remains, since this insures that HANDLE is known to DAFAH. */
/* C */
/* -    SPICELIB Version 2.0.0, 04-OCT-1993 (KRG) */

/*        The error SPICE(DAFNOIDWORD) is no longer signaled by this */
/*        routine. The reason for this is that if DAFSIH returns OK then */
/*        the handle passed to this routine is indeed a valid DAF file */
/*        handle, otherwise the error is diagnosed by DAFSIH. */

/*        Added a call to DAFSIH to signal an invalid handle and a test */
/*        of FAILED () after it. This is to make sure that the DAF file */
/*        is open for reading. If this call succeeds, we know that we */
/*        have a valid DAF handle, so there is no need to check FAILED */
/*        after the call to DAFHLU. */

/*        The variable name DAFWRD was changed to IDWORD. */

/*        Added two new exceptions to the $ Exceptions section: 1 and 2. */
/*        The remaining exception (3) was already present. The exceptions */
/*        that were added are not new, but are being documented for the */
/*        first time. */


/* -    SPICELIB Version 1.0.3, 6-OCT-1992 (HAN) */

/*        Corrected a typo in the Brief_I/O section. ND was listed */
/*        twice as an input, and NI was not listed. */

/* -    SPICELIB Version 1.0.2, 10-MAR-1992 (WLT) */

/*        Comment section for permuted index source lines was added */
/*        following the header. */

/* -    SPICELIB Version 1.0.1, 22-MAR-1990 (HAN) */

/*        Literature references added to the header. */

/* -    SPICELIB Version 1.0.0, 31-JAN-1990 (IMU) */

/* -& */
/* $ Index_Entries */

/*     read daf file record */

/* -& */

/*     SPICELIB functions */


/*     Local Parameters */


/*     Local variables */


/*     Standard SPICE error handling. */

    if (return_()) {
	return 0;
    } else {
	chkin_("DAFRFR", (ftnlen)6);
    }

/*     Do some initializations */

    s_copy(idword, " ", (ftnlen)8, (ftnlen)1);

/*     Check to be sure that HANDLE is attached to a file that is open */
/*     with read access. If the call fails, check out and return. */

    dafsih_(handle, "READ", (ftnlen)4);
    if (failed_()) {
	chkout_("DAFRFR", (ftnlen)6);
	return 0;
    }

/*     Retrieve all but the internal file name directly from the */
/*     file record.  Read the internal file name into a temporary */
/*     string, to be sure of the length. Check FOUND. */

    zzdafgfr_(handle, idword, nd, ni, ifname, fward, bward, free, &found, (
	    ftnlen)8, ifname_len);
    if (! found) {
	setmsg_("File record not found for file handle #1. Check if program "
		"code uses handle #2 for a read or write operation.", (ftnlen)
		109);
	errint_("#1", handle, (ftnlen)2);
	errint_("#2", handle, (ftnlen)2);
	sigerr_("SPICE(DAFFRNOTFOUND)", (ftnlen)20);
	chkout_("DAFRFR", (ftnlen)6);
	return 0;
    }
    chkout_("DAFRFR", (ftnlen)6);
    return 0;
} /* dafrfr_ */
示例#2
0
/* $Procedure      DAFECU( DAF extract comments to a logical unit ) */
/* Subroutine */ int dafecu_(integer *handle, integer *comlun, logical *
	comnts)
{
    /* System generated locals */
    inlist ioin__1;

    /* Builtin functions */
    integer f_inqu(inlist *);

    /* Local variables */
    extern /* Subroutine */ int dafec_(integer *, integer *, integer *, char *
	    , logical *, ftnlen), chkin_(char *, ftnlen);
    extern logical failed_(void);
    extern /* Subroutine */ int dafsih_(integer *, char *, ftnlen);
    logical opened;
    char combuf[1000*22];
    extern /* Subroutine */ int sigerr_(char *, ftnlen);
    integer numcom;
    extern /* Subroutine */ int chkout_(char *, ftnlen);
    integer iostat;
    extern /* Subroutine */ int setmsg_(char *, ftnlen), errint_(char *, 
	    integer *, ftnlen), writla_(integer *, char *, integer *, ftnlen);
    logical gotsom;
    extern logical return_(void);
    logical eoc;

/* $ Abstract */

/*     Extract comments from a previously opened binary DAF file to a */
/*     previously opened text file attached to a Fortran logical unit. */

/* $ Disclaimer */

/*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
/*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
/*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
/*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
/*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
/*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
/*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
/*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
/*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
/*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */

/*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
/*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
/*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
/*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
/*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
/*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */

/*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
/*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
/*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
/*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */

/* $ Required_Reading */

/*     None. */

/* $ Keywords */

/*     None. */

/* $ Declarations */
/* $ Brief_I/O */

/*     Variable  I/O  Description */
/*     --------  ---  -------------------------------------------------- */
/*      HANDLE    I   Handle of a DAF file opened with read access. */
/*      COMLUN    I   Logical unit of an opened text file. */
/*      COMNTS    O   Logical flag, indicating comments were found. */

/* $ Detailed_Input */

/*     HANDLE   The file handle for a binary DAF file that has been */
/*              opened with read access. */

/*     COMLUN   The Fortran logical unit of a previously opened text */
/*              file to which the comments from a binary DAF file are */
/*              to be written. */

/*              The comments will be placed into the text file beginning */
/*              at the current location in the file and continuing */
/*              until all of the comments from the comment area of the */
/*              DAF file have been written. */

/* $ Detailed_Output */

/*     COMNTS   A logical flag indicating whether or not any comments */
/*              were found in the comment area of a DAF file. COMNTS will */
/*              have the value .TRUE. if there were some comments, and */
/*              the value .FALSE. otherwise. */

/* $ Parameters */

/*     None. */

/* $ Exceptions */

/*     1)   If the input logical unit COMLUN is not positive or there */
/*          is not an opened file attached to it, the error */
/*          SPICE(INVALIDARGUMENT) will be signalled. */

/*     2)   If the INQUIRE on the logical unit to see if there is a */
/*          file attached fails, the error SPICE(INQUIREFAILED) will */
/*          be signalled. */

/*     3)   If an error occurs while reading from the binary DAF file */
/*          attached to HANDLE, a routine called by this routine will */
/*          signal an error. */

/*     4)   If an error occurs while writing to the text file attached */
/*          to COMLUN, a routine called by this routine will signal an */
/*          error. */

/* $ Files */

/*     See parameters COMLUN and HANDLE in the $ Detailed_Inputs section. */

/* $ Particulars */

/*     This routine will extract all of the comments from the comment */
/*     area of a binary DAF file, placing them into a text file */
/*     attached to COMLUN beginning at the current position in the */
/*     text file. If there are no comments in the DAF file, nothing is */
/*     written to the text file attached to COMLUN. */

/* $ Examples */

/*      Let */

/*         HANDLE   be the DAF file handle of a previously opened binary */
/*                  DAF file. */

/*         COMLUN   be the Fortran logical unit of a previously opened */
/*                  text file that is to accept the comments from the */
/*                  DAF comment area. */

/*      The subroutine call */

/*         CALL DAFECU ( HANDLE, COMLUN, COMNTS ) */

/*      will extract the comments from the comment area of the binary */
/*      DAF file attached to HANDLE, if there are any, and write them */
/*      to the logical unit COMLUN. Upon successful completion, the */
/*      value of COMNTS will be .TRUE. if there were some comments */
/*      in the comment area of the DAF file and .FALSE. otherwise. */

/* $ Restrictions */

/*     The maximum length of a single comment line in the comment area is */
/*     specified by the parameter LINLEN defined below. Currently this */
/*     value is 1000 characters. */

/* $ Literature_References */

/*     None. */

/* $ Author_and_Institution */

/*     K.R. Gehringer (JPL) */

/* $ Version */

/* -    Beta Version 1.1.1, 08-MAY-2001 (BVS) */

/*        Buffer line size (LINLEN) was increased from 255 to 1000 */
/*        characters to make it consistent the line size in SPC */
/*        routines. */

/* -    Beta Version 1.1.0, 18-JAN-1996 (KRG) */

/*        Added a test and errors for checking to see whether COMLUN */
/*        was actually attached to an ASCII text file when this routine */
/*        was called. */

/* -    Beta Version 1.0.0, 23-SEP-1994 (KRG) */

/* -& */
/* $ Index_Entries */

/*      extract comments from a DAF to a logical unit */

/* -& */

/*     SPICELIB functions */


/*     Local parameters */

/*     Set the value for the maximum length of a text line. */


/*     Set the size of the comment buffer. */


/*     Local variables */


/*     Standard SPICE error handling. */

    if (return_()) {
	return 0;
    } else {
	chkin_("DAFECU", (ftnlen)6);
    }

/*     Verify that the DAF file attached to HANDLE is opened for reading. */

    dafsih_(handle, "READ", (ftnlen)4);
    if (failed_()) {
	chkout_("DAFECU", (ftnlen)6);
	return 0;
    }

/*     Logical units must be positive. If it is not, signal an error. */

    if (*comlun <= 0) {
	setmsg_("# is not a valid logical unit. Logical units must be positi"
		"ve.", (ftnlen)62);
	errint_("#", comlun, (ftnlen)1);
	sigerr_("SPICE(INVALIDARGUMENT)", (ftnlen)22);
	chkout_("DAFECU", (ftnlen)6);
	return 0;
    }

/*     Verify that there is an open ASCII text file attached to COMLUN. */

    ioin__1.inerr = 1;
    ioin__1.inunit = *comlun;
    ioin__1.infile = 0;
    ioin__1.inex = 0;
    ioin__1.inopen = &opened;
    ioin__1.innum = 0;
    ioin__1.innamed = 0;
    ioin__1.inname = 0;
    ioin__1.inacc = 0;
    ioin__1.inseq = 0;
    ioin__1.indir = 0;
    ioin__1.infmt = 0;
    ioin__1.inform = 0;
    ioin__1.inunf = 0;
    ioin__1.inrecl = 0;
    ioin__1.innrec = 0;
    ioin__1.inblank = 0;
    iostat = f_inqu(&ioin__1);
    if (iostat != 0) {
	setmsg_("The INQUIRE on logical unit # failed. The value of IOSTAT w"
		"as #.", (ftnlen)64);
	errint_("#", comlun, (ftnlen)1);
	errint_("#", &iostat, (ftnlen)1);
	sigerr_("SPICE(INQUIREFAILED)", (ftnlen)20);
	chkout_("DAFECU", (ftnlen)6);
	return 0;
    }
    if (! opened) {
	setmsg_("There is no open file attached to logical unit #, so no com"
		"ments could be written.", (ftnlen)82);
	errint_("#", comlun, (ftnlen)1);
	sigerr_("SPICE(INVALIDARGUMENT)", (ftnlen)22);
	chkout_("DAFECU", (ftnlen)6);
	return 0;
    }

/*     Initialize some things before the loop. */

    numcom = 0;
    eoc = FALSE_;
    gotsom = FALSE_;
    while(! eoc) {

/*        While we have not reached the end of the comments, get some */
/*        more. */

	dafec_(handle, &c__22, &numcom, combuf, &eoc, (ftnlen)1000);
	if (failed_()) {
	    chkout_("DAFECU", (ftnlen)6);
	    return 0;
	}
	if (numcom > 0) {

/*           If NUMCOM .GT. 0 then we did get some comments, and we need */
/*           to write them out, but first, set the flag indicating that */
/*           we got some comments. */

	    if (! gotsom) {
		gotsom = TRUE_;
	    }
	    writla_(&numcom, combuf, comlun, (ftnlen)1000);
	    if (failed_()) {
		chkout_("DAFECU", (ftnlen)6);
		return 0;
	    }
	}
    }

/*     Set the output flag indicating whether or not we got any comments. */

    *comnts = gotsom;
    chkout_("DAFECU", (ftnlen)6);
    return 0;
} /* dafecu_ */
示例#3
0
/* $Procedure      DAFDC ( DAF delete comments ) */
/* Subroutine */ int dafdc_(integer *handle)
{
    integer free;
    extern /* Subroutine */ int chkin_(char *, ftnlen);
    integer bward, fward, ncomr, nd;
    extern logical failed_(void);
    integer ni;
    extern /* Subroutine */ int dafsih_(integer *, char *, ftnlen);
    char ifname[60];
    extern /* Subroutine */ int dafrfr_(integer *, integer *, integer *, char 
	    *, integer *, integer *, integer *, ftnlen), dafrrr_(integer *, 
	    integer *), chkout_(char *, ftnlen);
    extern logical return_(void);

/* $ Abstract */

/*     Delete the entire comment area of a previously opened binary */
/*     DAF attached to HANDLE. */

/* $ Disclaimer */

/*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
/*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
/*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
/*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
/*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
/*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
/*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
/*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
/*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
/*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */

/*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
/*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
/*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
/*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
/*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
/*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */

/*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
/*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
/*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
/*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */

/* $ Required_Reading */

/*     DAF */

/* $ Keywords */

/*     None. */

/* $ Declarations */
/* $ Brief_I/O */

/*     Variable  I/O  Description */
/*     --------  ---  -------------------------------------------------- */
/*     HANDLE     I   The handle of a binary DAF opened for writing. */

/* $ Detailed_Input */

/*     HANDLE    The handle of a binary DAF that is to have its entire */
/*               comment area deleted. The DAF must have been opened */
/*               with write access. */

/* $ Detailed_Output */

/*     None. */

/* $ Parameters */

/*     None. */

/* $ Exceptions */

/*     1)   If the binary DAF attached to HANDLE is not open with write */
/*          access, an error will be signalled by a routine called by */
/*          this routine. */

/* $ Files */

/*     See argument HANDLE in $ Detailed_Input. */

/* $ Particulars */

/*     A binary DAF contains an area which is reserved for storing */
/*     annotations or descriptive textual information about the data */
/*     contained in a file. This area is referred to as the ``comment */
/*     area'' of the file. The comment area of a DAF is a line */
/*     oriented medium for storing textual information. The comment */
/*     area preserves any leading or embedded white space in the line(s) */
/*     of text which are stored, so that the appearance of the of */
/*     information will be unchanged when it is retrieved (extracted) at */
/*     some other time. Trailing blanks, however, are NOT preserved, */
/*     due to the way that character strings are represented in */
/*     standard Fortran 77. */

/*     This routine will delete the entire comment area from the binary */
/*     DAF attached to HANDLE. The size of the binary DAF will remain */
/*     unchanged. The space that was used by the comment records */
/*     is reclaimed. */

/* $ Examples */

/*     Let */

/*           HANDLE   be the handle of a DAF which has been opened */
/*                    with write access. */

/*     The call */

/*           CALL DAFDC ( HANDLE ) */

/*     deletes the entire comment area of the binary DAF attached to */
/*     HANDLE. */

/* $ Restrictions */

/*     None. */

/* $ Literature_References */

/*     None. */

/* $ Author_and_Institution */

/*     K.R. Gehringer (JPL) */

/* $ Version */

/* -    Beta Version 1.0.0, 23-SEP-1994 (KRG) */

/* -& */
/* $ Index_Entries */

/*      delete DAF comment area */

/* -& */

/*     SPICELIB functions */


/*     Local parameters */

/*     Length of a DAF file internal filename. */


/*     Local variables */


/*     Standard SPICE error handling. */

    if (return_()) {
	return 0;
    } else {
	chkin_("DAFDC", (ftnlen)5);
    }

/*     Verify that the DAF attached to HANDLE was opened with write */
/*     access. */

    dafsih_(handle, "WRITE", (ftnlen)5);
    if (failed_()) {
	chkout_("DAFDC", (ftnlen)5);
	return 0;
    }

/*     Read the file record to obtain the current number of comment */
/*     records in the DAF attached to HANDLE. We will also get back some */
/*     extra stuff that we do not use. */

    dafrfr_(handle, &nd, &ni, ifname, &fward, &bward, &free, (ftnlen)60);
    ncomr = fward - 2;
    if (failed_()) {
	chkout_("DAFDC", (ftnlen)5);
	return 0;
    }

/*     Now we will attempt to remove the comment records, if there are */
/*     any, otherwise we do nothing. */

    if (ncomr > 0) {

/*        We have some comment records, so remove them. */

	dafrrr_(handle, &ncomr);
	if (failed_()) {
	    chkout_("DAFDC", (ftnlen)5);
	    return 0;
	}
    }

/*     We're done now, so goodbye. */

    chkout_("DAFDC", (ftnlen)5);
    return 0;
} /* dafdc_ */