1 /* syfeti.f -- translated by f2c (version 19980913).
2 You must link the resulting object file with the libraries:
3 -lf2c -lm (in that order)
4 */
5
6 #include "f2c.h"
7
8 /* $Procedure SYFETI ( Fetch the Nth symbol in the table ) */
syfeti_(integer * nth,char * tabsym,integer * tabptr,integer * tabval,char * name__,logical * found,ftnlen tabsym_len,ftnlen name_len)9 /* Subroutine */ int syfeti_(integer *nth, char *tabsym, integer *tabptr,
10 integer *tabval, char *name__, logical *found, ftnlen tabsym_len,
11 ftnlen name_len)
12 {
13 /* Builtin functions */
14 /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen);
15
16 /* Local variables */
17 integer nsym;
18 extern integer cardc_(char *, ftnlen);
19 extern /* Subroutine */ int chkin_(char *, ftnlen), chkout_(char *,
20 ftnlen);
21 extern logical return_(void);
22
23 /* $ Abstract */
24
25 /* Fetch the Nth symbol in an integer symbol table. */
26
27 /* $ Disclaimer */
28
29 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
30 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
31 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
32 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
33 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
34 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
35 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
36 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
37 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
38 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
39
40 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
41 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
42 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
43 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
44 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
45 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
46
47 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
48 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
49 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
50 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
51
52 /* $ Required_Reading */
53
54 /* SYMBOLS */
55
56 /* $ Keywords */
57
58 /* SYMBOLS */
59
60 /* $ Declarations */
61 /* $ Brief_I/O */
62
63 /* VARIABLE I/O DESCRIPTION */
64 /* -------- --- -------------------------------------------------- */
65 /* NTH I Index of symbol to be fetched. */
66 /* TABSYM, */
67 /* TABPTR, */
68 /* TABVAL I Components of the symbol table. */
69 /* NAME O Name of the NTH symbol in the symbol table. */
70 /* FOUND O True if the NTH symbol is in the symbol table, */
71 /* false if it is not. */
72
73 /* $ Detailed_Input */
74
75 /* NTH is the index of the symbol to be fetched. If the NTH */
76 /* symbol does not exist, FOUND is FALSE. */
77
78 /* TABSYM, */
79 /* TABPTR, */
80 /* TABVAL are the components of an integer symbol table. */
81 /* The NTH symbol may or may not be in the symbol */
82 /* table. The symbol table is not modified by this */
83 /* subroutine. */
84
85 /* $ Detailed_Output */
86
87 /* NAME is the name of the NTH symbol in the symbol table. */
88
89 /* FOUND is true if the NTH symbol is in the symbol table. */
90 /* If the NTH symbol is not in the table, FOUND is false. */
91
92 /* $ Parameters */
93
94 /* None. */
95
96 /* $ Files */
97
98 /* None. */
99
100 /* $ Exceptions */
101
102 /* None. */
103
104 /* $ Particulars */
105
106 /* None. */
107
108 /* $ Examples */
109
110 /* The contents of the symbol table are: */
111
112 /* books --> 5 */
113 /* erasers --> 6 */
114 /* pencils --> 12 */
115 /* pens --> 10 */
116 /* 12 */
117 /* 24 */
118
119 /* The calls, */
120
121 /* CALL SYFETI ( 2, TABSYM, TABPTR, TABVAL, NAME, FOUND ) */
122 /* CALL SYFETI ( 3, TABSYM, TABPTR, TABVAL, NAME, FOUND ) */
123 /* CALL SYFETI ( -1, TABSYM, TABPTR, TABVAL, NAME, FOUND ) */
124 /* CALL SYFETI ( 6, TABSYM, TABPTR, TABVAL, NAME, FOUND ) */
125
126 /* result in the values for NAME and FOUND: */
127
128 /* NAME FOUND */
129 /* ---------- ----- */
130 /* erasers TRUE */
131 /* pencils TRUE */
132 /* FALSE */
133 /* FALSE */
134
135 /* $ Restrictions */
136
137 /* None. */
138
139 /* $ Literature_References */
140
141 /* None. */
142
143 /* $ Author_and_Institution */
144
145 /* N.J. Bachman (JPL) */
146 /* H.A. Neilan (JPL) */
147 /* I.M. Underwood (JPL) */
148
149 /* $ Version */
150
151 /* - SPICELIB Version 1.0.1, 10-MAR-1992 (WLT) */
152
153 /* Comment section for permuted index source lines was added */
154 /* following the header. */
155
156 /* - SPICELIB Version 1.0.0, 31-JAN-1990 (IMU) (HAN) */
157
158 /* -& */
159 /* $ Index_Entries */
160
161 /* fetch the nth symbol in the table */
162
163 /* -& */
164 /* $ Revisions */
165
166 /* - Beta Version 1.1.0, 17-FEB-1989 (NJB) */
167
168 /* Declaration of the unused variable SUMAI removed. */
169
170 /* -& */
171
172 /* SPICELIB functions */
173
174
175 /* Local variables */
176
177
178 /* Standard SPICE error handling. */
179
180 if (return_()) {
181 return 0;
182 } else {
183 chkin_("SYFETI", (ftnlen)6);
184 }
185
186 /* How many symbols to start with? */
187
188 nsym = cardc_(tabsym, tabsym_len);
189
190 /* If the value of NTH is out of range, that's a problem. */
191
192 if (*nth < 1 || *nth > nsym) {
193 *found = FALSE_;
194
195 /* Otherwise, we can proceed without fear of error. Merely locate */
196 /* and return the appropriate component from the values table. */
197
198 } else {
199 *found = TRUE_;
200 s_copy(name__, tabsym + (*nth + 5) * tabsym_len, name_len, tabsym_len)
201 ;
202 }
203 chkout_("SYFETI", (ftnlen)6);
204 return 0;
205 } /* syfeti_ */
206
207