1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
use std::os::raw::{c_char, c_double, c_int};
/// Interface https://www.astro.com/ftp/swisseph/doc/swephprg.htm#_Toc19111156
#[link(name = "swe")]
extern "C" {
/*
* 2. The Ephemeris file related functions
*/
/// void swe_set_ephe_path(
/// char *path);
pub fn swe_set_ephe_path(path: *const c_char);
/// /* close Swiss Ephemeris */
/// void swe_close(
/// void);
pub fn swe_close();
/// /* set name of JPL ephemeris file */
/// void swe_set_jpl_file(
/// char *fname);
pub fn swe_set_jpl_file(fname: *const c_char);
/// /* find out version number of your Swiss Ephemeris version */
/// char *swe_version(
/// char *svers);
/// /* svers is a string variable with sufficient space to contain the
/// version number (255 char) */
pub fn swe_version(s_version: *mut c_char) -> *mut c_char;
/// /* find out the library path of the DLL or executable */
/// char *swe_get_library_path(
/// char *spath);
/// /* spath is a string variable with sufficient space to contain the
/// library path (255 char) */
pub fn swe_get_library_path(spath: *mut c_char) -> *mut c_char;
/*
* 3. The functions swe_calc_ut() and swe_calc()
* Before calling one of these functions or any other Swiss Ephemeris
* function, it is strongly recommended to call the function
* swe_set_ephe_path(). Even if you don’t want to set an ephemeris path and
* use the Moshier ephemeris, it is nevertheless recommended to call
* swe_set_ephe_path(NULL), because this function makes important
* initializations. If you don’t do that, the Swiss Ephemeris may work but
* the results may be not 100% consistent.
*/
/// int swe_calc_ut(
/// double tjd_ut,
/// int ipl,
/// int iflag,
/// double* xx,
/// char* serr);
///
/// tjd_ut = Julian day, Universal Time
/// ipl = body number
/// iflag = a 32 bit integer containing bit flags that indicate what
/// kind of computation is wanted
/// xx = array of 6 doubles for longitude, latitude, distance, speed
/// in long., speed in lat., and speed in dist.
/// serr[256] = character string to return error messages in case of error.
pub fn swe_calc_ut(
tjd_ut: c_double,
ipl: c_int,
iflag: c_int,
xx: *mut c_double,
serr: *mut c_char,
) -> c_int;
/*
* 7. Eclipses, risings, settings, meridian transits, planetary phenomena
*/
/// int32 swe_pheno_ut(
/// double tjd_ut, /* time Jul. Day UT */
/// int32 ipl, /* planet number */
/// int32 iflag, /* ephemeris flag */
/// double *attr, /* return array, 20 doubles, see below */
/// char *serr); /* return error string */
pub fn swe_pheno_ut(
tjd_ut: c_double,
ipl: c_int,
iflag: c_int,
atr: *mut c_double,
serr: *mut c_char,
) -> c_int;
/*
* 8. Date and time conversion functions
*/
/// double swe_julday(
/// int year,
/// int month,
/// int day,
/// double hour,
/// int gregflag);
pub fn swe_julday(
year: c_int,
month: c_int,
day: c_int,
hour: c_double,
gregflag: c_int,
) -> c_double;
/// void swe_utc_time_zone(
/// int32 iyear, int32 imonth, int32 iday,
/// int32 ihour, int32 imin, double dsec,
/// double d_timezone,
/// int32 *iyear_out, int32 *imonth_out, int32 *iday_out,
/// int32 *ihour_out, int32 *imin_out, double *dsec_out);
pub fn swe_utc_time_zone(
iyear: c_int,
imonth: c_int,
iday: c_int,
ihour: c_int,
imin: c_int,
dsec: c_double,
d_timezone: c_double,
iyear_out: *mut c_int,
imonth_out: *mut c_int,
iday_out: *mut c_int,
ihour_out: *mut c_int,
imin_out: *mut c_int,
dsec_out: *mut c_double,
);
/// int32 swe_utc_to_jd(
/// int32 iyear, int32 imonth, int32 iday,
/// int32 ihour, int32 imin, double dsec, /* NOTE: second is a decimal */
/// gregflag, /* Gregorian calendar: 1, Julian calendar: 0 */
/// dret /* return array, two doubles:
/// * dret[0] = Julian day in ET (TT)
/// * dret[1] = Julian day in UT (UT1) */
/// serr); /* error string */
pub fn swe_utc_to_jd(
iyear: c_int,
imonth: c_int,
iday: c_int,
ihour: c_int,
imin: c_int,
dsec: c_double,
gregflag: c_int,
dret: *mut c_double,
serr: *mut c_char,
) -> c_int;
/*
* 14. House cups calculation
*/
/// int swe_house_names(
/// int hsys);
pub fn swe_house_name(hsys: c_int) -> *mut c_char;
/// int swe_houses_ex(
/// double tjd_ut,
/// int32 iflag,
/// double geolat,
/// double geolon,
/// int hsys,
/// double *cusps,
/// double *ascmc);
pub fn swe_houses_ex(
tjd_ut: c_double,
iflag: c_int,
geolat: c_double,
geolon: c_double,
hsys: c_int,
cusps: *mut c_double,
ascmc: *mut c_double,
) -> c_int;
/*
* 17. Auxiliary functions
*/
/// double swe_degnorm(double x);
pub fn swe_degnorm(x: c_double) -> c_double;
/// double swe_radnorm(double x);
pub fn swe_radnorm(x: c_double) -> c_double;
/// double swe_split_deg(
/// double ddeg,
/// int32 roundflag,
/// int32 *ideg,
/// int32 *imin,
/// int32 *isec,
/// double *dsecfr,
/// int32 *isgn);
pub fn swe_split_deg(
ddeg: c_double,
roundflag: c_int,
ideg: *mut c_int,
imin: *mut c_int,
isec: *mut c_int,
cdegfr: *mut c_double,
isgn: *mut c_int,
) -> c_double;
}