/* $Procedure ZZEKAD04 ( EK, add data to class 4 column ) */ /* Subroutine */ int zzekad04_(integer *handle, integer *segdsc, integer * coldsc, integer *recptr, integer *nvals, integer *ivals, logical * isnull) { /* System generated locals */ integer i__1, i__2; /* Local variables */ integer nrec; extern integer zzekrp2n_(integer *, integer *, integer *); integer room; extern /* Subroutine */ int zzekpgbs_(integer *, integer *, integer *), zzekglnk_(integer *, integer *, integer *, integer *), zzeksfwd_( integer *, integer *, integer *, integer *), zzekslnk_(integer *, integer *, integer *, integer *); integer p, mbase, pbase; extern /* Subroutine */ int chkin_(char *, ftnlen); integer recno, ncols, lastw, start, p2; extern /* Subroutine */ int dasudi_(integer *, integer *, integer *, integer *); integer remain, colidx, datptr, nlinks, nwrite, ptrloc; logical fstpag; extern /* Subroutine */ int setmsg_(char *, ftnlen), errint_(char *, integer *, ftnlen), sigerr_(char *, ftnlen), chkout_(char *, ftnlen), zzekaps_(integer *, integer *, integer *, logical *, integer *, integer *); /* $ Abstract */ /* Add a column entry to a specified record in a class 4 column. */ /* The entries of class 4 columns are arrays of integer values. */ /* $ 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 */ /* EK */ /* $ Keywords */ /* EK */ /* PRIVATE */ /* $ Declarations */ /* $ 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. */ /* Include Section: EK Boolean Enumerated Type */ /* ekbool.inc Version 1 21-DEC-1994 (NJB) */ /* Within the EK system, boolean values sometimes must be */ /* represented by integer or character codes. The codes and their */ /* meanings are listed below. */ /* Integer code indicating `true': */ /* Integer code indicating `false': */ /* Character code indicating `true': */ /* Character code indicating `false': */ /* End Include Section: EK Boolean Enumerated Type */ /* $ 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. */ /* Include Section: EK Column Descriptor Parameters */ /* ekcoldsc.inc Version 6 23-AUG-1995 (NJB) */ /* Note: The column descriptor size parameter CDSCSZ is */ /* declared separately in the include section CDSIZE$INC.FOR. */ /* Offset of column descriptors, relative to start of segment */ /* integer address range. This number, when added to the last */ /* integer address preceding the segment, yields the DAS integer */ /* base address of the first column descriptor. Currently, this */ /* offset is exactly the size of a segment descriptor. The */ /* parameter SDSCSZ, which defines the size of a segment descriptor, */ /* is declared in the include file eksegdsc.inc. */ /* Size of column descriptor */ /* Indices of various pieces of column descriptors: */ /* CLSIDX is the index of the column's class code. (We use the */ /* word `class' to distinguish this item from the column's data */ /* type.) */ /* TYPIDX is the index of the column's data type code (CHR, INT, DP, */ /* or TIME). The type is actually implied by the class, but it */ /* will frequently be convenient to look up the type directly. */ /* LENIDX is the index of the column's string length value, if the */ /* column has character type. A value of IFALSE in this element of */ /* the descriptor indicates that the strings have variable length. */ /* SIZIDX is the index of the column's element size value. This */ /* descriptor element is meaningful for columns with fixed-size */ /* entries. For variable-sized columns, this value is IFALSE. */ /* NAMIDX is the index of the base address of the column's name. */ /* IXTIDX is the data type of the column's index. IXTIDX */ /* contains a type value only if the column is indexed. For columns */ /* that are not indexed, the location IXTIDX contains the boolean */ /* value IFALSE. */ /* IXPIDX is a pointer to the column's index. IXTPDX contains a */ /* meaningful value only if the column is indexed. The */ /* interpretation of the pointer depends on the data type of the */ /* index. */ /* NFLIDX is the index of a flag indicating whether nulls are */ /* permitted in the column. The value at location NFLIDX is */ /* ITRUE if nulls are permitted and IFALSE otherwise. */ /* ORDIDX is the index of the column's ordinal position in the */ /* list of columns belonging to the column's parent segment. */ /* METIDX is the index of the column's integer metadata pointer. */ /* This pointer is a DAS integer address. */ /* The last position in the column descriptor is reserved. No */ /* parameter is defined to point to this location. */ /* End Include Section: EK Column Descriptor Parameters */ /* $ 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. */ /* Include Section: EK Data Page Parameters */ /* ekfilpar.inc Version 1 03-APR-1995 (NJB) */ /* These parameters apply to EK files using architecture 4. */ /* These files use a paged DAS file as their underlying file */ /* structure. */ /* In paged DAS EK files, data pages are structured: they contain */ /* metadata as well as data. The metadata is located in the last */ /* few addresses of each page, so as to interfere as little as */ /* possible with calculation of data addresses. */ /* Each data page belongs to exactly one segment. Some bookkeeping */ /* information, such as record pointers, is also stored in data */ /* pages. */ /* Each page contains a forward pointer that allows rapid lookup */ /* of data items that span multiple pages. Each page also keeps */ /* track of the current number of links from its parent segment */ /* to the page. Link counts enable pages to `know' when they */ /* are no longer in use by a segment; unused pages are deallocated */ /* and returned to the free list. */ /* The parameters in this include file depend on the parameters */ /* declared in the include file ekpage.inc. If those parameters */ /* change, this file must be updated. The specified parameter */ /* declarations we need from that file are: */ /* INTEGER PGSIZC */ /* PARAMETER ( PGSIZC = 1024 ) */ /* INTEGER PGSIZD */ /* PARAMETER ( PGSIZD = 128 ) */ /* INTEGER PGSIZI */ /* PARAMETER ( PGSIZI = 256 ) */ /* Character pages use an encoding mechanism to represent integer */ /* metadata. Each integer is encoded in five consecutive */ /* characters. */ /* Character data page parameters: */ /* Size of encoded integer: */ /* Usable page size: */ /* Location of character forward pointer: */ /* Location of character link count: */ /* Double precision data page parameters: */ /* Usable page size: */ /* Location of d.p. forward pointer: */ /* Location of d.p. link count: */ /* Integer data page parameters: */ /* Usable page size: */ /* Location of integer forward pointer: */ /* Location of integer link count: */ /* End Include Section: EK Data Page Parameters */ /* $ 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. */ /* Include Section: EK Record Pointer Parameters */ /* ekrecptr.inc Version 2 18-JUL-1995 (NJB) */ /* This file declares parameters used in EK record pointers. */ /* Each segment references data in a given record via two levels */ /* of indirection: a record number points to a record pointer, */ /* which is a structured array of metadata and data pointers. */ /* Record pointers always occupy contiguous ranges of integer */ /* addresses. */ /* The parameter declarations in this file depend on the assumption */ /* that integer pages contain 256 DAS integer words and that the */ /* maximum number of columns in a segment is 100. Record pointers */ /* are stored in integer data pages, so they must fit within the */ /* usable data area afforded by these pages. The size of the usable */ /* data area is given by the parameter IPSIZE which is declared in */ /* ekdatpag.inc. The assumed value of IPSIZE is 254. */ /* The first element of each record pointer is a status indicator. */ /* The meanings of status indicators depend on whether the parent EK */ /* is shadowed or not. For shadowed EKs, allowed status values and */ /* their meanings are: */ /* OLD The record has not been modified since */ /* the EK containing the record was opened. */ /* UPDATE The record is an update of a previously existing */ /* record. The original record is now on the */ /* modified record list. */ /* NEW The record has been added since the EK containing the */ /* record was opened. The record is not an update */ /* of a previously existing record. */ /* DELOLD This status applies only to a backup record. */ /* DELOLD status indicates that the record corresponds */ /* to a deleted OLD record in the source segment. */ /* DELNEW This status applies only to a backup record. */ /* DELNEW status indicates that the record corresponds */ /* to a deleted NEW record in the source segment. */ /* DELUPD This status applies only to a backup record. */ /* DELUPD status indicates that the record corresponds */ /* to a deleted UPDATEd record in the source segment. */ /* In EKs that are not shadowed, all records have status OLD. */ /* The following parameters refer to indices within the record */ /* pointer structure: */ /* Index of status indicator: */ /* Each record pointer contains a pointer to its companion: for a */ /* record belonging to a shadowed EK, this is the backup counterpart, */ /* or if the parent EK is itself a backup EK, a pointer to the */ /* record's source record. The pointer is UNINIT (see below) if the */ /* record is unmodified. */ /* Record companion pointers contain record numbers, not record */ /* base addresses. */ /* Index of record's companion pointer: */ /* Each data item is referenced by an integer. The meaning of */ /* this integer depends on the representation of data in the */ /* column to which the data item belongs. Actual lookup of a */ /* data item must be done by subroutines appropriate to the class of */ /* the column to which the item belongs. Note that data items don't */ /* necessarily occupy contiguous ranges of DAS addresses. */ /* Base address of data pointers: */ /* Maximum record pointer size: */ /* Data pointers are given the value UNINIT to start with; this */ /* indicates that the data item is uninitialized. UNINIT is */ /* distinct from the value NULL. NOBACK indicates an uninitialized */ /* backup column entry. */ /* End Include Section: EK Record Pointer Parameters */ /* $ 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. */ /* Include Section: EK Segment Descriptor Parameters */ /* eksegdsc.inc Version 8 06-NOV-1995 (NJB) */ /* All `base addresses' referred to below are the addresses */ /* *preceding* the item the base applies to. This convention */ /* enables simplied address calculations in many cases. */ /* Size of segment descriptor. Note: the include file ekcoldsc.inc */ /* must be updated if this parameter is changed. The parameter */ /* CDOFF in that file should be kept equal to SDSCSZ. */ /* Index of the segment type code: */ /* Index of the segment's number. This number is the segment's */ /* index in the list of segments contained in the EK to which */ /* the segment belongs. */ /* Index of the DAS integer base address of the segment's integer */ /* meta-data: */ /* Index of the DAS character base address of the table name: */ /* Index of the segment's column count: */ /* Index of the segment's record count: */ /* Index of the root page number of the record tree: */ /* Index of the root page number of the character data page tree: */ /* Index of the root page number of the double precision data page */ /* tree: */ /* Index of the root page number of the integer data page tree: */ /* Index of the `modified' flag: */ /* Index of the `initialized' flag: */ /* Index of the shadowing flag: */ /* Index of the companion file handle: */ /* Index of the companion segment number: */ /* The next three items are, respectively, the page numbers of the */ /* last character, d.p., and integer data pages allocated by the */ /* segment: */ /* The next three items are, respectively, the page-relative */ /* indices of the last DAS word in use in the segment's */ /* last character, d.p., and integer data pages: */ /* Index of the DAS character base address of the column name list: */ /* The last descriptor element is reserved for future use. No */ /* parameter is defined to point to this location. */ /* End Include Section: EK Segment Descriptor Parameters */ /* $ 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. */ /* Include Section: EK Data Types */ /* ektype.inc Version 1 27-DEC-1994 (NJB) */ /* Within the EK system, data types of EK column contents are */ /* represented by integer codes. The codes and their meanings */ /* are listed below. */ /* Integer codes are also used within the DAS system to indicate */ /* data types; the EK system makes no assumptions about compatibility */ /* between the codes used here and those used in the DAS system. */ /* Character type: */ /* Double precision type: */ /* Integer type: */ /* `Time' type: */ /* Within the EK system, time values are represented as ephemeris */ /* seconds past J2000 (TDB), and double precision numbers are used */ /* to store these values. However, since time values require special */ /* treatment both on input and output, and since the `TIME' column */ /* has a special role in the EK specification and code, time values */ /* are identified as a type distinct from double precision numbers. */ /* End Include Section: EK Data Types */ /* $ Brief_I/O */ /* Variable I/O Description */ /* -------- --- -------------------------------------------------- */ /* HANDLE I File handle. */ /* SEGDSC I Segment descriptor. */ /* COLDSC I Column descriptor. */ /* RECPTR I Record pointer. */ /* NVALS I Number of values to add to column. */ /* IVALS I Integer values to add to column. */ /* ISNULL I Flag indicating whether column entry is null. */ /* $ Detailed_Input */ /* HANDLE is a file handle of an EK open for write access. */ /* SEGDSC is the descriptor of the segment in which */ /* the specified column entry is to be written. */ /* COLDSC is the descriptor of the column in which */ /* the specified column entry is to be written. */ /* RECPTR is a pointer to the record containing the column */ /* entry to be written. */ /* NVALS, */ /* IVALS are, respectively, the number of values to add to */ /* the specified column and the set of values */ /* themselves. The data values are written into the */ /* specified column and record. */ /* If the column has fixed-size entries, then NVALS */ /* must equal the entry size for the specified column. */ /* Only one value can be added to a virtual column. */ /* ISNULL is a logical flag indicating whether the entry is */ /* null. If ISNULL is .FALSE., the column entry */ /* defined by NVALS and IVALS is added to the */ /* specified kernel file. */ /* If ISNULL is .TRUE., NVALS and IVALS are ignored. */ /* The contents of the column entry are undefined. */ /* If the column has fixed-length, variable-size */ /* entries, the number of entries is considered to */ /* be 1. */ /* $ Detailed_Output */ /* None. See the $Particulars section for a description of the */ /* effect of this routine. */ /* $ Parameters */ /* None. */ /* $ Exceptions */ /* 1) If HANDLE is invalid, the error will be diagnosed by routines */ /* called by this routine. The file is not modified. */ /* 2) If the ordinal position of the column specified by COLDSC */ /* is out of range, the error SPICE(INVALIDINDEX) is signalled. */ /* The file is not modified. */ /* 3) If the input flag ISNULL is .TRUE. but the target column */ /* does not allow nulls, the error SPICE(BADATTRIBUTE) is */ /* signalled. The file is not modified. */ /* 4) If RECPTR is invalid, a DAS addressing error may occur. The */ /* error in *not* trapped in advance. This routine assumes that */ /* a valid value of RECPTR has been supplied by the caller. */ /* 3) If an I/O error occurs while reading or writing the indicated */ /* file, the error will be diagnosed by routines called by this */ /* routine. The file may be corrupted. */ /* $ Files */ /* See the EK Required Reading for a discussion of the EK file */ /* format. */ /* $ Particulars */ /* This routine operates by side effects: it sets the value of a */ /* column entry in an EK segment. If the column is indexed, the */ /* index is updated to reflect the presence of the new entry. This */ /* routine is intended to set values of uninitialized column entries */ /* only. To update existing entries, use the ZZEKUExx routines, or */ /* at the user level, the EKUCEx routines. */ /* This routine does not participate in shadowing functions. If the */ /* target EK is shadowed, the caller is responsible for performing */ /* necessary backup operations. If the target EK is not shadowed, */ /* the target record's status is not modified. */ /* The changes made by this routine to the target EK file become */ /* permanent when the file is closed. Failure to close the file */ /* properly will leave it in an indeterminate state. */ /* $ Examples */ /* See EKACEI. */ /* $ Restrictions */ /* 1) This routine cannot be used to update existing column entries. */ /* $ Literature_References */ /* None. */ /* $ Author_and_Institution */ /* N.J. Bachman (JPL) */ /* $ Version */ /* - Beta Version 1.0.0, 26-SEP-1995 (NJB) */ /* -& */ /* Non-SPICELIB functions */ /* Local variables */ /* Use discovery check-in. */ nrec = segdsc[5]; colidx = coldsc[8]; /* Make sure the column exists. */ ncols = segdsc[4]; if (colidx < 1 || colidx > ncols) { chkin_("ZZEKAD04", (ftnlen)8); setmsg_("Column index = #; valid range is 1:#.", (ftnlen)37); errint_("#", &colidx, (ftnlen)1); errint_("#", &nrec, (ftnlen)1); sigerr_("SPICE(INVALIDINDEX)", (ftnlen)19); chkout_("ZZEKAD04", (ftnlen)8); return 0; } /* If the value is null, make sure that nulls are permitted */ /* in this column. */ if (*isnull && coldsc[7] != 1) { recno = zzekrp2n_(handle, &segdsc[1], recptr); chkin_("ZZEKAD04", (ftnlen)8); setmsg_("Column having index # in segment # does not allow nulls, bu" "t a null value was supplied for the element in record #.", ( ftnlen)115); errint_("#", &colidx, (ftnlen)1); errint_("#", &segdsc[1], (ftnlen)1); errint_("#", &recno, (ftnlen)1); sigerr_("SPICE(BADATTRIBUTE)", (ftnlen)19); chkout_("ZZEKAD04", (ftnlen)8); return 0; } /* Check NVALS. If the column has fixed-size entries, NVALS must */ /* match the declared entry size. In all cases, NVALS must be */ /* positive. */ if (*nvals < 1) { chkin_("ZZEKAD04", (ftnlen)8); setmsg_("COLIDX = #; segment = #; NVALS = #; NVALS must be positiv" "e ", (ftnlen)61); errint_("#", &colidx, (ftnlen)1); errint_("#", &segdsc[1], (ftnlen)1); errint_("#", nvals, (ftnlen)1); sigerr_("SPICE(INVALIDCOUNT)", (ftnlen)19); chkout_("ZZEKAD04", (ftnlen)8); return 0; } if (coldsc[3] != -1) { if (*nvals != coldsc[3]) { chkin_("ZZEKAD04", (ftnlen)8); setmsg_("COLIDX = #; segment = #; NVALS = #; declared entry siz" "e = #. Sizes must match.", (ftnlen)80); errint_("#", &colidx, (ftnlen)1); errint_("#", &segdsc[1], (ftnlen)1); errint_("#", nvals, (ftnlen)1); errint_("#", &coldsc[3], (ftnlen)1); sigerr_("SPICE(INVALIDCOUNT)", (ftnlen)19); chkout_("ZZEKAD04", (ftnlen)8); return 0; } } /* Compute the data pointer location. */ ptrloc = *recptr + 2 + colidx; if (*isnull) { /* All we need do is set the data pointer. The segment's */ /* metadata are not affected. */ dasudi_(handle, &ptrloc, &ptrloc, &c_n2); } else { lastw = segdsc[20]; room = 254 - lastw; remain = *nvals; start = 1; fstpag = TRUE_; while(remain > 0) { /* Decide where to write the data values. In order to write */ /* to the current page, we require enough room for the count */ /* and at least one column entry element. */ if (room >= 2) { /* There's room in the current page. If this is the first */ /* page this entry is written on, set the data pointer */ /* and count. Write as much of the value as possible to */ /* the current page. */ p = segdsc[17]; zzekpgbs_(&c__3, &p, &pbase); datptr = pbase + lastw + 1; if (fstpag) { dasudi_(handle, &ptrloc, &ptrloc, &datptr); dasudi_(handle, &datptr, &datptr, nvals); --room; ++datptr; } nwrite = min(remain,room); i__1 = datptr + nwrite - 1; dasudi_(handle, &datptr, &i__1, &ivals[start - 1]); remain -= nwrite; room -= nwrite; start += nwrite; /* The page containing the data item gains a link. */ zzekglnk_(handle, &c__3, &p, &nlinks); i__1 = nlinks + 1; zzekslnk_(handle, &c__3, &p, &i__1); /* The last integer word in use must be updated. Account */ /* for the count, if this is the first page on which the */ /* current entry is written. */ if (fstpag) { segdsc[20] = lastw + 1 + nwrite; fstpag = FALSE_; } else { segdsc[20] = lastw + nwrite; } } else { /* Allocate a data page. If this is not the first data */ /* page written to, link the previous page to the current */ /* one. */ zzekaps_(handle, segdsc, &c__3, &c_false, &p2, &pbase); if (! fstpag) { zzeksfwd_(handle, &c__3, &p, &p2); } /* The last integer page and word in use must be updated. */ p = p2; lastw = 0; segdsc[17] = p; segdsc[20] = lastw; room = 254; /* Make sure the link count is zeroed out. */ zzekslnk_(handle, &c__3, &p, &c__0); } } } /* Write out the updated segment descriptor. */ mbase = segdsc[2]; i__1 = mbase + 1; i__2 = mbase + 24; dasudi_(handle, &i__1, &i__2, segdsc); /* Class 4 columns are not indexed, so we need not update any */ /* index to account for the new element. */ return 0; } /* zzekad04_ */
/* $Procedure ZZEKAC09 ( EK, add class 9 column to segment ) */ /* Subroutine */ int zzekac09_(integer *handle, integer *segdsc, integer * coldsc, char *cvals, logical *nlflgs, integer *wkindx, ftnlen cvals_len) { /* System generated locals */ integer i__1, i__2; /* Builtin functions */ integer i_len(char *, ftnlen); /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen); /* Local variables */ char page[1024]; integer from; extern /* Subroutine */ int zzekcnam_(integer *, integer *, char *, ftnlen), zzekacps_(integer *, integer *, integer *, integer *, integer *, integer *), zzekordc_(char *, logical *, logical *, integer *, integer *, ftnlen), zzekpgwc_(integer *, integer *, char *, ftnlen), zzekwpai_(integer *, integer *, integer *, integer *, integer *, integer *), zzekwpal_(integer *, integer *, integer *, logical *, integer *, integer *), zzekslnk_(integer *, integer *, integer *, integer *); integer l, p, mbase, npage; extern /* Subroutine */ int chkin_(char *, ftnlen), errch_(char *, char *, ftnlen, ftnlen); integer class__, nrows, cmbase; extern logical return_(void); char column[32]; integer colidx, datbas, dscbas, idxbas, idxpag, idxtyp, nflbas, nflpag, nulptr, to; logical fixlen, indexd, nullok; extern /* Subroutine */ int setmsg_(char *, ftnlen), errint_(char *, integer *, ftnlen), sigerr_(char *, ftnlen), chkout_(char *, ftnlen), dasudi_(integer *, integer *, integer *, integer *); integer spp; /* $ Abstract */ /* Add an entire class 9 column to an EK segment. */ /* $ 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 */ /* EK */ /* $ Keywords */ /* EK */ /* $ Declarations */ /* $ 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. */ /* Include Section: EK Boolean Enumerated Type */ /* ekbool.inc Version 1 21-DEC-1994 (NJB) */ /* Within the EK system, boolean values sometimes must be */ /* represented by integer or character codes. The codes and their */ /* meanings are listed below. */ /* Integer code indicating `true': */ /* Integer code indicating `false': */ /* Character code indicating `true': */ /* Character code indicating `false': */ /* End Include Section: EK Boolean Enumerated Type */ /* $ 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. */ /* Include Section: EK Column Class 9 Parameters */ /* ekclas08.inc Version 1 07-NOV-1995 (NJB) */ /* The following parameters give the offsets of items in the */ /* class 9 integer metadata array. */ /* Data array base address: */ /* Null flag array base address: */ /* Size of class 9 metadata array: */ /* End Include Section: EK Column Class 9 Parameters */ /* $ 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. */ /* Include Section: EK Column Name Size */ /* ekcnamsz.inc Version 1 17-JAN-1995 (NJB) */ /* Size of column name, in characters. */ /* End Include Section: EK Column Name Size */ /* $ 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. */ /* Include Section: EK Column Descriptor Parameters */ /* ekcoldsc.inc Version 6 23-AUG-1995 (NJB) */ /* Note: The column descriptor size parameter CDSCSZ is */ /* declared separately in the include section CDSIZE$INC.FOR. */ /* Offset of column descriptors, relative to start of segment */ /* integer address range. This number, when added to the last */ /* integer address preceding the segment, yields the DAS integer */ /* base address of the first column descriptor. Currently, this */ /* offset is exactly the size of a segment descriptor. The */ /* parameter SDSCSZ, which defines the size of a segment descriptor, */ /* is declared in the include file eksegdsc.inc. */ /* Size of column descriptor */ /* Indices of various pieces of column descriptors: */ /* CLSIDX is the index of the column's class code. (We use the */ /* word `class' to distinguish this item from the column's data */ /* type.) */ /* TYPIDX is the index of the column's data type code (CHR, INT, DP, */ /* or TIME). The type is actually implied by the class, but it */ /* will frequently be convenient to look up the type directly. */ /* LENIDX is the index of the column's string length value, if the */ /* column has character type. A value of IFALSE in this element of */ /* the descriptor indicates that the strings have variable length. */ /* SIZIDX is the index of the column's element size value. This */ /* descriptor element is meaningful for columns with fixed-size */ /* entries. For variable-sized columns, this value is IFALSE. */ /* NAMIDX is the index of the base address of the column's name. */ /* IXTIDX is the data type of the column's index. IXTIDX */ /* contains a type value only if the column is indexed. For columns */ /* that are not indexed, the location IXTIDX contains the boolean */ /* value IFALSE. */ /* IXPIDX is a pointer to the column's index. IXTPDX contains a */ /* meaningful value only if the column is indexed. The */ /* interpretation of the pointer depends on the data type of the */ /* index. */ /* NFLIDX is the index of a flag indicating whether nulls are */ /* permitted in the column. The value at location NFLIDX is */ /* ITRUE if nulls are permitted and IFALSE otherwise. */ /* ORDIDX is the index of the column's ordinal position in the */ /* list of columns belonging to the column's parent segment. */ /* METIDX is the index of the column's integer metadata pointer. */ /* This pointer is a DAS integer address. */ /* The last position in the column descriptor is reserved. No */ /* parameter is defined to point to this location. */ /* End Include Section: EK Column Descriptor Parameters */ /* $ 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. */ /* Include Section: EK Data Page Parameters */ /* ekfilpar.inc Version 1 03-APR-1995 (NJB) */ /* These parameters apply to EK files using architecture 4. */ /* These files use a paged DAS file as their underlying file */ /* structure. */ /* In paged DAS EK files, data pages are structured: they contain */ /* metadata as well as data. The metadata is located in the last */ /* few addresses of each page, so as to interfere as little as */ /* possible with calculation of data addresses. */ /* Each data page belongs to exactly one segment. Some bookkeeping */ /* information, such as record pointers, is also stored in data */ /* pages. */ /* Each page contains a forward pointer that allows rapid lookup */ /* of data items that span multiple pages. Each page also keeps */ /* track of the current number of links from its parent segment */ /* to the page. Link counts enable pages to `know' when they */ /* are no longer in use by a segment; unused pages are deallocated */ /* and returned to the free list. */ /* The parameters in this include file depend on the parameters */ /* declared in the include file ekpage.inc. If those parameters */ /* change, this file must be updated. The specified parameter */ /* declarations we need from that file are: */ /* INTEGER PGSIZC */ /* PARAMETER ( PGSIZC = 1024 ) */ /* INTEGER PGSIZD */ /* PARAMETER ( PGSIZD = 128 ) */ /* INTEGER PGSIZI */ /* PARAMETER ( PGSIZI = 256 ) */ /* Character pages use an encoding mechanism to represent integer */ /* metadata. Each integer is encoded in five consecutive */ /* characters. */ /* Character data page parameters: */ /* Size of encoded integer: */ /* Usable page size: */ /* Location of character forward pointer: */ /* Location of character link count: */ /* Double precision data page parameters: */ /* Usable page size: */ /* Location of d.p. forward pointer: */ /* Location of d.p. link count: */ /* Integer data page parameters: */ /* Usable page size: */ /* Location of integer forward pointer: */ /* Location of integer link count: */ /* End Include Section: EK Data Page Parameters */ /* $ 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. */ /* Include Section: EK Das Paging Parameters */ /* ekpage.inc Version 4 25-AUG-1995 (NJB) */ /* The EK DAS paging system makes use of the integer portion */ /* of an EK file's DAS address space to store the few numbers */ /* required to describe the system's state. The allocation */ /* of DAS integer addresses is shown below. */ /* DAS integer array */ /* +--------------------------------------------+ */ /* | EK architecture code | Address = 1 */ /* +--------------------------------------------+ */ /* | Character page size (in DAS words) | */ /* +--------------------------------------------+ */ /* | Character page base address | */ /* +--------------------------------------------+ */ /* | Number of character pages in file | */ /* +--------------------------------------------+ */ /* | Number of character pages on free list | */ /* +--------------------------------------------+ */ /* | Character free list head pointer | Address = 6 */ /* +--------------------------------------------+ */ /* | | Addresses = */ /* | Metadata for d.p. pages | 7--11 */ /* | | */ /* +--------------------------------------------+ */ /* | | Addresses = */ /* | Metadata for integer pages | 12--16 */ /* | | */ /* +--------------------------------------------+ */ /* . */ /* . */ /* . */ /* +--------------------------------------------+ */ /* | | End Address = */ /* | Unused space | integer page */ /* | | end */ /* +--------------------------------------------+ */ /* | | Start Address = */ /* | First integer page | integer page */ /* | | base */ /* +--------------------------------------------+ */ /* . */ /* . */ /* . */ /* +--------------------------------------------+ */ /* | | */ /* | Last integer page | */ /* | | */ /* +--------------------------------------------+ */ /* The following parameters indicate positions of elements in the */ /* paging system metadata array: */ /* Number of metadata items per data type: */ /* Character metadata indices: */ /* Double precision metadata indices: */ /* Integer metadata indices: */ /* Size of metadata area: */ /* Page sizes, in units of DAS words of the appropriate type: */ /* Default page base addresses: */ /* End Include Section: EK Das Paging Parameters */ /* $ 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. */ /* Include Section: EK Segment Descriptor Parameters */ /* eksegdsc.inc Version 8 06-NOV-1995 (NJB) */ /* All `base addresses' referred to below are the addresses */ /* *preceding* the item the base applies to. This convention */ /* enables simplied address calculations in many cases. */ /* Size of segment descriptor. Note: the include file ekcoldsc.inc */ /* must be updated if this parameter is changed. The parameter */ /* CDOFF in that file should be kept equal to SDSCSZ. */ /* Index of the segment type code: */ /* Index of the segment's number. This number is the segment's */ /* index in the list of segments contained in the EK to which */ /* the segment belongs. */ /* Index of the DAS integer base address of the segment's integer */ /* meta-data: */ /* Index of the DAS character base address of the table name: */ /* Index of the segment's column count: */ /* Index of the segment's record count: */ /* Index of the root page number of the record tree: */ /* Index of the root page number of the character data page tree: */ /* Index of the root page number of the double precision data page */ /* tree: */ /* Index of the root page number of the integer data page tree: */ /* Index of the `modified' flag: */ /* Index of the `initialized' flag: */ /* Index of the shadowing flag: */ /* Index of the companion file handle: */ /* Index of the companion segment number: */ /* The next three items are, respectively, the page numbers of the */ /* last character, d.p., and integer data pages allocated by the */ /* segment: */ /* The next three items are, respectively, the page-relative */ /* indices of the last DAS word in use in the segment's */ /* last character, d.p., and integer data pages: */ /* Index of the DAS character base address of the column name list: */ /* The last descriptor element is reserved for future use. No */ /* parameter is defined to point to this location. */ /* End Include Section: EK Segment Descriptor Parameters */ /* $ 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. */ /* Include Section: EK Data Types */ /* ektype.inc Version 1 27-DEC-1994 (NJB) */ /* Within the EK system, data types of EK column contents are */ /* represented by integer codes. The codes and their meanings */ /* are listed below. */ /* Integer codes are also used within the DAS system to indicate */ /* data types; the EK system makes no assumptions about compatibility */ /* between the codes used here and those used in the DAS system. */ /* Character type: */ /* Double precision type: */ /* Integer type: */ /* `Time' type: */ /* Within the EK system, time values are represented as ephemeris */ /* seconds past J2000 (TDB), and double precision numbers are used */ /* to store these values. However, since time values require special */ /* treatment both on input and output, and since the `TIME' column */ /* has a special role in the EK specification and code, time values */ /* are identified as a type distinct from double precision numbers. */ /* End Include Section: EK Data Types */ /* $ Brief_I/O */ /* Variable I/O Description */ /* -------- --- -------------------------------------------------- */ /* HANDLE I Handle attached to new EK file. */ /* SEGDSC I Segment descriptor. */ /* COLDSC I Column descriptor. */ /* CVALS I Character values to add to column. */ /* NLFLGS I Array of null flags for column entries. */ /* WKINDX I-O Work space for column index. */ /* $ Detailed_Input */ /* HANDLE the handle of an EK file that is open for writing. */ /* A `begin segment for fast load' operation must */ /* have already been performed for the designated */ /* segment. */ /* SEGDSC is a descriptor for the segment to which data is */ /* to be added. The segment descriptor is not */ /* updated by this routine, but some fields in the */ /* descriptor will become invalid after this routine */ /* returns. */ /* COLDSC is a descriptor for the column to be added. The */ /* column attributes must be filled in, but any */ /* pointers may be uninitialized. */ /* CVALS is an array containing the entire set of column */ /* entries for the specified column. The entries */ /* are listed in row-order: the column entry for the */ /* first row of the segment is first, followed by the */ /* column entry for the second row, and so on. The */ /* number of column entries must match the declared */ /* number of rows in the segment. Elements must be */ /* allocated for each column entry, including null */ /* entries. */ /* NLFLGS is an array of logical flags indicating whether */ /* the corresponding entries are null. If the Ith */ /* element of NLFLGS is .FALSE., the Ith column entry */ /* defined by CVALS is added to the specified segment */ /* in the specified kernel file. */ /* If the Ith element of NLFGLS is .TRUE., the */ /* contents of the Ith column entry are undefined. */ /* NLFLGS is used only for columns that allow null */ /* values; it's ignored for other columns. */ /* WKINDX is a work space array used for building a column */ /* index. If the column is indexed, the dimension of */ /* WKINDX must be at NROWS, where NROWS is the number */ /* of rows in the column. If the column is not */ /* indexed, this work space is not used, so the */ /* dimension may be any positive value. */ /* $ Detailed_Output */ /* None. See $Particulars for a description of the effect of this */ /* routine. */ /* $ Parameters */ /* None. */ /* $ Exceptions */ /* 1) If HANDLE is invalid, the error will be diagnosed by routines */ /* called by this routine. */ /* 2) If an I/O error occurs while reading or writing the indicated */ /* file, the error will be diagnosed by routines called by this */ /* routine. */ /* $ Files */ /* See the EK Required Reading for a discussion of the EK file */ /* format. */ /* $ Particulars */ /* This routine operates by side effects: it modifies the named */ /* EK file by adding data to the specified column. This routine */ /* writes the entire contents of the specified column in one shot. */ /* This routine creates columns much more efficiently than can be */ /* done by sequential calls to EKACEC, but has the drawback that */ /* the caller must use more memory for the routine's inputs. This */ /* routine cannot be used to add data to a partially completed */ /* column. */ /* Class 9 columns have fixed record counts, and contain */ /* fixed-length strings. */ /* $ Examples */ /* See EKACLC. */ /* $ Restrictions */ /* 1) This routine assumes the EK file has been set up */ /* properly for a fast load operation. */ /* $ Literature_References */ /* None. */ /* $ Author_and_Institution */ /* N.J. Bachman (JPL) */ /* $ Version */ /* - Beta Version 1.0.0, 09-NOV-1995 (NJB) */ /* -& */ /* SPICELIB functions */ /* Local variables */ /* Standard SPICE error handling. */ if (return_()) { return 0; } else { chkin_("ZZEKAC09", (ftnlen)8); } /* Grab the column's attributes. Initialize the maximum non-blank */ /* width of the column. */ class__ = coldsc[0]; idxtyp = coldsc[5]; nulptr = coldsc[7]; colidx = coldsc[8]; l = coldsc[2]; nullok = nulptr != -1; indexd = idxtyp != -1; fixlen = l != -1; /* This column had better be class 9. */ if (class__ != 9) { zzekcnam_(handle, coldsc, column, (ftnlen)32); setmsg_("Column class code # found in descriptor for column #. Clas" "s should be 9.", (ftnlen)73); errint_("#", &class__, (ftnlen)1); errch_("#", column, (ftnlen)1, (ftnlen)32); sigerr_("SPICE(NOCLASS)", (ftnlen)14); chkout_("ZZEKAC09", (ftnlen)8); return 0; } /* Make sure the column has fixed-length strings. */ if (! fixlen) { zzekcnam_(handle, coldsc, column, (ftnlen)32); setmsg_("Column # has variable string length; class 9 supports fixed" "-length strings only.", (ftnlen)80); errch_("#", column, (ftnlen)1, (ftnlen)32); sigerr_("SPICE(BUG)", (ftnlen)10); chkout_("ZZEKAC09", (ftnlen)8); return 0; } /* Check the input string length. */ if (l < 0 || l > i_len(cvals, cvals_len) || l > 1014) { setmsg_("String length # is just plain wrong.", (ftnlen)36); errint_("#", &l, (ftnlen)1); sigerr_("SPICE(INVALIDSIZE)", (ftnlen)18); chkout_("ZZEKAC09", (ftnlen)8); return 0; } /* Compute the number of strings we can hold in one page. */ spp = 1014 / l; /* Find the number of rows in the segment. */ nrows = segdsc[5]; /* Decide how many pages are required to hold the array, and */ /* allocate that many new, contiguous pages. */ npage = (nrows + spp - 1) / spp; zzekacps_(handle, segdsc, &c__1, &npage, &p, &datbas); /* We'll use FROM to indicate the element of CVALS we're */ /* considering and TO to indicate the element of PAGE to write */ /* to. */ to = 1; s_copy(page, " ", (ftnlen)1024, (ftnlen)1); i__1 = nrows; for (from = 1; from <= i__1; ++from) { /* The Assignment. */ if (! nullok || ! nlflgs[from - 1]) { s_copy(page + (to - 1), cvals + (from - 1) * cvals_len, to + l - 1 - (to - 1), cvals_len); } to += l; if (to > 1014 - l + 1 || from == nrows) { /* Either the current data page is full, or we've buffered */ /* the last of the available data. It's time to write out the */ /* current page. */ zzekpgwc_(handle, &p, page, (ftnlen)1024); /* Set the link count. */ i__2 = (to - l) / l; zzekslnk_(handle, &c__1, &p, &i__2); /* Next page. */ ++p; to = 1; } } /* Update the column's metadata area to point to the data array. */ cmbase = coldsc[9]; i__1 = cmbase + 1; i__2 = cmbase + 1; dasudi_(handle, &i__1, &i__2, &datbas); /* If the column is supposed to have an index, now is the time to */ /* build that index. Type 2 indexes are just order vectors. */ if (indexd) { /* Compute the order vector. */ zzekordc_(cvals, &nullok, nlflgs, &nrows, wkindx, cvals_len); /* Write out the index. */ zzekwpai_(handle, segdsc, &nrows, wkindx, &idxpag, &idxbas); /* Update the column's metadata to point to the index. The */ /* pointer indicates base address of the index. Also set the */ /* index type in the column descriptor. */ mbase = segdsc[2]; dscbas = mbase + 24 + (colidx - 1) * 11; i__1 = dscbas + 7; i__2 = dscbas + 7; dasudi_(handle, &i__1, &i__2, &idxbas); i__1 = dscbas + 6; i__2 = dscbas + 6; dasudi_(handle, &i__1, &i__2, &c__2); } if (nullok) { /* Nulls are allowed. Write out the null flag array. */ zzekwpal_(handle, segdsc, &nrows, nlflgs, &nflpag, &nflbas); /* Update the column's metadata area to point to the null flag */ /* array. */ i__1 = cmbase + 2; i__2 = cmbase + 2; dasudi_(handle, &i__1, &i__2, &nflbas); } chkout_("ZZEKAC09", (ftnlen)8); return 0; } /* zzekac09_ */
/* $Procedure ZZEKDE05 ( EK, delete column entry, class 5 ) */ /* Subroutine */ int zzekde05_(integer *handle, integer *segdsc, integer * coldsc, integer *recptr) { /* System generated locals */ integer i__1, i__2; /* Builtin functions */ integer i_dnnt(doublereal *); /* Local variables */ integer base, nrec; extern integer zzekrp2n_(integer *, integer *, integer *); integer next, unit; extern /* Subroutine */ int zzekpgch_(integer *, char *, ftnlen), zzekgfwd_(integer *, integer *, integer *, integer *), zzekglnk_( integer *, integer *, integer *, integer *), zzekpgpg_(integer *, integer *, integer *, integer *), zzekslnk_(integer *, integer *, integer *, integer *); integer p; extern /* Subroutine */ int chkin_(char *, ftnlen); integer recno, nseen, ncols, nelts; extern logical failed_(void); extern /* Subroutine */ int dasrdd_(integer *, integer *, integer *, doublereal *), dasrdi_(integer *, integer *, integer *, integer *) , dasudi_(integer *, integer *, integer *, integer *); extern logical return_(void); doublereal dpnelt; integer datptr, nlinks, ptrloc; extern /* Subroutine */ int chkout_(char *, ftnlen), dashlu_(integer *, integer *), setmsg_(char *, ftnlen), errint_(char *, integer *, ftnlen), errfnm_(char *, integer *, ftnlen), sigerr_(char *, ftnlen), zzekdps_(integer *, integer *, integer *, integer *); /* $ Abstract */ /* Delete a specified class 5 column entry from an EK record. */ /* $ 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 */ /* EK */ /* $ Keywords */ /* PRIVATE */ /* UTILITY */ /* $ Declarations */ /* $ 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. */ /* Include Section: EK Boolean Enumerated Type */ /* ekbool.inc Version 1 21-DEC-1994 (NJB) */ /* Within the EK system, boolean values sometimes must be */ /* represented by integer or character codes. The codes and their */ /* meanings are listed below. */ /* Integer code indicating `true': */ /* Integer code indicating `false': */ /* Character code indicating `true': */ /* Character code indicating `false': */ /* End Include Section: EK Boolean Enumerated Type */ /* $ 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. */ /* Include Section: EK Column Descriptor Parameters */ /* ekcoldsc.inc Version 6 23-AUG-1995 (NJB) */ /* Note: The column descriptor size parameter CDSCSZ is */ /* declared separately in the include section CDSIZE$INC.FOR. */ /* Offset of column descriptors, relative to start of segment */ /* integer address range. This number, when added to the last */ /* integer address preceding the segment, yields the DAS integer */ /* base address of the first column descriptor. Currently, this */ /* offset is exactly the size of a segment descriptor. The */ /* parameter SDSCSZ, which defines the size of a segment descriptor, */ /* is declared in the include file eksegdsc.inc. */ /* Size of column descriptor */ /* Indices of various pieces of column descriptors: */ /* CLSIDX is the index of the column's class code. (We use the */ /* word `class' to distinguish this item from the column's data */ /* type.) */ /* TYPIDX is the index of the column's data type code (CHR, INT, DP, */ /* or TIME). The type is actually implied by the class, but it */ /* will frequently be convenient to look up the type directly. */ /* LENIDX is the index of the column's string length value, if the */ /* column has character type. A value of IFALSE in this element of */ /* the descriptor indicates that the strings have variable length. */ /* SIZIDX is the index of the column's element size value. This */ /* descriptor element is meaningful for columns with fixed-size */ /* entries. For variable-sized columns, this value is IFALSE. */ /* NAMIDX is the index of the base address of the column's name. */ /* IXTIDX is the data type of the column's index. IXTIDX */ /* contains a type value only if the column is indexed. For columns */ /* that are not indexed, the location IXTIDX contains the boolean */ /* value IFALSE. */ /* IXPIDX is a pointer to the column's index. IXTPDX contains a */ /* meaningful value only if the column is indexed. The */ /* interpretation of the pointer depends on the data type of the */ /* index. */ /* NFLIDX is the index of a flag indicating whether nulls are */ /* permitted in the column. The value at location NFLIDX is */ /* ITRUE if nulls are permitted and IFALSE otherwise. */ /* ORDIDX is the index of the column's ordinal position in the */ /* list of columns belonging to the column's parent segment. */ /* METIDX is the index of the column's integer metadata pointer. */ /* This pointer is a DAS integer address. */ /* The last position in the column descriptor is reserved. No */ /* parameter is defined to point to this location. */ /* End Include Section: EK Column Descriptor Parameters */ /* $ 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. */ /* Include Section: EK Data Page Parameters */ /* ekfilpar.inc Version 1 03-APR-1995 (NJB) */ /* These parameters apply to EK files using architecture 4. */ /* These files use a paged DAS file as their underlying file */ /* structure. */ /* In paged DAS EK files, data pages are structured: they contain */ /* metadata as well as data. The metadata is located in the last */ /* few addresses of each page, so as to interfere as little as */ /* possible with calculation of data addresses. */ /* Each data page belongs to exactly one segment. Some bookkeeping */ /* information, such as record pointers, is also stored in data */ /* pages. */ /* Each page contains a forward pointer that allows rapid lookup */ /* of data items that span multiple pages. Each page also keeps */ /* track of the current number of links from its parent segment */ /* to the page. Link counts enable pages to `know' when they */ /* are no longer in use by a segment; unused pages are deallocated */ /* and returned to the free list. */ /* The parameters in this include file depend on the parameters */ /* declared in the include file ekpage.inc. If those parameters */ /* change, this file must be updated. The specified parameter */ /* declarations we need from that file are: */ /* INTEGER PGSIZC */ /* PARAMETER ( PGSIZC = 1024 ) */ /* INTEGER PGSIZD */ /* PARAMETER ( PGSIZD = 128 ) */ /* INTEGER PGSIZI */ /* PARAMETER ( PGSIZI = 256 ) */ /* Character pages use an encoding mechanism to represent integer */ /* metadata. Each integer is encoded in five consecutive */ /* characters. */ /* Character data page parameters: */ /* Size of encoded integer: */ /* Usable page size: */ /* Location of character forward pointer: */ /* Location of character link count: */ /* Double precision data page parameters: */ /* Usable page size: */ /* Location of d.p. forward pointer: */ /* Location of d.p. link count: */ /* Integer data page parameters: */ /* Usable page size: */ /* Location of integer forward pointer: */ /* Location of integer link count: */ /* End Include Section: EK Data Page Parameters */ /* $ 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. */ /* Include Section: EK Record Pointer Parameters */ /* ekrecptr.inc Version 2 18-JUL-1995 (NJB) */ /* This file declares parameters used in EK record pointers. */ /* Each segment references data in a given record via two levels */ /* of indirection: a record number points to a record pointer, */ /* which is a structured array of metadata and data pointers. */ /* Record pointers always occupy contiguous ranges of integer */ /* addresses. */ /* The parameter declarations in this file depend on the assumption */ /* that integer pages contain 256 DAS integer words and that the */ /* maximum number of columns in a segment is 100. Record pointers */ /* are stored in integer data pages, so they must fit within the */ /* usable data area afforded by these pages. The size of the usable */ /* data area is given by the parameter IPSIZE which is declared in */ /* ekdatpag.inc. The assumed value of IPSIZE is 254. */ /* The first element of each record pointer is a status indicator. */ /* The meanings of status indicators depend on whether the parent EK */ /* is shadowed or not. For shadowed EKs, allowed status values and */ /* their meanings are: */ /* OLD The record has not been modified since */ /* the EK containing the record was opened. */ /* UPDATE The record is an update of a previously existing */ /* record. The original record is now on the */ /* modified record list. */ /* NEW The record has been added since the EK containing the */ /* record was opened. The record is not an update */ /* of a previously existing record. */ /* DELOLD This status applies only to a backup record. */ /* DELOLD status indicates that the record corresponds */ /* to a deleted OLD record in the source segment. */ /* DELNEW This status applies only to a backup record. */ /* DELNEW status indicates that the record corresponds */ /* to a deleted NEW record in the source segment. */ /* DELUPD This status applies only to a backup record. */ /* DELUPD status indicates that the record corresponds */ /* to a deleted UPDATEd record in the source segment. */ /* In EKs that are not shadowed, all records have status OLD. */ /* The following parameters refer to indices within the record */ /* pointer structure: */ /* Index of status indicator: */ /* Each record pointer contains a pointer to its companion: for a */ /* record belonging to a shadowed EK, this is the backup counterpart, */ /* or if the parent EK is itself a backup EK, a pointer to the */ /* record's source record. The pointer is UNINIT (see below) if the */ /* record is unmodified. */ /* Record companion pointers contain record numbers, not record */ /* base addresses. */ /* Index of record's companion pointer: */ /* Each data item is referenced by an integer. The meaning of */ /* this integer depends on the representation of data in the */ /* column to which the data item belongs. Actual lookup of a */ /* data item must be done by subroutines appropriate to the class of */ /* the column to which the item belongs. Note that data items don't */ /* necessarily occupy contiguous ranges of DAS addresses. */ /* Base address of data pointers: */ /* Maximum record pointer size: */ /* Data pointers are given the value UNINIT to start with; this */ /* indicates that the data item is uninitialized. UNINIT is */ /* distinct from the value NULL. NOBACK indicates an uninitialized */ /* backup column entry. */ /* End Include Section: EK Record Pointer Parameters */ /* $ 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. */ /* Include Section: EK Segment Descriptor Parameters */ /* eksegdsc.inc Version 8 06-NOV-1995 (NJB) */ /* All `base addresses' referred to below are the addresses */ /* *preceding* the item the base applies to. This convention */ /* enables simplied address calculations in many cases. */ /* Size of segment descriptor. Note: the include file ekcoldsc.inc */ /* must be updated if this parameter is changed. The parameter */ /* CDOFF in that file should be kept equal to SDSCSZ. */ /* Index of the segment type code: */ /* Index of the segment's number. This number is the segment's */ /* index in the list of segments contained in the EK to which */ /* the segment belongs. */ /* Index of the DAS integer base address of the segment's integer */ /* meta-data: */ /* Index of the DAS character base address of the table name: */ /* Index of the segment's column count: */ /* Index of the segment's record count: */ /* Index of the root page number of the record tree: */ /* Index of the root page number of the character data page tree: */ /* Index of the root page number of the double precision data page */ /* tree: */ /* Index of the root page number of the integer data page tree: */ /* Index of the `modified' flag: */ /* Index of the `initialized' flag: */ /* Index of the shadowing flag: */ /* Index of the companion file handle: */ /* Index of the companion segment number: */ /* The next three items are, respectively, the page numbers of the */ /* last character, d.p., and integer data pages allocated by the */ /* segment: */ /* The next three items are, respectively, the page-relative */ /* indices of the last DAS word in use in the segment's */ /* last character, d.p., and integer data pages: */ /* Index of the DAS character base address of the column name list: */ /* The last descriptor element is reserved for future use. No */ /* parameter is defined to point to this location. */ /* End Include Section: EK Segment Descriptor Parameters */ /* $ 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. */ /* Include Section: EK Data Types */ /* ektype.inc Version 1 27-DEC-1994 (NJB) */ /* Within the EK system, data types of EK column contents are */ /* represented by integer codes. The codes and their meanings */ /* are listed below. */ /* Integer codes are also used within the DAS system to indicate */ /* data types; the EK system makes no assumptions about compatibility */ /* between the codes used here and those used in the DAS system. */ /* Character type: */ /* Double precision type: */ /* Integer type: */ /* `Time' type: */ /* Within the EK system, time values are represented as ephemeris */ /* seconds past J2000 (TDB), and double precision numbers are used */ /* to store these values. However, since time values require special */ /* treatment both on input and output, and since the `TIME' column */ /* has a special role in the EK specification and code, time values */ /* are identified as a type distinct from double precision numbers. */ /* End Include Section: EK Data Types */ /* $ Brief_I/O */ /* Variable I/O Description */ /* -------- --- -------------------------------------------------- */ /* HANDLE I File handle. */ /* SEGDSC I Segment descriptor. */ /* COLDSC I Column descriptor. */ /* RECPTR I Record pointer. */ /* $ Detailed_Input */ /* HANDLE is a file handle of an EK open for write access. */ /* SEGDSC is the descriptor of the segment from which to */ /* delete the specified column entry. */ /* COLDSC is the descriptor of the column from which to */ /* delete the specified column entry. */ /* RECPTR is a pointer to the record containing the column */ /* entry to delete. */ /* $ Detailed_Output */ /* None. See the $Particulars section for a description of the */ /* effect of this routine. */ /* $ Parameters */ /* None. */ /* $ Exceptions */ /* 1) If HANDLE is invalid, the error will be diagnosed by routines */ /* called by this routine. The file will not be modified. */ /* 2) If an I/O error occurs while reading or writing the indicated */ /* file, the error will be diagnosed by routines called by this */ /* routine. The file may be corrupted. */ /* $ Files */ /* See the EK Required Reading for a discussion of the EK file */ /* format. */ /* $ Particulars */ /* This routine operates by side effects: it deletes a column entry */ /* from an EK segment. The status of the record containing the entry */ /* is set to `updated'. The deleted entry is marked as */ /* `uninitialized'. */ /* The link counts for the pages containing the deleted column entry */ /* are decremented. If the count for a page becomes zero, that page */ /* is freed. If the entry to be deleted is already uninitialized */ /* upon entry to this routine, no link counts are modified. The */ /* record containing the entry is still marked `updated' in this */ /* case. */ /* The changes made by this routine to the target EK file become */ /* permanent when the file is closed. Failure to close the file */ /* properly will leave it in an indeterminate state. */ /* $ Examples */ /* See EKDELR. */ /* $ Restrictions */ /* None. */ /* $ Literature_References */ /* None. */ /* $ Author_and_Institution */ /* N.J. Bachman (JPL) */ /* $ Version */ /* - Beta Version 1.0.0, 28-SEP-1995 (NJB) */ /* -& */ /* SPICELIB functions */ /* Non-SPICELIB functions */ /* Local variables */ /* Standard SPICE error handling. */ if (return_()) { return 0; } else { chkin_("ZZEKDE05", (ftnlen)8); } /* Before trying to actually modify the file, do every error */ /* check we can. */ /* Is this file handle valid--is the file open for paged write */ /* access? Signal an error if not. */ zzekpgch_(handle, "WRITE", (ftnlen)5); if (failed_()) { chkout_("ZZEKDE05", (ftnlen)8); return 0; } /* We'll need to know how many columns the segment has in order to */ /* compute the size of the record pointer. The record pointer */ /* contains DPTBAS items plus two elements for each column. */ ncols = segdsc[4]; nrec = segdsc[5]; /* Compute the data pointer location. If the data pointer is */ /* already set to `uninitialized', there's nothing to do. If */ /* the element is null, just set it to `uninitialized'. The */ /* presence of actual data obligates us to clean up, however. */ ptrloc = *recptr + 2 + coldsc[8]; dasrdi_(handle, &ptrloc, &ptrloc, &datptr); if (datptr > 0) { /* Get the element count for the entry. */ dasrdd_(handle, &datptr, &datptr, &dpnelt); nelts = i_dnnt(&dpnelt); /* Set the data pointer to indicate the item is uninitialized. */ dasudi_(handle, &ptrloc, &ptrloc, &c_n1); /* Find the number of the page containing the column entry. */ zzekpgpg_(&c__2, &datptr, &p, &base); /* Look up the forward pointer. This pointer will be valid */ /* if the column entry is continued on another page. */ zzekgfwd_(handle, &c__2, &p, &next); /* Get the link count for the current page. If we have more */ /* than one link to the page, decrement the link count. If */ /* we're down to one link, this deletion will finish off the */ /* page: we'll deallocate it. */ zzekglnk_(handle, &c__2, &p, &nlinks); if (nlinks > 1) { i__1 = nlinks - 1; zzekslnk_(handle, &c__2, &p, &i__1); } else { /* If we removed the last item from the page, we can delete */ /* the page. ZZEKDPS adjusts the segment's metadata */ /* to reflect the deallocation. */ zzekdps_(handle, segdsc, &c__2, &p); } /* Computing MIN */ i__1 = nelts, i__2 = base + 126 - datptr; nseen = min(i__1,i__2); while(nseen < nelts && ! failed_()) { /* The column entry is continued on the page indicated by */ /* NEXT. */ /* Get the link count for the current page. If we have more */ /* than one link to the page, decrement the link count. If */ /* we're down to one link, this deletion will finish off the */ /* page: we'll deallocate it. */ p = next; zzekgfwd_(handle, &c__2, &p, &next); zzekglnk_(handle, &c__2, &p, &nlinks); if (nlinks > 1) { i__1 = nlinks - 1; zzekslnk_(handle, &c__2, &p, &i__1); } else { /* If we removed the last item from the page, we can delete */ /* the page. ZZEKDPS adjusts the segment's metadata */ /* to reflect the deallocation. */ zzekdps_(handle, segdsc, &c__2, &p); } /* Computing MIN */ i__1 = nelts, i__2 = nseen + 126; nseen = min(i__1,i__2); } } else if (datptr == -2) { /* Mark the entry as `uninitialized'. */ dasudi_(handle, &ptrloc, &ptrloc, &c_n1); } else if (datptr != -1) { /* UNINIT was the last valid possibility. The data pointer is */ /* corrupted. */ recno = zzekrp2n_(handle, &segdsc[1], recptr); dashlu_(handle, &unit); setmsg_("Data pointer is corrupted. SEGNO = #; COLIDX = #; RECNO = " "#; EK = #", (ftnlen)68); errint_("#", &segdsc[1], (ftnlen)1); errint_("#", &coldsc[8], (ftnlen)1); errint_("#", &recno, (ftnlen)1); errfnm_("#", &unit, (ftnlen)1); sigerr_("SPICE(BUG)", (ftnlen)10); chkout_("ZZEKDE05", (ftnlen)8); return 0; } /* Set the record's status to indicate that this record is updated. */ i__1 = *recptr + 1; i__2 = *recptr + 1; dasudi_(handle, &i__1, &i__2, &c__2); chkout_("ZZEKDE05", (ftnlen)8); return 0; } /* zzekde05_ */
/* $Procedure ZZEKACPS ( EK, allocate contiguous pages for segment ) */ /* Subroutine */ int zzekacps_(integer *handle, integer *segdsc, integer * type__, integer *n, integer *p, integer *base) { /* System generated locals */ integer i__1, i__2; /* Local variables */ integer tree; extern /* Subroutine */ int zzekpgan_(integer *, integer *, integer *, integer *), zzeksfwd_(integer *, integer *, integer *, integer *), zzektrap_(integer *, integer *, integer *, integer *), zzekslnk_( integer *, integer *, integer *, integer *); integer b, i__, p2; extern logical failed_(void); integer idx; /* $ Abstract */ /* Allocate a series of contiguous data pages for a specified EK */ /* segment. */ /* $ 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 */ /* EK */ /* $ Keywords */ /* PRIVATE */ /* UTILITY */ /* $ Declarations */ /* $ 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. */ /* Include Section: EK Segment Descriptor Parameters */ /* eksegdsc.inc Version 8 06-NOV-1995 (NJB) */ /* All `base addresses' referred to below are the addresses */ /* *preceding* the item the base applies to. This convention */ /* enables simplied address calculations in many cases. */ /* Size of segment descriptor. Note: the include file ekcoldsc.inc */ /* must be updated if this parameter is changed. The parameter */ /* CDOFF in that file should be kept equal to SDSCSZ. */ /* Index of the segment type code: */ /* Index of the segment's number. This number is the segment's */ /* index in the list of segments contained in the EK to which */ /* the segment belongs. */ /* Index of the DAS integer base address of the segment's integer */ /* meta-data: */ /* Index of the DAS character base address of the table name: */ /* Index of the segment's column count: */ /* Index of the segment's record count: */ /* Index of the root page number of the record tree: */ /* Index of the root page number of the character data page tree: */ /* Index of the root page number of the double precision data page */ /* tree: */ /* Index of the root page number of the integer data page tree: */ /* Index of the `modified' flag: */ /* Index of the `initialized' flag: */ /* Index of the shadowing flag: */ /* Index of the companion file handle: */ /* Index of the companion segment number: */ /* The next three items are, respectively, the page numbers of the */ /* last character, d.p., and integer data pages allocated by the */ /* segment: */ /* The next three items are, respectively, the page-relative */ /* indices of the last DAS word in use in the segment's */ /* last character, d.p., and integer data pages: */ /* Index of the DAS character base address of the column name list: */ /* The last descriptor element is reserved for future use. No */ /* parameter is defined to point to this location. */ /* End Include Section: EK Segment Descriptor Parameters */ /* $ 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. */ /* Include Section: EK Data Types */ /* ektype.inc Version 1 27-DEC-1994 (NJB) */ /* Within the EK system, data types of EK column contents are */ /* represented by integer codes. The codes and their meanings */ /* are listed below. */ /* Integer codes are also used within the DAS system to indicate */ /* data types; the EK system makes no assumptions about compatibility */ /* between the codes used here and those used in the DAS system. */ /* Character type: */ /* Double precision type: */ /* Integer type: */ /* `Time' type: */ /* Within the EK system, time values are represented as ephemeris */ /* seconds past J2000 (TDB), and double precision numbers are used */ /* to store these values. However, since time values require special */ /* treatment both on input and output, and since the `TIME' column */ /* has a special role in the EK specification and code, time values */ /* are identified as a type distinct from double precision numbers. */ /* End Include Section: EK Data Types */ /* $ Brief_I/O */ /* Variable I/O Description */ /* -------- --- -------------------------------------------------- */ /* HANDLE I File handle. */ /* SEGDSC I Segment descriptor. */ /* TYPE I Data type of page. */ /* N I Number of pages to allocate. */ /* P O Page number. */ /* BASE O DAS base address of page. */ /* $ Detailed_Input */ /* HANDLE is a file handle of an EK open for write access. */ /* SEGDSC is the descriptor of the segment for which to */ /* allocate a series of data pages. */ /* TYPE is the data type of the desired pages. */ /* N is the number of pages desired. All pages */ /* allocated are new. A new page is one that has not */ /* been allocated before. */ /* $ Detailed_Output */ /* P is the number of the first page of the allocated */ /* series. The rest of the pages have numbers */ /* P+1, P+2, ... , P+N-1 */ /* These numbers are recognized by the EK paged access */ /* routines. */ /* BASE is the DAS base address of the first allocated */ /* page. */ /* $ Parameters */ /* None. */ /* $ Exceptions */ /* 1) If HANDLE is invalid, the error will be diagnosed by routines */ /* called by this routine. The file will not be modified. */ /* 2) If an I/O error occurs while reading or writing the indicated */ /* file, the error will be diagnosed by routines called by this */ /* routine. The file may be corrupted. */ /* $ Files */ /* See the EK Required Reading for a discussion of the EK file */ /* format. */ /* $ Particulars */ /* This routine operates by side effects: it allocates a series of */ /* new, contiguous EK data pages for a specified segment. The */ /* segment's metadata are updated to reflect aquisition of the pages. */ /* This routine, not ZZEKAPS, should be used when contiguous pages */ /* are required. */ /* Each allocated page is initialized as follows: */ /* - The page's link count is zeroed out. */ /* - The page's forward pointer is zeroed out. */ /* After all pages are allocated, the metadata for the segment are */ /* adjusted to reflect ownership of the allocated pages. */ /* The changes made by this routine to the target EK file become */ /* permanent when the file is closed. Failure to close the file */ /* properly will leave it in an indeterminate state. */ /* $ Examples */ /* See ZZEKWPAI. */ /* $ Restrictions */ /* None. */ /* $ Literature_References */ /* None. */ /* $ Author_and_Institution */ /* N.J. Bachman (JPL) */ /* $ Version */ /* - Beta Version 1.0.0, 09-NOV-1995 (NJB) */ /* -& */ /* SPICELIB functions */ /* Local variables */ /* Use discovery check-in. */ /* Allocate the pages. */ zzekpgan_(handle, type__, p, base); i__1 = *n; for (i__ = 2; i__ <= i__1; ++i__) { zzekpgan_(handle, type__, &p2, &b); } if (failed_()) { return 0; } /* Initialize the pages. */ i__1 = *n; for (i__ = 1; i__ <= i__1; ++i__) { /* Zero out the page's link count and forward pointer. */ i__2 = *p + i__ - 1; zzekslnk_(handle, type__, &i__2, &c__0); i__2 = *p + i__ - 1; zzeksfwd_(handle, type__, &i__2, &c__0); } /* Update the segment's metadata. Insert the number of each new */ /* page into the page tree of the appropriate data type. */ if (*type__ == 1) { tree = segdsc[7]; } else if (*type__ == 2) { tree = segdsc[8]; } else { /* The remaining possibility is that TYPE is INT. If we had had */ /* an unrecognized type, one of the allocation routines would have */ /* complained. */ tree = segdsc[9]; } i__1 = *n; for (i__ = 1; i__ <= i__1; ++i__) { i__2 = *p + i__ - 1; zzektrap_(handle, &tree, &i__2, &idx); } return 0; } /* zzekacps_ */