FACT++  1.0
void palDafin ( const char *  string,
int *  iptr,
double *  a,
int *  j 
)

Definition at line 132 of file palDafin.c.

References DINT, PAL__DAS2R, and palDfltin().

Referenced by t_afin().

132  {
133 
134  int jd = 0; /* Status for degree parsing */
135  int jm = 0; /* Status for arcmin parsing */
136  int js = 0; /* Status for arcsec parsing */
137  int jf = 0; /* Internal copy of status */
138  double deg = 0.0;
139  double arcmin = 0.0;
140  double arcsec = 0.0;
141 
142  /* Decode degrees, arcminutes, arcseconds */
143  palDfltin( string, ipos, &deg, &jd );
144  if (jd > 1) {
145  jf = -1;
146  } else {
147 
148  palDfltin( string, ipos, &arcmin, &jm );
149  if ( jm < 0 || jm > 1 ) {
150  jf = -2;
151  } else {
152 
153  palDfltin( string, ipos, &arcsec, &js );
154  if (js < 0 || js > 1) {
155  jf = -3;
156 
157  } else if (jd > 0) { /* See if combination of fields is credible */
158  /* No degrees: arcmin, arcsec ought also to be absent */
159  if (jm == 0) {
160  /* Suspect arcmin */
161  jf = -2;
162  } else if (js == 0) {
163  /* Suspect arcsec */
164  jf = -3;
165  } else {
166  /* All three fields absent */
167  jf = 1;
168  }
169 
170  } else if (jm != 0 && js == 0) { /* Deg present: if arcsec present should have arcmin */
171  jf = -3;
172 
173  /* Tests for range and integrality */
174  } else if (jm == 0 && DINT(deg) != deg) { /* Degrees */
175  jf = -1;
176 
177  } else if ( (js == 0 && DINT(arcmin) != arcmin) || arcmin >= 60.0 ) { /* Arcmin */
178  jf = -2;
179 
180  } else if (arcsec >= 60.0) { /* Arcsec */
181  jf = -3;
182  }
183  }
184  }
185 
186  /* Unless all three fields absent, compute angle value */
187  if (jf <= 0) {
188  *a = PAL__DAS2R * ( 60.0 * ( 60.0 * fabs(deg) + arcmin) + arcsec );
189  if ( jd < 0 ) *a *= -1.;
190  }
191 
192  *j = jf;
193 
194 }
static const double PAL__DAS2R
Definition: palmac.h:78
void palDfltin(const char *string, int *nstrt, double *dreslt, int *jflag)
Definition: palDfltin.c:146
#define DINT(A)
Definition: palmac.h:120

+ Here is the call graph for this function:

+ Here is the caller graph for this function: