| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | /* | 
| 2 |  |  |  |  |  |  | *+ | 
| 3 |  |  |  |  |  |  | *  Name: | 
| 4 |  |  |  |  |  |  | *     palEpco | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | *  Purpose: | 
| 7 |  |  |  |  |  |  | *     Convert an epoch into the appropriate form - 'B' or 'J' | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | *  Language: | 
| 10 |  |  |  |  |  |  | *     Starlink ANSI C | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | *  Type of Module: | 
| 13 |  |  |  |  |  |  | *     Library routine | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | *  Invocation: | 
| 16 |  |  |  |  |  |  | *     double palEpco( char k0, char k, double e ); | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | *  Arguments: | 
| 19 |  |  |  |  |  |  | *     k0 = char (Given) | 
| 20 |  |  |  |  |  |  | *       Form of result: 'B'=Besselian, 'J'=Julian | 
| 21 |  |  |  |  |  |  | *     k = char (Given) | 
| 22 |  |  |  |  |  |  | *       Form of given epoch: 'B' or 'J'. | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  | *  Description: | 
| 25 |  |  |  |  |  |  | *     Converts a Besselian or Julian epoch to a Julian or Besselian | 
| 26 |  |  |  |  |  |  | *     epoch. | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | *  Authors: | 
| 29 |  |  |  |  |  |  | *     PTW: Patrick T. Wallace | 
| 30 |  |  |  |  |  |  | *     TIMJ: Tim Jenness (JAC, Hawaii) | 
| 31 |  |  |  |  |  |  | *     {enter_new_authors_here} | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | *  Notes: | 
| 34 |  |  |  |  |  |  | *     - The result is always either equal to or very close to | 
| 35 |  |  |  |  |  |  | *       the given epoch E.  The routine is required only in | 
| 36 |  |  |  |  |  |  | *       applications where punctilious treatment of heterogeneous | 
| 37 |  |  |  |  |  |  | *       mixtures of star positions is necessary. | 
| 38 |  |  |  |  |  |  | *     - k and k0 are case insensitive. This differes slightly from the | 
| 39 |  |  |  |  |  |  | *       Fortran SLA implementation. | 
| 40 |  |  |  |  |  |  | *     - k and k0 are not validated. They are interpreted as follows: | 
| 41 |  |  |  |  |  |  | *       o If k0 and k are the same the result is e | 
| 42 |  |  |  |  |  |  | *       o If k0 is 'b' or 'B' and k isn't the conversion is J to B. | 
| 43 |  |  |  |  |  |  | *       o In all other cases, the conversion is B to J. | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | *  History: | 
| 46 |  |  |  |  |  |  | *     2012-03-01 (TIMJ): | 
| 47 |  |  |  |  |  |  | *        Initial version. Documentation from SLA/F. | 
| 48 |  |  |  |  |  |  | *        Adapted with permission from the Fortran SLALIB library. | 
| 49 |  |  |  |  |  |  | *     {enter_further_changes_here} | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | *  Copyright: | 
| 52 |  |  |  |  |  |  | *     Copyright (C) 1995 Rutherford Appleton Laboratory | 
| 53 |  |  |  |  |  |  | *     Copyright (C) 2012 Science and Technology Facilities Council. | 
| 54 |  |  |  |  |  |  | *     All Rights Reserved. | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | *  Licence: | 
| 57 |  |  |  |  |  |  | *     This program is free software; you can redistribute it and/or | 
| 58 |  |  |  |  |  |  | *     modify it under the terms of the GNU General Public License as | 
| 59 |  |  |  |  |  |  | *     published by the Free Software Foundation; either version 3 of | 
| 60 |  |  |  |  |  |  | *     the License, or (at your option) any later version. | 
| 61 |  |  |  |  |  |  | * | 
| 62 |  |  |  |  |  |  | *     This program is distributed in the hope that it will be | 
| 63 |  |  |  |  |  |  | *     useful, but WITHOUT ANY WARRANTY; without even the implied | 
| 64 |  |  |  |  |  |  | *     warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | 
| 65 |  |  |  |  |  |  | *     PURPOSE. See the GNU General Public License for more details. | 
| 66 |  |  |  |  |  |  | * | 
| 67 |  |  |  |  |  |  | *     You should have received a copy of the GNU General Public License | 
| 68 |  |  |  |  |  |  | *     along with this program; if not, write to the Free Software | 
| 69 |  |  |  |  |  |  | *     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 | 
| 70 |  |  |  |  |  |  | *     USA. | 
| 71 |  |  |  |  |  |  |  | 
| 72 |  |  |  |  |  |  | *  Bugs: | 
| 73 |  |  |  |  |  |  | *     {note_any_bugs_here} | 
| 74 |  |  |  |  |  |  | *- | 
| 75 |  |  |  |  |  |  | */ | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  | #include "pal.h" | 
| 78 |  |  |  |  |  |  | #include "pal1sofa.h" | 
| 79 |  |  |  |  |  |  |  | 
| 80 |  |  |  |  |  |  | #include | 
| 81 |  |  |  |  |  |  |  | 
| 82 | 0 |  |  |  |  |  | double palEpco( char k0, char k, double e ) { | 
| 83 |  |  |  |  |  |  |  | 
| 84 |  |  |  |  |  |  | double new_epoch = 0.0; | 
| 85 |  |  |  |  |  |  | double djm; | 
| 86 |  |  |  |  |  |  | double djm0; | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  | /* Use upper case */ | 
| 89 | 0 |  |  |  |  |  | k0 = toupper( k0 ); | 
| 90 | 0 |  |  |  |  |  | k = toupper( k ); | 
| 91 |  |  |  |  |  |  |  | 
| 92 | 0 | 0 |  |  |  |  | if (k == k0) { | 
| 93 |  |  |  |  |  |  | new_epoch = e; | 
| 94 | 0 | 0 |  |  |  |  | } else if (k0 == 'B') { | 
| 95 | 0 |  |  |  |  |  | eraEpj2jd( e, &djm0, &djm ); | 
| 96 | 0 |  |  |  |  |  | new_epoch = eraEpb( djm0, djm ); | 
| 97 |  |  |  |  |  |  | } else { | 
| 98 | 0 |  |  |  |  |  | eraEpb2jd( e, &djm0, &djm ); | 
| 99 | 0 |  |  |  |  |  | new_epoch = eraEpj( djm0, djm ); | 
| 100 |  |  |  |  |  |  | } | 
| 101 | 0 |  |  |  |  |  | return new_epoch; | 
| 102 |  |  |  |  |  |  | } |