Stellarium  0.90.0
jpleph.h
1 /* jpleph.h: header for JPL ephemeris functions
2 
3 Copyright (C) 2011, Project Pluto
4 
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 02110-1301, USA. */
19 
20 /***************************************************************************
21 ******* JPLEPH.H *********
22 ****************************************************************************
23 ** This header file is used both by ASC2EPH and TESTEPH programs. **
24 ****************************************************************************
25 ** Written: May 28, 1997 by PAD ** Last modified: June 23,1997 by PAD **
26 ** Modified further by Bill Gray, Jun-Aug 2001 **
27 ****************************************************************************
28 ** PAD: dr. Piotr A. Dybczynski, e-mail: dybol@phys.amu.edu.pl **
29 ** Astronomical Observatory of the A.Mickiewicz Univ., Poznan, Poland **
30 ***************************************************************************/
31 
32 /* By default, in Windoze 32, the JPL ephemeris functions are compiled
33  into a DLL. This is not really all that helpful at present, but may
34  be useful to people who want to use the functions from languages other
35  than C. */
36 
37 #ifdef _WIN32
38 #define DLL_FUNC __stdcall
39 #else
40 #define DLL_FUNC
41 #endif
42 
43 #ifdef __WATCOMC__
44  #include <stdbool.h>
45 #endif
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
51 void * DLL_FUNC jpl_init_ephemeris( const char *ephemeris_filename,
52  char nam[][6], double *val);
53 void DLL_FUNC jpl_close_ephemeris( void *ephem);
54 int DLL_FUNC jpl_state( void *ephem, const double et, const int list[14],
55  double pv[][6], double nut[4], const int bary);
56 int DLL_FUNC jpl_pleph( void *ephem, const double et, const int ntarg,
57  const int ncent, double rrd[], const int calc_velocity);
58 double DLL_FUNC jpl_get_double( const void *ephem, const int value);
59 long DLL_FUNC jpl_get_long( const void *ephem, const int value);
60 int DLL_FUNC make_sub_ephem( void *ephem, const char *sub_filename,
61  const double start_jd, const double end_jd);
62 double DLL_FUNC jpl_get_constant( const int idx, void *ephem, char *constant_name);
63 
64 #ifdef __cplusplus
65 }
66 #endif
67 
68  /* Following are constants used in */
69  /* jpl_get_double( ) and jpl_get_long( ): */
70 
71 #define JPL_EPHEM_START_JD 0
72 #define JPL_EPHEM_END_JD 8
73 #define JPL_EPHEM_STEP 16
74 #define JPL_EPHEM_N_CONSTANTS 24
75 #define JPL_EPHEM_AU_IN_KM 28
76 #define JPL_EPHEM_EARTH_MOON_RATIO 36
77 #define JPL_EPHEM_IPT_ARRAY 44
78 #define JPL_EPHEM_EPHEMERIS_VERSION 224
79 #define JPL_EPHEM_KERNEL_SIZE 228
80 #define JPL_EPHEM_KERNEL_RECORD_SIZE 232
81 #define JPL_EPHEM_KERNEL_NCOEFF 236
82 #define JPL_EPHEM_KERNEL_SWAP_BYTES 240
83 
84  /* The following error codes may be returned by */
85  /* jpl_state() and jpl_pleph(): */
86 #define JPL_EPH_OUTSIDE_RANGE (-1)
87 #define JPL_EPH_READ_ERROR (-2)
88 #define JPL_EPH_QUANTITY_NOT_IN_EPHEMERIS (-3)
89 #define JPL_EPH_INVALID_INDEX (-5)
90 #define JPL_EPH_FSEEK_ERROR (-6)
91 
92 int DLL_FUNC jpl_init_error_code( void);
93 
94  /* The following error codes may be returned by */
95  /* jpl_init_error_code( ) after jpl_init_ephemeris( ) */
96  /* has been called: */
97 
98 #define JPL_INIT_NO_ERROR 0
99 #define JPL_INIT_FILE_NOT_FOUND -1
100 #define JPL_INIT_FSEEK_FAILED -2
101 #define JPL_INIT_FREAD_FAILED -3
102 #define JPL_INIT_FREAD2_FAILED -4
103 #define JPL_INIT_FREAD5_FAILED -10
104 #define JPL_INIT_FILE_CORRUPT -5
105 #define JPL_INIT_MEMORY_FAILURE -6
106 #define JPL_INIT_FREAD3_FAILED -7
107 #define JPL_INIT_FREAD4_FAILED -8
108 #define JPL_INIT_NOT_CALLED -9
109 
110 #define jpl_get_pvsun( ephem) ((double *)((char *)ephem + 248))
111 
112 /* addition for use in stellarium */
113 #define JPL_MAX_N_CONSTANTS 1018
114 #define CALC_VELOCITY 0
115 #define CENTRAL_PLANET_ID 11 //ID of sun in JPL enumeration
116 
117 const char * jpl_init_error_message(void);