1 /* SWISSEPH
2  *
3  *  Windows DLL interface imports for the Astrodienst SWISSEPH package
4  *
5 
6 **************************************************************/
7 /* Copyright (C) 1997 - 2021 Astrodienst AG, Switzerland.  All rights reserved.
8 
9   License conditions
10   ------------------
11 
12   This file is part of Swiss Ephemeris.
13 
14   Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND.  No author
15   or distributor accepts any responsibility for the consequences of using it,
16   or for whether it serves any particular purpose or works at all, unless he
17   or she says so in writing.
18 
19   Swiss Ephemeris is made available by its authors under a dual licensing
20   system. The software developer, who uses any part of Swiss Ephemeris
21   in his or her software, must choose between one of the two license models,
22   which are
23   a) GNU Affero General Public License (AGPL)
24   b) Swiss Ephemeris Professional License
25 
26   The choice must be made before the software developer distributes software
27   containing parts of Swiss Ephemeris to others, and before any public
28   service using the developed software is activated.
29 
30   If the developer choses the AGPL software license, he or she must fulfill
31   the conditions of that license, which includes the obligation to place his
32   or her whole software project under the AGPL or a compatible license.
33   See https://www.gnu.org/licenses/agpl-3.0.html
34 
35   If the developer choses the Swiss Ephemeris Professional license,
36   he must follow the instructions as found in http://www.astro.com/swisseph/
37   and purchase the Swiss Ephemeris Professional Edition from Astrodienst
38   and sign the corresponding license contract.
39 
40   The License grants you the right to use, copy, modify and redistribute
41   Swiss Ephemeris, but only under certain conditions described in the License.
42   Among other things, the License requires that the copyright notices and
43   this notice be preserved on all copies.
44 
45   Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl
46 
47   The authors of Swiss Ephemeris have no control or influence over any of
48   the derived works, i.e. over software or services created by other
49   programmers which use Swiss Ephemeris functions.
50 
51   The names of the authors or of the copyright holder (Astrodienst) must not
52   be used for promoting any software, product or service which uses or contains
53   the Swiss Ephemeris. This copyright notice is the ONLY place where the
54   names of the authors can legally appear, except in cases where they have
55   given special permission in writing.
56 
57   The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used
58   for promoting such software, products or services.
59 */
60 
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 #ifndef _SWEDLL_H
65 #define _SWEDLL_H
66 
67 #ifndef _SWEPHEXP_INCLUDED
68 #include "swephexp.h"
69 #endif
70 
71 # ifdef __cplusplus
72 #define DllImport extern "C" __declspec( dllimport )
73 # else
74 #define DllImport  __declspec( dllimport )
75 # endif
76 
77 /* DLL defines
78   Define UNDECO_DLL for un-decorated dll
79   verify compiler option __cdecl for un-decorated and __stdcall for decorated */
80 /*#define UNDECO_DLL */
81 
82 #if defined (PASCAL) || defined(__stdcall)
83   #if defined UNDECO_DLL
84     #define CALL_CONV_IMP __cdecl
85   #else
86     #define CALL_CONV_IMP __stdcall
87   #endif
88 #else
89   #define CALL_CONV_IMP
90 #endif
91 
92 DllImport int32 CALL_CONV_IMP swe_heliacal_ut(double JDNDaysUTStart, double *geopos, double *datm, double *dobs, char *ObjectName, int32 TypeEvent, int32 iflag, double *dret, char *serr);
93 DllImport int32 CALL_CONV_IMP swe_heliacal_pheno_ut(double JDNDaysUT, double *geopos, double *datm, double *dobs, char *ObjectName, int32 TypeEvent, int32 helflag, double *darr, char *serr);
94 DllImport int32 CALL_CONV_IMP swe_vis_limit_mag(double tjdut, double *geopos, double *datm, double *dobs, char *ObjectName, int32 helflag, double *dret, char *serr);
95 /* the following are secret, for Victor Reijs' */
96 DllImport int32 CALL_CONV_IMP swe_heliacal_angle(double tjdut, double *dgeo, double *datm, double *dobs, int32 helflag, double mag, double azi_obj, double azi_sun, double azi_moon, double alt_moon, double *dret, char *serr);
97 DllImport int32 CALL_CONV_IMP swe_topo_arcus_visionis(double tjdut, double *dgeo, double *datm, double *dobs, int32 helflag, double mag, double azi_obj, double alt_obj, double azi_sun, double azi_moon, double alt_moon, double *dret, char *serr);
98 
99 DllImport double CALL_CONV_IMP swe_degnorm(double deg);
100 
101 DllImport char * CALL_CONV_IMP swe_version(char *);
102 DllImport char * CALL_CONV_IMP swe_get_library_path(char *);
103 
104 DllImport int32 CALL_CONV_IMP swe_calc(
105         double tjd, int ipl, int32 iflag,
106         double *xx,
107         char *serr);
108 DllImport int32 CALL_CONV_IMP  swe_calc_pctr(
109         double tjd, int32 ipl, int32 iplctr, int32 iflag,
110 	double *xxret,
111 	char *serr);
112 
113 DllImport int32 CALL_CONV_IMP swe_calc_ut(
114         double tjd_ut, int32 ipl, int32 iflag,
115         double *xx,
116         char *serr);
117 
118 DllImport int32 CALL_CONV_IMP swe_fixstar(
119         char *star, double tjd, int32 iflag,
120         double *xx,
121         char *serr);
122 
123 DllImport int32 CALL_CONV_IMP swe_fixstar_ut(
124         char *star, double tjd_ut, int32 iflag,
125         double *xx,
126         char *serr);
127 
128 DllImport int32 CALL_CONV_IMP swe_fixstar_mag(
129         char *star, double *xx, char *serr);
130 
131 DllImport int32 CALL_CONV_IMP swe_fixstar2(
132         char *star, double tjd, int32 iflag,
133         double *xx,
134         char *serr);
135 
136 DllImport int32 CALL_CONV_IMP swe_fixstar2_ut(
137         char *star, double tjd_ut, int32 iflag,
138         double *xx,
139         char *serr);
140 
141 DllImport int32 CALL_CONV_IMP swe_fixstar2_mag(
142         char *star, double *xx, char *serr);
143 
144 DllImport double CALL_CONV_IMP swe_sidtime0(double tjd_ut, double ecl, double nut);
145 DllImport double CALL_CONV_IMP swe_sidtime(double tjd_ut);
146 
147 DllImport double CALL_CONV_IMP swe_deltat_ex(double tjd, int32 iflag, char *serr);
148 DllImport double CALL_CONV_IMP swe_deltat(double tjd);
149 
150 DllImport int  CALL_CONV_IMP swe_houses(
151         double tjd_ut, double geolat, double geolon, int hsys,
152         double *hcusps, double *ascmc);
153 
154 DllImport int  CALL_CONV_IMP swe_houses_ex(
155         double tjd_ut, int32 iflag, double geolat, double geolon, int hsys,
156         double *hcusps, double *ascmc);
157 
158 DllImport int  CALL_CONV_IMP swe_houses_ex2(
159         double tjd_ut, int32 iflag, double geolat, double geolon, int hsys,
160         double *hcusps, double *ascmc, double *cusp_speed, double *ascmc_speed, char *serr);
161 
162 DllImport int  CALL_CONV_IMP swe_houses_armc(
163         double armc, double geolat, double eps, int hsys,
164         double *hcusps, double *ascmc);
165 
166 DllImport int  CALL_CONV_IMP swe_houses_armc_ex2(
167         double armc, double geolat, double eps, int hsys,
168         double *hcusps, double *ascmc, double *cusp_speed, double *ascmc_speed, char *serr);
169 
170 DllImport double  CALL_CONV_IMP swe_house_pos(
171         double armc, double geolon, double eps, int hsys, double *xpin, char *serr);
172 
173 DllImport char * CALL_CONV_IMP swe_house_name(int hsys);
174 
175 DllImport int32  CALL_CONV_IMP swe_gauquelin_sector(
176 	double t_ut, int32 ipl, char *starname, int32 iflag, int32 imeth, double *geopos, double atpress, double attemp, double *dgsect, char *serr);
177 
178 DllImport void  CALL_CONV_IMP swe_set_sid_mode(
179         int32 sid_mode, double t0, double ayan_t0);
180 
181 DllImport int32  CALL_CONV_IMP swe_get_ayanamsa_ex(double tjd_et, int32 iflag, double *daya, char *serr);
182 DllImport int32  CALL_CONV_IMP swe_get_ayanamsa_ex_ut(double tjd_ut, int32 iflag, double *daya, char *serr);
183 
184 DllImport double  CALL_CONV_IMP swe_get_ayanamsa(double tjd_et);
185 DllImport double  CALL_CONV_IMP swe_get_ayanamsa_ut(double tjd_ut);
186 
187 DllImport char * CALL_CONV_IMP swe_get_ayanamsa_name(int32 isidmode);
188 DllImport char * CALL_CONV_IMP swe_get_current_file_data(int ifno, double *tfstart, double *tfend, int *denum);
189 
190 DllImport int  CALL_CONV_IMP swe_date_conversion(
191         int y , int m , int d ,         /* year, month, day */
192         double utime,   /* universal time in hours (decimal) */
193         char c,         /* calendar g[regorian]|j[ulian]|a[stro = greg] */
194         double *tjd);
195 
196 DllImport double  CALL_CONV_IMP swe_julday(
197         int year, int mon, int mday,
198         double hour,
199         int gregflag);
200 
201 DllImport void  CALL_CONV_IMP swe_revjul(
202         double jd, int gregflag,
203         int *year, int *mon, int *mday,
204         double *hour);
205 
206 DllImport void  CALL_CONV_IMP swe_utc_time_zone(
207         int32 iyear, int32 imonth, int32 iday,
208 	int32 ihour, int32 imin, double dsec,
209 	double d_timezone,
210 	int32 *iyear_out, int32 *imonth_out, int32 *iday_out,
211 	int32 *ihour_out, int32 *imin_out, double *dsec_out);
212 
213 DllImport int32  CALL_CONV_IMP swe_utc_to_jd(
214         int32 iyear, int32 imonth, int32 iday,
215 	int32 ihour, int32 imin, double dsec,
216 	int32 gregflag, double *dret, char *serr);
217 
218 DllImport void  CALL_CONV_IMP swe_jdet_to_utc(
219         double tjd_et, int32 gregflag,
220 	int32 *iyear, int32 *imonth, int32 *iday,
221 	int32 *ihour, int32 *imin, double *dsec);
222 
223 DllImport void  CALL_CONV_IMP swe_jdut1_to_utc(
224         double tjd_ut, int32 gregflag,
225 	int32 *iyear, int32 *imonth, int32 *iday,
226 	int32 *ihour, int32 *imin, double *dsec);
227 
228 DllImport int  CALL_CONV_IMP swe_time_equ(
229         double tjd, double *e, char *serr);
230 DllImport int  CALL_CONV_IMP swe_lmt_to_lat(double tjd_lmt, double geolon, double *tjd_lat, char *serr);
231 DllImport int  CALL_CONV_IMP swe_lat_to_lmt(double tjd_lat, double geolon, double *tjd_lmt, char *serr);
232 
233 DllImport double  CALL_CONV_IMP swe_get_tid_acc(void);
234 DllImport void  CALL_CONV_IMP swe_set_tid_acc(double tidacc);
235 DllImport void  CALL_CONV_IMP swe_set_delta_t_userdef(double dt);
236 DllImport void  CALL_CONV_IMP swe_set_ephe_path(char *path);
237 DllImport void  CALL_CONV_IMP swe_set_jpl_file(char *fname);
238 DllImport void  CALL_CONV_IMP swe_close(void);
239 DllImport char * CALL_CONV_IMP swe_get_planet_name(int ipl, char *spname);
240 DllImport void  CALL_CONV_IMP swe_cotrans(double *xpo, double *xpn, double eps);
241 DllImport void  CALL_CONV_IMP swe_cotrans_sp(double *xpo, double *xpn, double eps);
242 
243 DllImport void  CALL_CONV_IMP swe_set_topo(double geolon, double geolat, double height);
244 
245 DllImport void CALL_CONV_IMP swe_set_astro_models(char *samod, int32 iflag);
246 DllImport void CALL_CONV_IMP swe_get_astro_models(char *samod, char *sdet, int32 iflag);
247 
248 /****************************
249  * from swecl.c
250  ****************************/
251 
252 /* computes geographic location and attributes of solar
253  * eclipse at a given tjd */
254 DllImport int32  CALL_CONV_IMP swe_sol_eclipse_where(double tjd, int32 ifl, double *geopos, double *attr, char *serr);
255 
256 DllImport int32  CALL_CONV_IMP swe_lun_occult_where(double tjd, int32 ipl, char *starname, int32 ifl, double *geopos, double *attr, char *serr);
257 
258 /* computes attributes of a solar eclipse for given tjd, geolon, geolat */
259 DllImport int32  CALL_CONV_IMP swe_sol_eclipse_how(double tjd, int32 ifl, double *geopos, double *attr, char *serr);
260 
261 /* finds time of next local eclipse */
262 DllImport int32  CALL_CONV_IMP swe_sol_eclipse_when_loc(double tjd_start, int32 ifl, double *geopos, double *tret, double *attr, int32 backward, char *serr);
263 
264 DllImport int32  CALL_CONV_IMP swe_lun_occult_when_loc(double tjd_start, int32 ipl, char *starname, int32 ifl, double *geopos, double *tret, double *attr, int32 backward, char *serr);
265 
266 /* finds time of next eclipse globally */
267 DllImport int32  CALL_CONV_IMP swe_sol_eclipse_when_glob(double tjd_start, int32 ifl, int32 ifltype, double *tret, int32 backward, char *serr);
268 
269 /* finds time of next occultation globally */
270 DllImport int32  CALL_CONV_IMP swe_lun_occult_when_glob(double tjd_start, int32 ipl, char *starname, int32 ifl, int32 ifltype, double *tret, int32 backward, char *serr);
271 
272 /* computes attributes of a lunar eclipse for given tjd */
273 DllImport int32  CALL_CONV_IMP swe_lun_eclipse_how(
274           double tjd_ut,
275           int32 ifl,
276 	  double *geopos,
277           double *attr,
278           char *serr);
279 DllImport int32  CALL_CONV_IMP swe_lun_eclipse_when(double tjd_start, int32 ifl, int32 ifltype, double *tret, int32 backward, char *serr);
280 DllImport int32  CALL_CONV_IMP swe_lun_eclipse_when_loc(double tjd_start, int32 ifl, double *geopos, double *tret, double *attr, int32 backward, char *serr);
281 /* planetary phenomena */
282 DllImport int32  CALL_CONV_IMP swe_pheno(double tjd, int32 ipl, int32 iflag, double *attr, char *serr);
283 
284 DllImport int32  CALL_CONV_IMP swe_pheno_ut(double tjd_ut, int32 ipl, int32 iflag, double *attr, char *serr);
285 
286 DllImport double  CALL_CONV_IMP swe_refrac(double inalt, double atpress, double attemp, int32 calc_flag);
287 DllImport double  CALL_CONV_IMP swe_refrac_extended(double inalt, double geoalt, double atpress, double attemp, double lapse_rate, int32 calc_flag, double *dret);
288 DllImport void  CALL_CONV_IMP swe_set_lapse_rate(double lapse_rate);
289 
290 DllImport void  CALL_CONV_IMP swe_azalt(
291       double tjd_ut,
292       int32 calc_flag,
293       double *geopos,
294       double atpress,
295       double attemp,
296       double *xin,
297       double *xaz);
298 
299 DllImport void  CALL_CONV_IMP swe_azalt_rev(
300       double tjd_ut,
301       int32 calc_flag,
302       double *geopos,
303       double *xin,
304       double *xout);
305 
306 DllImport int32  CALL_CONV_IMP swe_rise_trans(
307                double tjd_ut, int32 ipl, char *starname,
308 	       int32 epheflag, int32 rsmi,
309                double *geopos,
310 	       double atpress, double attemp,
311                double *tret,
312                char *serr);
313 
314 DllImport int32  CALL_CONV_IMP swe_rise_trans_true_hor(
315                double tjd_ut, int32 ipl, char *starname,
316 	       int32 epheflag, int32 rsmi,
317                double *geopos,
318 	       double atpress, double attemp,
319 	       double horhgt,
320                double *tret,
321                char *serr);
322 
323 DllImport int32  CALL_CONV_IMP swe_nod_aps(double tjd_et, int32 ipl, int32 iflag,
324                       int32  method,
325                       double *xnasc, double *xndsc,
326                       double *xperi, double *xaphe,
327                       char *serr);
328 
329 DllImport int32  CALL_CONV_IMP swe_nod_aps_ut(double tjd_ut, int32 ipl, int32 iflag,
330                       int32  method,
331                       double *xnasc, double *xndsc,
332                       double *xperi, double *xaphe,
333                       char *serr);
334 
335 DllImport int32 CALL_CONV_IMP swe_get_orbital_elements(double tjd_et, int32 ipl, int32 iflag, double *dret, char *serr);
336 
337 DllImport int32 CALL_CONV_IMP swe_orbit_max_min_true_distance(double tjd_et, int32 ipl, int32 iflag, double *dmax, double *dmin, double *dtrue, char *serr);
338 
339 /*******************************************************
340  * other functions from swephlib.c;
341  * they are not needed for Swiss Ephemeris,
342  * but may be useful to former Placalc users.
343  ********************************************************/
344 
345 /* normalize argument into interval [0..DEG360] */
346 DllImport centisec  CALL_CONV_IMP swe_csnorm(centisec p);
347 
348 /* distance in centisecs p1 - p2 normalized to [0..360[ */
349 DllImport centisec  CALL_CONV_IMP swe_difcsn (centisec p1, centisec p2);
350 
351 DllImport double  CALL_CONV_IMP swe_difdegn (double p1, double p2);
352 
353 /* distance in centisecs p1 - p2 normalized to [-180..180[ */
354 DllImport centisec  CALL_CONV_IMP swe_difcs2n(centisec p1, centisec p2);
355 
356 DllImport double  CALL_CONV_IMP swe_difdeg2n(double p1, double p2);
357 
358 DllImport double  CALL_CONV_IMP swe_difdeg2n(double p1, double p2);
359 DllImport double  CALL_CONV_IMP swe_difrad2n(double p1, double p2);
360 DllImport double  CALL_CONV_IMP swe_rad_midp(double x1, double x0);
361 DllImport double  CALL_CONV_IMP swe_deg_midp(double x1, double x0);
362 
363 /* round second, but at 29.5959 always down */
364 DllImport centisec  CALL_CONV_IMP swe_csroundsec(centisec x);
365 
366 /* double to int32 with rounding, no overflow check */
367 DllImport int32  CALL_CONV_IMP swe_d2l(double x);
368 
369 DllImport void  CALL_CONV_IMP swe_split_deg(double ddeg, int32 roundflag, int32 *ideg, int32 *imin, int32 *isec, double *dsecfr, int32 *isgn);
370 
371 /* monday = 0, ... sunday = 6 */
372 DllImport int  CALL_CONV_IMP swe_day_of_week(double jd);
373 
374 DllImport char * CALL_CONV_IMP swe_cs2timestr(CSEC t, int sep, AS_BOOL suppressZero, char *a);
375 
376 DllImport char * CALL_CONV_IMP swe_cs2lonlatstr(CSEC t, char pchar, char mchar, char *s);
377 
378 DllImport char * CALL_CONV_IMP swe_cs2degstr(CSEC t, char *a);
379 
380 DllImport void CALL_CONV_IMP swe_set_interpolate_nut(AS_BOOL do_interpolate);
381 
382 
383 #endif /* !_SWEDLL_H */
384 #ifdef __cplusplus
385 } /* extern C */
386 #endif
387