1 /* syordd.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      SYORDD ( Order the components of a single symbol ) */
syordd_(char * name__,char * tabsym,integer * tabptr,doublereal * tabval,ftnlen name_len,ftnlen tabsym_len)9 /* Subroutine */ int syordd_(char *name__, char *tabsym, integer *tabptr,
10 	doublereal *tabval, ftnlen name_len, ftnlen tabsym_len)
11 {
12     /* System generated locals */
13     integer i__1;
14 
15     /* Local variables */
16     integer nsym;
17     extern integer cardc_(char *, ftnlen);
18     integer n;
19     extern /* Subroutine */ int chkin_(char *, ftnlen);
20     extern integer sumai_(integer *, integer *), bsrchc_(char *, integer *,
21 	    char *, ftnlen, ftnlen);
22     extern /* Subroutine */ int shelld_(integer *, doublereal *);
23     integer locval;
24     extern /* Subroutine */ int chkout_(char *, ftnlen);
25     integer locsym;
26     extern logical return_(void);
27 
28 /* $ Abstract */
29 
30 /*     Order the components of a single symbol in a double precision */
31 /*     symbol table. The components are sorted in increasing order. */
32 
33 /* $ Disclaimer */
34 
35 /*     THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
36 /*     CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
37 /*     GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
38 /*     ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
39 /*     PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
40 /*     TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
41 /*     WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
42 /*     PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
43 /*     SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
44 /*     SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
45 
46 /*     IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
47 /*     BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
48 /*     LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
49 /*     INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
50 /*     REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
51 /*     REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
52 
53 /*     RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
54 /*     THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
55 /*     CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
56 /*     ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
57 
58 /* $ Required_Reading */
59 
60 /*     SYMBOLS */
61 
62 /* $ Keywords */
63 
64 /*     SYMBOLS */
65 
66 /* $ Declarations */
67 /* $ Brief_I/O */
68 
69 /*     VARIABLE  I/O  DESCRIPTION */
70 /*     --------  ---  -------------------------------------------------- */
71 /*     NAME       I   Name of the symbol whose components are to be */
72 /*                    ordered. */
73 /*     TABSYM, */
74 /*     TABPTR, */
75 /*     TABVAL    I/O  Components of the symbol table. */
76 
77 /* $ Detailed_Input */
78 
79 /*     NAME       is the name of the symbol whose components are to be */
80 /*                ordered. If NAME is not in the symbol table, the symbol */
81 /*                table is not modified. */
82 
83 /*     TABSYM, */
84 /*     TABPTR, */
85 /*     TABVAL     are the components of a double precision symbol table. */
86 
87 /* $ Detailed_Output */
88 
89 /*     TABSYM, */
90 /*     TABPTR, */
91 /*     TABVAL     are the components of a double precision symbol table. */
92 /*                The components of the symbol are sorted in increasing */
93 /*                order. */
94 
95 /* $ Parameters */
96 
97 /*     None. */
98 
99 /* $ Files */
100 
101 /*     None. */
102 
103 /* $ Exceptions */
104 
105 /*     None. */
106 
107 /* $ Particulars */
108 
109 /*     If the symbol NAME is not in the symbol table, the symbol table */
110 /*     is not modified. */
111 
112 /* $ Examples */
113 
114 /*     The contents of the symbol table are: */
115 
116 /*        BODY4_POLE_RA -->    3.17681D2 */
117 /*                             1.08D-1 */
118 /*                             0.0D0 */
119 /*        DELTA_T_A     -->    3.2184D1 */
120 /*        K             -->    1.657D-3 */
121 /*        MEAN_ANOM     -->    6.239996D0 */
122 /*                             1.99096871D-7 */
123 /*        ORBIT_ECC     -->    1.671D-2 */
124 
125 /*     The call, */
126 
127 /*     CALL SYORDD ( 'BODY4_POLE_RA', TABSYM, TABPTR, TABVAL ) */
128 
129 /*     modifies the contents of the symbol table to be: */
130 
131 /*        BODY4_POLE_RA -->    0.0D0 */
132 /*                             1.08D-1 */
133 /*                             3.17681D2 */
134 /*        DELTA_T_A     -->    3.2184D1 */
135 /*        K             -->    1.657D-3 */
136 /*        MEAN_ANOM     -->    6.239996D0 */
137 /*                             1.99096871D-7 */
138 /*        ORBIT_ECC     -->    1.671D-2 */
139 
140 /*     Note that the call, */
141 
142 /*     CALL SYORDD ( 'BODY4_PRIME', TABSYM, TABPTR, TABVAL ) */
143 
144 /*     will not modify the symbol table because the symbol "BODY4_PRIME" */
145 /*     is not in the symbol table. */
146 
147 /* $ Restrictions */
148 
149 /*     None. */
150 
151 /* $ Literature_References */
152 
153 /*     None. */
154 
155 /* $ Author_and_Institution */
156 
157 /*     H.A. Neilan     (JPL) */
158 /*     I.M. Underwood  (JPL) */
159 
160 /* $ Version */
161 
162 /* -     SPICELIB Version 1.0.1, 10-MAR-1992 (WLT) */
163 
164 /*         Comment section for permuted index source lines was added */
165 /*         following the header. */
166 
167 /* -     SPICELIB Version 1.0.0, 31-JAN-1990 (IMU) (HAN) */
168 
169 /* -& */
170 /* $ Index_Entries */
171 
172 /*     order the components of a single symbol */
173 
174 /* -& */
175 
176 /*     SPICELIB functions */
177 
178 
179 /*     Local variables */
180 
181 
182 /*     Standard SPICE error handling. */
183 
184     if (return_()) {
185 	return 0;
186     } else {
187 	chkin_("SYORDD", (ftnlen)6);
188     }
189 
190 /*     How many symbols? */
191 
192     nsym = cardc_(tabsym, tabsym_len);
193 
194 /*     Is this symbol even in the table? */
195 
196     locsym = bsrchc_(name__, &nsym, tabsym + tabsym_len * 6, name_len,
197 	    tabsym_len);
198 
199 /*     If so, sort the components in place. */
200 
201     if (locsym > 0) {
202 	i__1 = locsym - 1;
203 	locval = sumai_(&tabptr[6], &i__1) + 1;
204 	n = tabptr[locsym + 5];
205 	shelld_(&tabptr[locsym + 5], &tabval[locval + 5]);
206     }
207     chkout_("SYORDD", (ftnlen)6);
208     return 0;
209 } /* syordd_ */
210 
211