Compare commits

..

10 Commits

Author SHA1 Message Date
e08e6c6821 Fix some typos in configure.ac and .gitignore 2016-09-21 14:16:20 +02:00
f9db50919f codecov experimenting 2016-09-21 14:16:20 +02:00
617d293358 Add more tests 2016-09-21 14:16:20 +02:00
aa6a489f34 Remove invalid property testing
Execution will never arrive there, there’s no point checking it.
2016-09-21 14:16:19 +02:00
c25f650755 Add extra test to timezone changing 2016-09-21 14:16:19 +02:00
2ab696906c Add comments to tests 2016-09-21 14:16:19 +02:00
61de67efa4 Optimize coverage generating 2016-09-21 14:16:19 +02:00
e44480cb21 Clean up swe-glib.mk 2016-09-21 14:16:19 +02:00
b6d8ca18c9 Add test for bad property queries 2016-09-21 14:16:19 +02:00
132a7aaac3 Enable coverage measurement in travis 2016-09-21 14:16:19 +02:00
120 changed files with 453392 additions and 123 deletions

3
.gitignore vendored
View File

@ -57,8 +57,8 @@ Makefile.in
/tests/*-test
/tests/*-test.log
/tests/*-test.trs
/tests/test-suite.log
/swe-glib-lcov*
test-suite.log
*.gcno
*.gcda
*.gcov
@ -98,7 +98,6 @@ test-suite.log
/data/*.gschema.xml
# Documentation related files
/docs/reference/*/*.actions
/docs/reference/*/*.args
/docs/reference/*/*.hierarchy
/docs/reference/*/*.interfaces

View File

@ -7,11 +7,13 @@ addons:
- gobject-introspection
- gnome-common
- autopoint
before_script: ./autogen.sh
- lcov
before_script: ./autogen.sh --enable-coverage
script:
- make
- make check
before_install:
- pip install --user codecov
after_success:
- codecov
- find -type f -name '*.gcno'
- codecov --gcov-root src

View File

@ -1,7 +1,7 @@
include $(top_srcdir)/swe-glib.mk
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = src po data tests
SUBDIRS = swe swe/src swe/doc src po data tests
if ENABLE_GTK_DOC
SUBDIRS += docs/reference/swe-glib

View File

@ -102,12 +102,12 @@ AS_IF([ test "x$use_gcov" = "xyes"], [
AC_MSG_ERROR([ccache must be disabled when --enable-coverage option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
fi
ltp_version_list="1.6 1.7 1.8 1.9 1.10 1.14"
ltp_version_list="1.6 1.7 1.8 1.9 1.10"
AC_CHECK_PROG(LTP, lcov, lcov)
AC_CHECK_PROG(LTP_GENHTML, genhtml, genhtml)
AS_IF([ test "$LTP" ], [
AC_CACHE_CHECK([for ltp version], sw_glib_cv_ltp_version, [
AC_CACHE_CHECK([for ltp version], swe_glib_cv_ltp_version, [
swe_glib_cv_ltp_version=invalid
ltp_version=`$LTP -v 2>/dev/null | $SED -e 's/^.* //'`
for ltp_check_version in $ltp_version_list; do
@ -160,11 +160,17 @@ PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26])
GLIB_GSETTINGS
AC_CONFIG_MACRO_DIR([m4])
LIBSWE_LIBS='$(top_builddir)/swe/src/libswe-$(SWE_VERSION).la'
AC_SUBST(LIBSWE_LIBS)
LIBSWE_GLIB_LIBS='$(top_builddir)/src/libswe-glib-$(SWE_GLIB_API_VERSION).la'
AC_SUBST(LIBSWE_GLIB_LIBS)
AC_CONFIG_FILES([
Makefile
swe/Makefile
swe/src/Makefile
swe/doc/Makefile
src/Makefile
data/Makefile
po/Makefile.in

View File

@ -9,7 +9,79 @@ gsettings_SCHEMAS = eu.polonkai.gergely.swe-glib.gschema.xml
@GSETTINGS_RULES@
swephdir = $(pkgdatadir)
sweph_DATA = \
sweph-data/seas_00.se1 \
sweph-data/seas_06.se1 \
sweph-data/seas_12.se1 \
sweph-data/seas_18.se1 \
sweph-data/seas_24.se1 \
sweph-data/seas_30.se1 \
sweph-data/seas_36.se1 \
sweph-data/seas_42.se1 \
sweph-data/seas_48.se1 \
sweph-data/seasm06.se1 \
sweph-data/seasm12.se1 \
sweph-data/seasm18.se1 \
sweph-data/seasm24.se1 \
sweph-data/seasm30.se1 \
sweph-data/seasm36.se1 \
sweph-data/seasm42.se1 \
sweph-data/seasm48.se1 \
sweph-data/seasm54.se1 \
sweph-data/semo_00.se1 \
sweph-data/semo_06.se1 \
sweph-data/semo_12.se1 \
sweph-data/semo_18.se1 \
sweph-data/semo_24.se1 \
sweph-data/semo_30.se1 \
sweph-data/semo_36.se1 \
sweph-data/semo_42.se1 \
sweph-data/semo_48.se1 \
sweph-data/semom06.se1 \
sweph-data/semom12.se1 \
sweph-data/semom18.se1 \
sweph-data/semom24.se1 \
sweph-data/semom30.se1 \
sweph-data/semom36.se1 \
sweph-data/semom42.se1 \
sweph-data/semom48.se1 \
sweph-data/semom54.se1 \
sweph-data/sepl_00.se1 \
sweph-data/sepl_06.se1 \
sweph-data/sepl_12.se1 \
sweph-data/sepl_18.se1 \
sweph-data/sepl_24.se1 \
sweph-data/sepl_30.se1 \
sweph-data/sepl_36.se1 \
sweph-data/sepl_42.se1 \
sweph-data/sepl_48.se1 \
sweph-data/seplm06.se1 \
sweph-data/seplm12.se1 \
sweph-data/seplm18.se1 \
sweph-data/seplm24.se1 \
sweph-data/seplm30.se1 \
sweph-data/seplm36.se1 \
sweph-data/seplm42.se1 \
sweph-data/seplm48.se1 \
sweph-data/seplm54.se1 \
sweph-data/seleapsec.txt \
sweph-data/s136199.se1 \
sweph-data/s136199s.se1 \
sweph-data/se00010s.se1 \
sweph-data/se00034s.se1 \
sweph-data/se00157s.se1 \
sweph-data/se07066s.se1 \
sweph-data/se08405s.se1 \
sweph-data/se10199s.se1 \
sweph-data/se90377.se1 \
sweph-data/se90377s.se1 \
sweph-data/se90482.se1 \
sweph-data/se90482s.se1 \
$(NULL)
EXTRA_DIST = \
$(sweph_DATA) \
swe-glib.spec \
gschema.template

BIN
data/sweph-data/s136199.se1 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
data/sweph-data/se90377.se1 Normal file

Binary file not shown.

Binary file not shown.

BIN
data/sweph-data/se90482.se1 Normal file

Binary file not shown.

Binary file not shown.

BIN
data/sweph-data/seas_00.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seas_06.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seas_12.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seas_18.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seas_24.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seas_30.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seas_36.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seas_42.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seas_48.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seasm06.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seasm12.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seasm18.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seasm24.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seasm30.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seasm36.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seasm42.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seasm48.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seasm54.se1 Normal file

Binary file not shown.

393347
data/sweph-data/seasnam.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,31 @@
# This file contains the dates of leap seconds to be taken into account
# by the Swiss Ephemeris.
# For each new leap second add the date of its insertion in the format
# yyyymmdd, e.g. "20081231" for 21 december 2008
19720630
19721231
19731231
19741231
19751231
19761231
19771231
19781231
19791231
19810630
19820630
19830630
19850630
19871231
19891231
19901231
19920630
19930630
19949630
19951231
19970630
19981231
20051231
20081231
20120630
20150630
20161231

BIN
data/sweph-data/semo_00.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semo_06.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semo_12.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semo_18.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semo_24.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semo_30.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semo_36.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semo_42.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semo_48.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semom06.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semom12.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semom18.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semom24.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semom30.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semom36.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semom42.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semom48.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/semom54.se1 Normal file

Binary file not shown.

View File

@ -0,0 +1,76 @@
# Orbital elements of ficticious planets
# 27 Jan. 2000
#
# This file is part of the Swiss Ephemeris, from Version 1.52 on.
#
# Warning! These planets do not exist!
#
# The user can add his or her own elements.
# 960 is the maximum number of ficticious planets.
#
# The elements order is as follows:
# 1. epoch of elements (Julian day)
# 2. equinox (Julian day or "J1900" or "B1950" or "J2000")
# 3. mean anomaly at epoch
# 4. semi-axis
# 5. eccentricity
# 6. argument of perihelion (ang. distance of perihelion from node)
# 7. ascending node
# 8. inclination
# 9. name of planet
#
# use '#' for comments
# to compute a body with swe_calc(), use planet number
# ipl = SE_FICT_OFFSET_1 + number_of_elements_set,
# e.g. number of Kronos is ipl = 39 + 4 = 43
#
# Witte/Sieggruen planets, refined by James Neely
J1900, J1900, 163.7409, 40.99837, 0.00460, 171.4333, 129.8325, 1.0833, Cupido # 1
J1900, J1900, 27.6496, 50.66744, 0.00245, 148.1796, 161.3339, 1.0500, Hades # 2
J1900, J1900, 165.1232, 59.21436, 0.00120, 299.0440, 0.0000, 0.0000, Zeus # 3
J1900, J1900, 169.0193, 64.81690, 0.00305, 208.8801, 0.0000, 0.0000, Kronos # 4
J1900, J1900, 138.0533, 70.29949, 0.00000, 0.0000, 0.0000, 0.0000, Apollon # 5
J1900, J1900, 351.3350, 73.62765, 0.00000, 0.0000, 0.0000, 0.0000, Admetos # 6
J1900, J1900, 55.8983, 77.25568, 0.00000, 0.0000, 0.0000, 0.0000, Vulcanus # 7
J1900, J1900, 165.5163, 83.66907, 0.00000, 0.0000, 0.0000, 0.0000, Poseidon # 8
#
# Isis-Transpluto; elements from "Die Sterne" 3/1952, p. 70ff.
# Strubell does not give an equinox. 1945 is taken in order to
# reproduce the as best as ASTRON ephemeris. (This is a strange
# choice, though.)
# The epoch according to Strubell is 1772.76.
# 1772 is a leap year!
# The fraction is counted from 1 Jan. 1772
2368547.66, 2431456.5, 0.0, 77.775, 0.3, 0.7, 0, 0, Isis-Transpluto # 9
# Nibiru, elements from Christian Woeltge, Hannover
1856113.380954, 1856113.380954, 0.0, 234.8921, 0.981092, 103.966, -44.567, 158.708, Nibiru # 10
# Harrington, elements from Astronomical Journal 96(4), Oct. 1988
2374696.5, J2000, 0.0, 101.2, 0.411, 208.5, 275.4, 32.4, Harrington # 11
# according to W.G. Hoyt, "Planets X and Pluto", Tucson 1980, p. 63
2395662.5, 2395662.5, 34.05, 36.15, 0.10761, 284.75, 0, 0, Leverrier (Neptune) # 12
2395662.5, 2395662.5, 24.28, 37.25, 0.12062, 299.11, 0, 0, Adams (Neptune) # 13
2425977.5, 2425977.5, 281, 43.0, 0.202, 204.9, 0, 0, Lowell (Pluto) # 14
2425977.5, 2425977.5, 48.95, 55.1, 0.31, 280.1, 100, 15, Pickering (Pluto) # 15
# intramercurian hypothetical Vulcan acc. to L.H. Weston
J1900,JDATE, 252.8987988 + 707550.7341 * T, 0.13744, 0.019, 322.212069+1670.056*T, 47.787931-1670.056*T, 7.5, Vulcan # 16
# Selena/White Moon
J2000,JDATE, 242.2205555 + 5143.5418158 * T, 0.05280098949, 0.0, 0.0, 0.0, 0.0, Selena/White Moon, geo # 17
# Hypothetical planet Proserpina, according to http://www.geocities.com/Hollywood/Academy/7519/proserpina.html
# J1900, 170.73 + 51.05 * T
J1900,JDATE, 170.73, 79.225630, 0, 0, 0, 0, Proserpina #18
# Waldemath's Second Earth Moon
# Elements were derived by D.Koch from Waldemaths original elements as given in
# David Walters' book on Vulcan. They differ from Solar Fire (Graham Dawsons)
# elements, which are based on the assumption that the "mean longitude" given
# by Waldemath is an observation (a true longitude)
# Neither Swisseph nor Solar fire elements agree with Delphine Jay's ephemeris,
# which is obviously wrong.
2414290.95827875,2414290.95827875, 70.3407215 + 109023.2634989 * T, 0.0068400705250028, 0.1587, 8.14049594 + 2393.47417444 * T, 136.24878256 - 1131.71719709 * T, 2.5, Waldemath, geo # 19
#
# The following elements are for test only
# (Selena without T)
J2000,JDATE, 242.2205555, 0.05279142865925, 0.0, 0.0, 0.0, 0.0, Selena/White Moon, geo # 17
# (Selena with T, gives exactly the same position)
J2000,JDATE, 242.2205555 + 5143.5418158 * T, 0.05279142865925, 0.0, 0.0, 0.0, 0.0, Selena/White Moon with T Terms, geo # 17
J2000, JDATE, 174.794787 + 149472.5157715 * T, 0.38709831, 0.20563175 + 0.000020406 * T, 29.125226 + 0.3702885 * T, 48.330893 + 1.186189 * T, 7.004986 + 0.0018215 * T, Mercury elem. for equ. of date # 18
J2000, J2000, 174.794787 + 149472.5157715 * T, 0.38709831, 0.20563175 + 0.000020406 * T, 29.125226 + 0.2842872 * T, 48.330893 - 0.1254229 * T, 7.004986 - 0.0059516 * T, Mercury Test J2000 Elements# 18

BIN
data/sweph-data/sepl_00.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/sepl_06.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/sepl_12.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/sepl_18.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/sepl_24.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/sepl_30.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/sepl_36.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/sepl_42.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/sepl_48.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seplm06.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seplm12.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seplm18.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seplm24.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seplm30.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seplm36.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seplm42.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seplm48.se1 Normal file

Binary file not shown.

BIN
data/sweph-data/seplm54.se1 Normal file

Binary file not shown.

View File

@ -92,7 +92,7 @@ expand_content_files=
# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
GTKDOC_CFLAGS=
GTKDOC_LIBS=$(LIBSWE_GLIB_LIBS) -lswe -ldl $(NULL)
GTKDOC_LIBS=$(LIBSWE_GLIB_LIBS) $(NULL)
# This includes the standard gtk-doc make rules, copied by gtkdocize.
include $(top_srcdir)/gtk-doc.make

View File

@ -64,7 +64,7 @@ libswe_glib_2_0_la_SOURCES = \
$(NULL)
libswe_glib_2_0_la_CFLAGS = $(GLIB_CFLAGS) $(GOBJECT_CFLAGS) -Wall
libswe_glib_2_0_la_LIBADD = $(GLIB_LIBS) $(GOBJECT_LIBS) -lswe
libswe_glib_2_0_la_LIBADD = $(GLIB_LIBS) $(GOBJECT_LIBS) $(LIBSWE_LIBS)
libswe_glib_2_0_la_DEPENDENCIES = \
$(NULL)
@ -94,7 +94,6 @@ SweGlib_@SWE_GLIB_API_VERSION_U@_gir_LIBS = libswe-glib-2.0.la
SweGlib_@SWE_GLIB_API_VERSION_U@_gir_SCANNERFLAGS = --identifier-prefix=Gswe --symbol-prefix=gswe --warn-all
SweGlib_@SWE_GLIB_API_VERSION_U@_gir_INCLUDES = GLib-2.0 GObject-2.0
SweGlib_@SWE_GLIB_API_VERSION_U@_gir_CFLAGS = -D__SWE_GLIB_BUILDING__ -I$(top_srcdir) -I$(srcdir) -I$(builddir)
SweGlib_@SWE_GLIB_API_VERSION_U@_gir_LDFLAGS = $(GLIB_LIBS) $(GOBJECT_LIBS) -lswe
SweGlib_@SWE_GLIB_API_VERSION_U@_gir_EXPORT_PACKAGES = swe-glib
INTROSPECTION_GIRS = SweGlib-$(SWE_GLIB_API_VERSION).gir

View File

@ -18,11 +18,11 @@
*/
#include "swe-glib.h"
#include "gswe-enumtypes.h"
#include "@filename@"
/*** END file-header ***/
/*** BEGIN file-production ***/
#include "@filename@"
/* enumerations from "@filename@" */
/*** END file-production ***/

View File

@ -15,11 +15,11 @@
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include <swephexp.h>
#include "swe-glib.h"
#include "swe-glib-private.h"
#include "../swe/src/swephexp.h"
#define glforeach(a, b) for ((a) = (b); (a); (a) = g_list_next((a)))
/**
@ -805,39 +805,14 @@ gswe_moment_calculate_house_positions(GsweMoment *moment, GError **err)
err
);
}
if (gswe_moment_has_planet(moment, GSWE_PLANET_DESCENDANT)) {
calculate_data_by_position(
moment,
GSWE_PLANET_DESCENDANT,
fmod(ascmc[0] + 180.0, 180.0),
err
);
}
if (gswe_moment_has_planet(moment, GSWE_PLANET_MC)) {
calculate_data_by_position(moment, GSWE_PLANET_MC, ascmc[1], err);
}
if (gswe_moment_has_planet(moment, GSWE_PLANET_IC)) {
calculate_data_by_position(
moment,
GSWE_PLANET_IC,
fmod(ascmc[2] + 180.0, 180.0),
err
);
}
if (gswe_moment_has_planet(moment, GSWE_PLANET_VERTEX)) {
calculate_data_by_position(moment, GSWE_PLANET_VERTEX, ascmc[3], err);
}
if (gswe_moment_has_planet(moment, GSWE_PLANET_ANTIVERTEX)) {
calculate_data_by_position(
moment,
GSWE_PLANET_ANTIVERTEX,
fmod(ascmc[3] + 180.0, 180.0),
err
);
}
}
/**

View File

@ -18,8 +18,8 @@
*/
#include <math.h>
#include <glib.h>
#include <swephexp.h>
#include "../swe/src/swephexp.h"
#include "swe-glib-private.h"
#include "swe-glib.h"
#include "gswe-timestamp.h"
@ -488,10 +488,13 @@ gswe_timestamp_set_property(GObject *object,
break;
/* LCOV_EXCL_START Unless a property ID is missing from above,
* we will never arrive here */
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
/* LCOV_EXCL_STOP */
}
}
@ -585,10 +588,13 @@ gswe_timestamp_get_property(
break;
/* LCOV_EXCL_START Unless a property ID is missing from above,
* we will never arrive here */
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
/* LCOV_EXCL_STOP */
}
}

View File

@ -35,12 +35,9 @@
* GswePlanet:
* @GSWE_PLANET_NONE: no planet
* @GSWE_PLANET_ASCENDANT: the ascendant
* @GSWE_PLANET_DESCENDANT: the descendant
* @GSWE_PLANET_MC: midheaven (Medium Coeli)
* @GSWE_PLANET_IC: Immum Coeli
* @GSWE_PLANET_VERTEX: the Vertex (the point where the ecliptic meats the
* primal vertical)
* @GSWE_PLANET_ANTIVERTEX: the Antivertex (the point opposing the Vertex)
* @GSWE_PLANET_MOON_NODE: the mean ascending (north) Moon node
* @GSWE_PLANET_MOON_SOUTH_NODE: the mean descending (south) Moon node
* @GSWE_PLANET_MOON_APOGEE: the mean Moon apogee (sometimes called Dark Moon,
@ -83,9 +80,6 @@ typedef enum {
GSWE_PLANET_MOON_NODE,
GSWE_PLANET_MOON_APOGEE,
GSWE_PLANET_MOON_SOUTH_NODE,
GSWE_PLANET_DESCENDANT,
GSWE_PLANET_IC,
GSWE_PLANET_ANTIVERTEX,
/* Actual astrological planets */
GSWE_PLANET_SUN = 11,

View File

@ -18,8 +18,8 @@
#include <glib.h>
#define GETTEXT_PACKAGE "swe-glib"
#include <glib/gi18n-lib.h>
#include <swephexp.h>
#include "../swe/src/swephexp.h"
#include "swe-glib.h"
#include "swe-glib-private.h"
@ -178,14 +178,6 @@ void gswe_init_with_dir(gchar *directory)
9.0,
2
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_DESCENDANT,
-1,
FALSE,
_("Descendant"),
0.0,
0
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_MC,
-1,
@ -194,14 +186,6 @@ void gswe_init_with_dir(gchar *directory)
5.0,
1
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_IC,
-1,
FALSE,
_("Immum Coeli"),
0.0,
0
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_VERTEX,
-1,
@ -210,14 +194,6 @@ void gswe_init_with_dir(gchar *directory)
2.0,
0
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_ANTIVERTEX,
-1,
FALSE,
_("Anti-vertex"),
0.0,
0
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_MOON_NODE,
SE_MEAN_NODE,
@ -228,9 +204,6 @@ void gswe_init_with_dir(gchar *directory)
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_MOON_SOUTH_NODE,
// As this is just the opposing point of the mean node,
// we actually calculate that, and simply add 180
// degrees when queried.
SE_MEAN_NODE,
TRUE,
_("Descending Moon Node"),

View File

@ -1,4 +1,7 @@
# SWE-GLib - GLib wrapper around the Swiss Ephemeris library
#
# Most of this file is got from GLib, especially the code coverage measurement
# parts
GTESTER = gtester
GTESTER_REPORT = gtester-report
@ -7,7 +10,7 @@ NULL =
# initialize variables for unconditional += appending
BUILT_SOURCES =
BUILT_EXTRA_DIST =
CLEANFILES = *.log *.trs
CLEANFILES = *.log *.trs *.gcda
DISTCLEANFILES =
MAINTAINERCLEANFILES =
EXTRA_DIST =
@ -33,9 +36,7 @@ else
test-nonrecursive:
endif
.PHONY: test-nonrecursive
.PHONY: lcov genlcov lcov-clean
.PHONY: test-nonrecursive lcov genlcov lcov-clean
# use recursive makes in order to ignore errors during check
lcov:
-$(MAKE) $(AM_MAKEFLAGS) -k check
@ -45,9 +46,8 @@ lcov:
# placing the objects files in the .libs/ directory separate from the *.c
# we also have to delete tests/.libs/libmoduletestplugin_*.gcda
genlcov:
$(AM_V_GEN) rm -f $(top_builddir)/tests/.libs/libmoduletestplugin_*.gcda; \
$(LTP) --quiet --directory $(top_builddir) --capture --output-file swe-glib-lcov.info --test-name SWE_GLIB_PERF --no-checksum --compat-libtool --ignore-errors source; \
$(LTP) --quiet --output-file swe-glib-lcov.info --remove swe-glib-lcov.info docs/reference/\* /tmp/\* gio/tests/gdbus-object-manager-example/\* ; \
$(AM_V_GEN) $(LTP) --quiet --directory $(top_builddir) --capture --output-file swe-glib-lcov.info --test-name SWE_GLIB_PERF --no-checksum --compat-libtool --ignore-errors source; \
$(LTP) --quiet --output-file swe-glib-lcov.info --remove swe-glib-lcov.info docs/reference/\* /tmp/\* ; \
LANG=C $(LTP_GENHTML) --quiet --prefix $(top_builddir) --output-directory swe-glib-lcov --title "SWE-GLib Code Coverage" --legend --frames --show-details swe-glib-lcov.info --ignore-errors source
@echo "file://$(abs_top_builddir)/swe-glib-lcov/index.html"
@ -59,47 +59,6 @@ lcov-clean:
# run tests in cwd as part of make check
check-local: test-nonrecursive
# We support a fairly large range of possible variables. It is expected that all types of files in a test suite
# will belong in exactly one of the following variables.
#
# First, we support the usual automake suffixes, but in lowercase, with the customary meaning:
#
# test_programs, test_scripts, test_data, test_ltlibraries
#
# The above are used to list files that are involved in both uninstalled and installed testing. The
# test_programs and test_scripts are taken to be actual testcases and will be run as part of the test suite.
# Note that _data is always used with the nobase_ automake variable name to ensure that installed test data is
# installed in the same way as it appears in the package layout.
#
# In order to mark a particular file as being only for one type of testing, use 'installed' or 'uninstalled',
# like so:
#
# installed_test_programs, uninstalled_test_programs
# installed_test_scripts, uninstalled_test_scripts
# installed_test_data, uninstalled_test_data
# installed_test_ltlibraries, uninstalled_test_ltlibraries
#
# Additionally, we support 'extra' infixes for programs and scripts. This is used for support programs/scripts
# that should not themselves be run as testcases (but exist to be used from other testcases):
#
# test_extra_programs, installed_test_extra_programs, uninstalled_test_extra_programs
# test_extra_scripts, installed_test_extra_scripts, uninstalled_test_extra_scripts
#
# Additionally, for _scripts and _data, we support the customary dist_ prefix so that the named script or data
# file automatically end up in the tarball.
#
# dist_test_scripts, dist_test_data, dist_test_extra_scripts
# dist_installed_test_scripts, dist_installed_test_data, dist_installed_test_extra_scripts
# dist_uninstalled_test_scripts, dist_uninstalled_test_data, dist_uninstalled_test_extra_scripts
#
# Note that no file is automatically disted unless it appears in one of the dist_ variables. This follows the
# standard automake convention of not disting programs scripts or data by default.
#
# test_programs, test_scripts, uninstalled_test_programs and uninstalled_test_scripts (as well as their disted
# variants) will be run as part of the in-tree 'make check'. These are all assumed to be runnable under
# gtester. That's a bit strange for scripts, but it's possible.
# we use test -z "$(TEST_PROGS)" above, so make sure we have no extra whitespace...
TEST_PROGS += $(strip $(test_programs) $(test_scripts) $(uninstalled_test_programs) $(uninstalled_test_scripts) \
$(dist_test_scripts) $(dist_uninstalled_test_scripts))

1
swe/Makefile.am Normal file
View File

@ -0,0 +1 @@
EXTRA_DIST = README

5
swe/README Normal file
View File

@ -0,0 +1,5 @@
This directory contains version 2.0 of the Swiss Ephemeris programming library
in a reduced form, so it can be used in an Autotools project like Astrognome.
If you need the full version, you can download it from
ftp://ftp.astro.com/pub/swisseph/ (as of July, 2013)

1
swe/doc/Makefile.am Normal file
View File

@ -0,0 +1 @@
EXTRA_DIST = swephprg.pdf swisseph.pdf

BIN
swe/doc/swephprg.pdf Normal file

Binary file not shown.

BIN
swe/doc/swisseph.pdf Normal file

Binary file not shown.

54
swe/src/LICENSE Normal file
View File

@ -0,0 +1,54 @@
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions
------------------
This file is part of Swiss Ephemeris.
Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author
or distributor accepts any responsibility for the consequences of using it,
or for whether it serves any particular purpose or works at all, unless he
or she says so in writing.
Swiss Ephemeris is made available by its authors under a dual licensing
system. The software developer, who uses any part of Swiss Ephemeris
in his or her software, must choose between one of the two license models,
which are
a) GNU public license version 2 or later
b) Swiss Ephemeris Professional License
The choice must be made before the software developer distributes software
containing parts of Swiss Ephemeris to others, and before any public
service using the developed software is activated.
If the developer choses the GNU GPL software license, he or she must fulfill
the conditions of that license, which includes the obligation to place his
or her whole software project under the GNU GPL or a compatible license.
See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
If the developer choses the Swiss Ephemeris Professional license,
he must follow the instructions as found in http://www.astro.com/swisseph/
and purchase the Swiss Ephemeris Professional Edition from Astrodienst
and sign the corresponding license contract.
The License grants you the right to use, copy, modify and redistribute
Swiss Ephemeris, but only under certain conditions described in the License.
Among other things, the License requires that the copyright notices and
this notice be preserved on all copies.
Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl
The authors of Swiss Ephemeris have no control or influence over any of
the derived works, i.e. over software or services created by other
programmers which use Swiss Ephemeris functions.
The names of the authors or of the copyright holder (Astrodienst) must not
be used for promoting any software, product or service which uses or contains
the Swiss Ephemeris. This copyright notice is the ONLY place where the
names of the authors can legally appear, except in cases where they have
given special permission in writing.
The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used
for promoting such software, products or services.
*/

25
swe/src/Makefile.am Normal file
View File

@ -0,0 +1,25 @@
lib_LTLIBRARIES = libswe-2.0.la
libswe_2_0_la_SOURCES = swedate.c swehouse.c swejpl.c swemmoon.c swemplan.c swepcalc.c sweph.c swepdate.c swephlib.c swecl.c swehel.c
libswe_2_0_la_CFLAGS = $(CFLAGS) -Wall
libswe_2_0_la_LIBADD = $(LIBS)
EXTRA_DIST = \
LICENSE \
README \
swemptab.c \
swemptab.h \
swedate.h \
swedll.h \
swehouse.h \
swejpl.h \
swenut2000a.h \
sweodef.h \
swepcalc.h \
swephexp.h \
sweph.h \
swephlib.h \
fixstars.cat \
sedeltat.txt.inactive \
sefstars.txt \
seorbel.txt \
$(NULL)

6
swe/src/README Normal file
View File

@ -0,0 +1,6 @@
This directory holds the Swiss Ephemeris library. It can be downloaded from
http://www.astro.com/swisseph/ and used via the GPL licence.
The original directory is stripped down, and the unneded files are deleted (like
the swetest source and such. In the future, even the library may be optimised
further.

1258
swe/src/fixstars.cat Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,13 @@
# This file allows to make new Delta T known to the Swiss Ephemeris.
# Note, these values override the values given in the internal Delta T
# table of the Swiss Ephemeris.
#
# If you want to use this file, change its file name and remove the
# the extension '.inactive'. As soon as you do so, the values below
# will be used, i.e. they will override the internal Delta T values
# of the Swiss Ephemeris.
#
# Format: year and seconds (decimal)
2007 65.15
2008 65.46
2009 65.78

1290
swe/src/sefstars.txt Normal file

File diff suppressed because it is too large Load Diff

76
swe/src/seorbel.txt Normal file
View File

@ -0,0 +1,76 @@
# Orbital elements of ficticious planets
# 27 Jan. 2000
#
# This file is part of the Swiss Ephemeris, from Version 1.52 on.
#
# Warning! These planets do not exist!
#
# The user can add his or her own elements.
# 960 is the maximum number of ficticious planets.
#
# The elements order is as follows:
# 1. epoch of elements (Julian day)
# 2. equinox (Julian day or "J1900" or "B1950" or "J2000")
# 3. mean anomaly at epoch
# 4. semi-axis
# 5. eccentricity
# 6. argument of perihelion (ang. distance of perihelion from node)
# 7. ascending node
# 8. inclination
# 9. name of planet
#
# use '#' for comments
# to compute a body with swe_calc(), use planet number
# ipl = SE_FICT_OFFSET_1 + number_of_elements_set,
# e.g. number of Kronos is ipl = 39 + 4 = 43
#
# Witte/Sieggruen planets, refined by James Neely
J1900, J1900, 163.7409, 40.99837, 0.00460, 171.4333, 129.8325, 1.0833, Cupido # 1
J1900, J1900, 27.6496, 50.66744, 0.00245, 148.1796, 161.3339, 1.0500, Hades # 2
J1900, J1900, 165.1232, 59.21436, 0.00120, 299.0440, 0.0000, 0.0000, Zeus # 3
J1900, J1900, 169.0193, 64.81690, 0.00305, 208.8801, 0.0000, 0.0000, Kronos # 4
J1900, J1900, 138.0533, 70.29949, 0.00000, 0.0000, 0.0000, 0.0000, Apollon # 5
J1900, J1900, 351.3350, 73.62765, 0.00000, 0.0000, 0.0000, 0.0000, Admetos # 6
J1900, J1900, 55.8983, 77.25568, 0.00000, 0.0000, 0.0000, 0.0000, Vulcanus # 7
J1900, J1900, 165.5163, 83.66907, 0.00000, 0.0000, 0.0000, 0.0000, Poseidon # 8
#
# Isis-Transpluto; elements from "Die Sterne" 3/1952, p. 70ff.
# Strubell does not give an equinox. 1945 is taken in order to
# reproduce the as best as ASTRON ephemeris. (This is a strange
# choice, though.)
# The epoch according to Strubell is 1772.76.
# 1772 is a leap year!
# The fraction is counted from 1 Jan. 1772
2368547.66, 2431456.5, 0.0, 77.775, 0.3, 0.7, 0, 0, Isis-Transpluto # 9
# Nibiru, elements from Christian Woeltge, Hannover
1856113.380954, 1856113.380954, 0.0, 234.8921, 0.981092, 103.966, -44.567, 158.708, Nibiru # 10
# Harrington, elements from Astronomical Journal 96(4), Oct. 1988
2374696.5, J2000, 0.0, 101.2, 0.411, 208.5, 275.4, 32.4, Harrington # 11
# according to W.G. Hoyt, "Planets X and Pluto", Tucson 1980, p. 63
2395662.5, 2395662.5, 34.05, 36.15, 0.10761, 284.75, 0, 0, Leverrier (Neptune) # 12
2395662.5, 2395662.5, 24.28, 37.25, 0.12062, 299.11, 0, 0, Adams (Neptune) # 13
2425977.5, 2425977.5, 281, 43.0, 0.202, 204.9, 0, 0, Lowell (Pluto) # 14
2425977.5, 2425977.5, 48.95, 55.1, 0.31, 280.1, 100, 15, Pickering (Pluto) # 15
# intramercurian hypothetical Vulcan acc. to L.H. Weston
J1900,JDATE, 252.8987988 + 707550.7341 * T, 0.13744, 0.019, 322.212069+1670.056*T, 47.787931-1670.056*T, 7.5, Vulcan # 16
# Selena/White Moon
J2000,JDATE, 242.2205555 + 5143.5418158 * T, 0.05280098949, 0.0, 0.0, 0.0, 0.0, Selena/White Moon, geo # 17
# Hypothetical planet Proserpina, according to http://www.geocities.com/Hollywood/Academy/7519/proserpina.html
# J1900, 170.73 + 51.05 * T
J1900,JDATE, 170.73, 79.225630, 0, 0, 0, 0, Proserpina #18
# Waldemath's Second Earth Moon
# Elements were derived by D.Koch from Waldemaths original elements as given in
# David Walters' book on Vulcan. They differ from Solar Fire (Graham Dawsons)
# elements, which are based on the assumption that the "mean longitude" given
# by Waldemath is an observation (a true longitude)
# Neither Swisseph nor Solar fire elements agree with Delphine Jay's ephemeris,
# which is obviously wrong.
2414290.95827875,2414290.95827875, 70.3407215 + 109023.2634989 * T, 0.0068400705250028, 0.1587, 8.14049594 + 2393.47417444 * T, 136.24878256 - 1131.71719709 * T, 2.5, Waldemath, geo # 19
#
# The following elements are for test only
# (Selena without T)
J2000,JDATE, 242.2205555, 0.05279142865925, 0.0, 0.0, 0.0, 0.0, Selena/White Moon, geo # 17
# (Selena with T, gives exactly the same position)
J2000,JDATE, 242.2205555 + 5143.5418158 * T, 0.05279142865925, 0.0, 0.0, 0.0, 0.0, Selena/White Moon with T Terms, geo # 17
J2000, JDATE, 174.794787 + 149472.5157715 * T, 0.38709831, 0.20563175 + 0.000020406 * T, 29.125226 + 0.3702885 * T, 48.330893 + 1.186189 * T, 7.004986 + 0.0018215 * T, Mercury elem. for equ. of date # 18
J2000, J2000, 174.794787 + 149472.5157715 * T, 0.38709831, 0.20563175 + 0.000020406 * T, 29.125226 + 0.2842872 * T, 48.330893 - 0.1254229 * T, 7.004986 - 0.0059516 * T, Mercury Test J2000 Elements# 18

5410
swe/src/swecl.c Normal file

File diff suppressed because it is too large Load Diff

592
swe/src/swedate.c Normal file
View File

@ -0,0 +1,592 @@
/*********************************************************
$Header: /home/dieter/sweph/RCS/swedate.c,v 1.75 2009/04/08 07:17:29 dieter Exp $
version 15-feb-89 16:30
swe_date_conversion()
swe_revjul()
swe_julday()
************************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions
------------------
This file is part of Swiss Ephemeris.
Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author
or distributor accepts any responsibility for the consequences of using it,
or for whether it serves any particular purpose or works at all, unless he
or she says so in writing.
Swiss Ephemeris is made available by its authors under a dual licensing
system. The software developer, who uses any part of Swiss Ephemeris
in his or her software, must choose between one of the two license models,
which are
a) GNU public license version 2 or later
b) Swiss Ephemeris Professional License
The choice must be made before the software developer distributes software
containing parts of Swiss Ephemeris to others, and before any public
service using the developed software is activated.
If the developer choses the GNU GPL software license, he or she must fulfill
the conditions of that license, which includes the obligation to place his
or her whole software project under the GNU GPL or a compatible license.
See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
If the developer choses the Swiss Ephemeris Professional license,
he must follow the instructions as found in http://www.astro.com/swisseph/
and purchase the Swiss Ephemeris Professional Edition from Astrodienst
and sign the corresponding license contract.
The License grants you the right to use, copy, modify and redistribute
Swiss Ephemeris, but only under certain conditions described in the License.
Among other things, the License requires that the copyright notices and
this notice be preserved on all copies.
Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl
The authors of Swiss Ephemeris have no control or influence over any of
the derived works, i.e. over software or services created by other
programmers which use Swiss Ephemeris functions.
The names of the authors or of the copyright holder (Astrodienst) must not
be used for promoting any software, product or service which uses or contains
the Swiss Ephemeris. This copyright notice is the ONLY place where the
names of the authors can legally appear, except in cases where they have
given special permission in writing.
The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used
for promoting such software, products or services.
*/
/*
swe_date_conversion():
This function converts some date+time input {d,m,y,uttime}
into the Julian day number tjd.
The function checks that the input is a legal combination
of dates; for illegal dates like 32 January 1993 it returns ERR
but still converts the date correctly, i.e. like 1 Feb 1993.
The function is usually used to convert user input of birth data
into the Julian day number. Illegal dates should be notified to the user.
Be aware that we always use astronomical year numbering for the years
before Christ, not the historical year numbering.
Astronomical years are done with negative numbers, historical
years with indicators BC or BCE (before common era).
Year 0 (astronomical) = 1 BC historical.
year -1 (astronomical) = 2 BC
etc.
Many users of Astro programs do not know about this difference.
Return: OK or ERR (for illegal date)
*********************************************************/
# include "swephexp.h"
# include "sweph.h"
static TLS AS_BOOL init_leapseconds_done = FALSE;
int CALL_CONV swe_date_conversion(int y,
int m,
int d, /* day, month, year */
double uttime, /* UT in hours (decimal) */
char c, /* calendar g[regorian]|j[ulian] */
double *tjd)
{
int rday, rmon, ryear;
double rut, jd;
int gregflag = SE_JUL_CAL;
if (c == 'g')
gregflag = SE_GREG_CAL;
rut = uttime; /* hours UT */
jd = swe_julday(y, m, d, rut, gregflag);
swe_revjul(jd, gregflag, &ryear, &rmon, &rday, &rut);
*tjd = jd;
if (rmon == m && rday == d && ryear == y) {
return OK;
} else {
return ERR;
}
} /* end date_conversion */
/*************** swe_julday ********************************************
* This function returns the absolute Julian day number (JD)
* for a given calendar date.
* The arguments are a calendar date: day, month, year as integers,
* hour as double with decimal fraction.
* If gregflag = SE_GREG_CAL (1), Gregorian calendar is assumed,
* if gregflag = SE_JUL_CAL (0),Julian calendar is assumed.
The Julian day number is a system of numbering all days continously
within the time range of known human history. It should be familiar
to every astrological or astronomical programmer. The time variable
in astronomical theories is usually expressed in Julian days or
Julian centuries (36525 days per century) relative to some start day;
the start day is called 'the epoch'.
The Julian day number is a double representing the number of
days since JD = 0.0 on 1 Jan -4712, 12:00 noon (in the Julian calendar).
Midnight has always a JD with fraction .5, because traditionally
the astronomical day started at noon. This was practical because
then there was no change of date during a night at the telescope.
From this comes also the fact the noon ephemerides were printed
before midnight ephemerides were introduced early in the 20th century.
NOTE: The Julian day number must not be confused with the Julian
calendar system.
Be aware the we always use astronomical year numbering for the years
before Christ, not the historical year numbering.
Astronomical years are done with negative numbers, historical
years with indicators BC or BCE (before common era).
Year 0 (astronomical) = 1 BC
year -1 (astronomical) = 2 BC
etc.
Original author: Marc Pottenger, Los Angeles.
with bug fix for year < -4711 15-aug-88 by Alois Treindl
(The parameter sequence m,d,y still indicates the US origin,
be careful because the similar function date_conversion() uses
other parameter sequence and also Astrodienst relative juldate.)
References: Oliver Montenbruck, Grundlagen der Ephemeridenrechnung,
Verlag Sterne und Weltraum (1987), p.49 ff
related functions: swe_revjul() reverse Julian day number: compute the
calendar date from a given JD
date_conversion() includes test for legal date values
and notifies errors like 32 January.
****************************************************************/
double CALL_CONV swe_julday(int year, int month, int day, double hour, int gregflag)
{
double jd;
double u,u0,u1,u2;
u = year;
if (month < 3) u -=1;
u0 = u + 4712.0;
u1 = month + 1.0;
if (u1 < 4) u1 += 12.0;
jd = floor(u0*365.25)
+ floor(30.6*u1+0.000001)
+ day + hour/24.0 - 63.5;
if (gregflag == SE_GREG_CAL) {
u2 = floor(fabs(u) / 100) - floor(fabs(u) / 400);
if (u < 0.0) u2 = -u2;
jd = jd - u2 + 2;
if ((u < 0.0) && (u/100 == floor(u/100)) && (u/400 != floor(u/400)))
jd -=1;
}
return jd;
}
/*** swe_revjul ******************************************************
swe_revjul() is the inverse function to swe_julday(), see the description
there.
Arguments are julian day number, calendar flag (0=julian, 1=gregorian)
return values are the calendar day, month, year and the hour of
the day with decimal fraction (0 .. 23.999999).
Be aware the we use astronomical year numbering for the years
before Christ, not the historical year numbering.
Astronomical years are done with negative numbers, historical
years with indicators BC or BCE (before common era).
Year 0 (astronomical) = 1 BC historical year
year -1 (astronomical) = 2 BC historical year
year -234 (astronomical) = 235 BC historical year
etc.
Original author Mark Pottenger, Los Angeles.
with bug fix for year < -4711 16-aug-88 Alois Treindl
*************************************************************************/
void CALL_CONV swe_revjul (double jd, int gregflag,
int *jyear, int *jmon, int *jday, double *jut)
{
double u0,u1,u2,u3,u4;
u0 = jd + 32082.5;
if (gregflag == SE_GREG_CAL) {
u1 = u0 + floor (u0/36525.0) - floor (u0/146100.0) - 38.0;
if (jd >= 1830691.5) u1 +=1;
u0 = u0 + floor (u1/36525.0) - floor (u1/146100.0) - 38.0;
}
u2 = floor (u0 + 123.0);
u3 = floor ( (u2 - 122.2) / 365.25);
u4 = floor ( (u2 - floor (365.25 * u3) ) / 30.6001);
*jmon = (int) (u4 - 1.0);
if (*jmon > 12) *jmon -= 12;
*jday = (int) (u2 - floor (365.25 * u3) - floor (30.6001 * u4));
*jyear = (int) (u3 + floor ( (u4 - 2.0) / 12.0) - 4800);
*jut = (jd - floor (jd + 0.5) + 0.5) * 24.0;
}
/* transform local time to UTC or UTC to local time
*
* input
* iyear ... dsec date and time
* d_timezone timezone offset
* output
* iyear_out ... dsec_out
*
* For time zones east of Greenwich, d_timezone is positive.
* For time zones west of Greenwich, d_timezone is negative.
*
* For conversion from local time to utc, use +d_timezone.
* For conversion from utc to local time, use -d_timezone.
*/
void CALL_CONV 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
)
{
double tjd, d;
AS_BOOL have_leapsec = FALSE;
double dhour;
if (dsec >= 60.0) {
have_leapsec = TRUE;
dsec -= 1.0;
}
dhour = ((double) ihour) + ((double) imin) / 60.0 + dsec / 3600.0;
tjd = swe_julday(iyear, imonth, iday, 0, SE_GREG_CAL);
dhour -= d_timezone;
if (dhour < 0.0) {
tjd -= 1.0;
dhour += 24.0;
}
if (dhour >= 24.0) {
tjd += 1.0;
dhour -= 24.0;
}
swe_revjul(tjd + 0.001, SE_GREG_CAL, iyear_out, imonth_out, iday_out, &d);
*ihour_out = (int) dhour;
d = (dhour - (double) *ihour_out) * 60;
*imin_out = (int) d;
*dsec_out = (d - (double) *imin_out) * 60;
if (have_leapsec)
*dsec_out += 1.0;
}
/*
* functions for the handling of UTC
*/
/* Leap seconds were inserted at the end of the following days:*/
#define NLEAP_SECONDS 26
#define NLEAP_SECONDS_SPACE 100
static TLS int leap_seconds[NLEAP_SECONDS_SPACE] = {
19720630,
19721231,
19731231,
19741231,
19751231,
19761231,
19771231,
19781231,
19791231,
19810630,
19820630,
19830630,
19850630,
19871231,
19891231,
19901231,
19920630,
19930630,
19940630,
19951231,
19970630,
19981231,
20051231,
20081231,
20120630,
20150630,
0 /* keep this 0 as end mark */
};
#define J1972 2441317.5
#define NLEAP_INIT 10
/* Read additional leap second dates from external file, if given.
*/
static int init_leapsec(void)
{
FILE *fp;
int ndat, ndat_last;
int tabsiz = 0;
int i;
char s[AS_MAXCH];
char *sp;
if (!init_leapseconds_done) {
init_leapseconds_done = TRUE;
tabsiz = NLEAP_SECONDS;
ndat_last = leap_seconds[NLEAP_SECONDS - 1];
/* no error message if file is missing */
if ((fp = swi_fopen(-1, "seleapsec.txt", swed.ephepath, NULL)) == NULL)
return NLEAP_SECONDS;
while(fgets(s, AS_MAXCH, fp) != NULL) {
sp = s;
while (*sp == ' ' || *sp == '\t') sp++;
sp++;
if (*sp == '#' || *sp == '\n')
continue;
ndat = atoi(s);
if (ndat <= ndat_last)
continue;
/* table space is limited. no error msg, if exceeded */
if (tabsiz >= NLEAP_SECONDS_SPACE)
return tabsiz;
leap_seconds[tabsiz] = ndat;
tabsiz++;
}
if (tabsiz > NLEAP_SECONDS) leap_seconds[tabsiz] = 0; /* end mark */
fclose(fp);
return tabsiz;
}
/* find table size */
tabsiz = 0;
for (i = 0; i < NLEAP_SECONDS_SPACE; i++) {
if (leap_seconds[i] == 0)
break;
else
tabsiz++;
}
return tabsiz;
}
/*
* Input: Clock time UTC, year, month, day, hour, minute, second (decimal).
* gregflag Calendar flag
* serr error string
* Output: An array of doubles:
* dret[0] = Julian day number TT (ET)
* dret[1] = Julian day number UT1
*
* Function returns OK or Error.
*
* - Before 1972, swe_utc_to_jd() treats its input time as UT1.
* Note: UTC was introduced in 1961. From 1961 - 1971, the length of the
* UTC second was regularly changed, so that UTC remained very close to UT1.
* - From 1972 on, input time is treated as UTC.
* - If delta_t - nleap - 32.184 > 1, the input time is treated as UT1.
* Note: Like this we avoid errors greater than 1 second in case that
* the leap seconds table (or the Swiss Ephemeris version) is not updated
* for a long time.
*/
int32 CALL_CONV swe_utc_to_jd(int32 iyear, int32 imonth, int32 iday, int32 ihour, int32 imin, double dsec, int32 gregflag, double *dret, char *serr)
{
double tjd_ut1, tjd_et, tjd_et_1972, dhour, d;
int iyear2, imonth2, iday2;
int i, j, ndat, nleap, tabsiz_nleap;
/*
* error handling: invalid iyear etc.
*/
tjd_ut1 = swe_julday(iyear, imonth, iday, 0, gregflag);
swe_revjul(tjd_ut1, gregflag, &iyear2, &imonth2, &iday2, &d);
if (iyear != iyear2 || imonth != imonth2 || iday != iday2) {
if (serr != NULL)
sprintf(serr, "invalid date: year = %d, month = %d, day = %d", iyear, imonth, iday);
return ERR;
}
if (ihour < 0 || ihour > 23
|| imin < 0 || imin > 59
|| dsec < 0 || dsec >= 61
|| (dsec >= 60 && (imin < 59 || ihour < 23 || tjd_ut1 < J1972))) {
if (serr != NULL)
sprintf(serr, "invalid time: %d:%d:%.2f", ihour, imin, dsec);
return ERR;
}
dhour = (double) ihour + ((double) imin) / 60.0 + dsec / 3600.0;
/*
* before 1972, we treat input date as UT1
*/
if (tjd_ut1 < J1972) {
dret[1] = swe_julday(iyear, imonth, iday, dhour, gregflag);
dret[0] = dret[1] + swe_deltat_ex(dret[1], -1, NULL);
return OK;
}
/*
* if gregflag = Julian calendar, convert to gregorian calendar
*/
if (gregflag == SE_JUL_CAL) {
gregflag = SE_GREG_CAL;
swe_revjul(tjd_ut1, gregflag, &iyear, &imonth, &iday, &d);
}
/*
* number of leap seconds since 1972:
*/
tabsiz_nleap = init_leapsec();
nleap = NLEAP_INIT; /* initial difference between UTC and TAI in 1972 */
ndat = iyear * 10000 + imonth * 100 + iday;
for (i = 0; i < tabsiz_nleap; i++) {
if (ndat <= leap_seconds[i])
break;
nleap++;
}
/*
* For input dates > today:
* If leap seconds table is not up to date, we'd better interpret the
* input time as UT1, not as UTC. How do we find out?
* Check, if delta_t - nleap - 32.184 > 0.9
*/
d = swe_deltat_ex(tjd_ut1, -1, NULL) * 86400.0;
if (d - (double) nleap - 32.184 >= 1.0) {
dret[1] = tjd_ut1 + dhour / 24.0;
dret[0] = dret[1] + swe_deltat_ex(dret[1], -1, NULL);
return OK;
}
/*
* if input second is 60: is it a valid leap second ?
*/
if (dsec >= 60) {
j = 0;
for (i = 0; i < tabsiz_nleap; i++) {
if (ndat == leap_seconds[i]) {
j = 1;
break;
}
}
if (j != 1) {
if (serr != NULL)
sprintf(serr, "invalid time (no leap second!): %d:%d:%.2f", ihour, imin, dsec);
return ERR;
}
}
/*
* convert UTC to ET and UT1
*/
/* the number of days between input date and 1 jan 1972: */
d = tjd_ut1 - J1972;
/* SI time since 1972, ignoring leap seconds: */
d += (double) ihour / 24.0 + (double) imin / 1440.0 + dsec / 86400.0;
/* ET (TT) */
tjd_et_1972 = J1972 + (32.184 + NLEAP_INIT) / 86400.0;
tjd_et = tjd_et_1972 + d + ((double) (nleap - NLEAP_INIT)) / 86400.0;
d = swe_deltat_ex(tjd_et, -1, NULL);
tjd_ut1 = tjd_et - swe_deltat_ex(tjd_et - d, -1, NULL);
tjd_ut1 = tjd_et - swe_deltat_ex(tjd_ut1, -1, NULL);
dret[0] = tjd_et;
dret[1] = tjd_ut1;
return OK;
}
/*
* Input: tjd_et Julian day number, terrestrial time (ephemeris time).
* gregfalg Calendar flag
* Output: UTC year, month, day, hour, minute, second (decimal).
*
* - Before 1 jan 1972 UTC, output UT1.
* Note: UTC was introduced in 1961. From 1961 - 1971, the length of the
* UTC second was regularly changed, so that UTC remained very close to UT1.
* - From 1972 on, output is UTC.
* - If delta_t - nleap - 32.184 > 1, the output is UT1.
* Note: Like this we avoid errors greater than 1 second in case that
* the leap seconds table (or the Swiss Ephemeris version) has not been
* updated for a long time.
*/
void CALL_CONV swe_jdet_to_utc(double tjd_et, int32 gregflag, int32 *iyear, int32 *imonth, int32 *iday, int32 *ihour, int32 *imin, double *dsec)
{
int i;
int second_60 = 0;
int iyear2, imonth2, iday2, nleap, ndat, tabsiz_nleap;
double d, tjd, tjd_et_1972, tjd_ut, dret[10];
/*
* if tjd_et is before 1 jan 1972 UTC, return UT1
*/
tjd_et_1972 = J1972 + (32.184 + NLEAP_INIT) / 86400.0;
d = swe_deltat_ex(tjd_et, -1, NULL);
tjd_ut = tjd_et - swe_deltat_ex(tjd_et - d, -1, NULL);
tjd_ut = tjd_et - swe_deltat_ex(tjd_ut, -1, NULL);
if (tjd_et < tjd_et_1972) {
swe_revjul(tjd_ut, gregflag, iyear, imonth, iday, &d);
*ihour = (int32) d;
d -= (double) *ihour;
d *= 60;
*imin = (int32) d;
*dsec = (d - (double) *imin) * 60.0;
return;
}
/*
* minimum number of leap seconds since 1972; we may be missing one leap
* second
*/
tabsiz_nleap = init_leapsec();
swe_revjul(tjd_ut-1, SE_GREG_CAL, &iyear2, &imonth2, &iday2, &d);
ndat = iyear2 * 10000 + imonth2 * 100 + iday2;
nleap = 0;
for (i = 0; i < tabsiz_nleap; i++) {
if (ndat <= leap_seconds[i])
break;
nleap++;
}
/* date of potentially missing leapsecond */
if (nleap < tabsiz_nleap) {
i = leap_seconds[nleap];
iyear2 = i / 10000;
imonth2 = (i % 10000) / 100;;
iday2 = i % 100;
tjd = swe_julday(iyear2, imonth2, iday2, 0, SE_GREG_CAL);
swe_revjul(tjd+1, SE_GREG_CAL, &iyear2, &imonth2, &iday2, &d);
swe_utc_to_jd(iyear2,imonth2,iday2, 0, 0, 0, SE_GREG_CAL, dret, NULL);
d = tjd_et - dret[0];
if (d >= 0) {
nleap++;
} else if (d < 0 && d > -1.0/86400.0) {
second_60 = 1;
}
}
/*
* UTC, still unsure about one leap second
*/
tjd = J1972 + (tjd_et - tjd_et_1972) - ((double) nleap + second_60) / 86400.0;
swe_revjul(tjd, SE_GREG_CAL, iyear, imonth, iday, &d);
*ihour = (int32) d;
d -= (double) *ihour;
d *= 60;
*imin = (int32) d;
*dsec = (d - (double) *imin) * 60.0 + second_60;
/*
* For input dates > today:
* If leap seconds table is not up to date, we'd better interpret the
* input time as UT1, not as UTC. How do we find out?
* Check, if delta_t - nleap - 32.184 > 0.9
*/
d = swe_deltat_ex(tjd_et, -1, NULL);
d = swe_deltat_ex(tjd_et - d, -1, NULL);
if (d * 86400.0 - (double) (nleap + NLEAP_INIT) - 32.184 >= 1.0) {
swe_revjul(tjd_et - d, SE_GREG_CAL, iyear, imonth, iday, &d);
*ihour = (int32) d;
d -= (double) *ihour;
d *= 60;
*imin = (int32) d;
*dsec = (d - (double) *imin) * 60.0;
}
if (gregflag == SE_JUL_CAL) {
tjd = swe_julday(*iyear, *imonth, *iday, 0, SE_GREG_CAL);
swe_revjul(tjd, gregflag, iyear, imonth, iday, &d);
}
}
/*
* Input: tjd_ut Julian day number, universal time (UT1).
* gregfalg Calendar flag
* Output: UTC year, month, day, hour, minute, second (decimal).
*
* - Before 1 jan 1972 UTC, output UT1.
* Note: UTC was introduced in 1961. From 1961 - 1971, the length of the
* UTC second was regularly changed, so that UTC remained very close to UT1.
* - From 1972 on, output is UTC.
* - If delta_t - nleap - 32.184 > 1, the output is UT1.
* Note: Like this we avoid errors greater than 1 second in case that
* the leap seconds table (or the Swiss Ephemeris version) has not been
* updated for a long time.
*/
void CALL_CONV swe_jdut1_to_utc(double tjd_ut, int32 gregflag, int32 *iyear, int32 *imonth, int32 *iday, int32 *ihour, int32 *imin, double *dsec)
{
double tjd_et = tjd_ut + swe_deltat_ex(tjd_ut, -1, NULL);
swe_jdet_to_utc(tjd_et, gregflag, iyear, imonth, iday, ihour, imin, dsec);
}

82
swe/src/swedate.h Normal file
View File

@ -0,0 +1,82 @@
/*********************************************************
$Header: /home/dieter/sweph/RCS/swedate.h,v 1.74 2008/06/16 10:07:20 dieter Exp $
version 15-feb-89 16:30
*********************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions
------------------
This file is part of Swiss Ephemeris.
Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author
or distributor accepts any responsibility for the consequences of using it,
or for whether it serves any particular purpose or works at all, unless he
or she says so in writing.
Swiss Ephemeris is made available by its authors under a dual licensing
system. The software developer, who uses any part of Swiss Ephemeris
in his or her software, must choose between one of the two license models,
which are
a) GNU public license version 2 or later
b) Swiss Ephemeris Professional License
The choice must be made before the software developer distributes software
containing parts of Swiss Ephemeris to others, and before any public
service using the developed software is activated.
If the developer choses the GNU GPL software license, he or she must fulfill
the conditions of that license, which includes the obligation to place his
or her whole software project under the GNU GPL or a compatible license.
See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
If the developer choses the Swiss Ephemeris Professional license,
he must follow the instructions as found in http://www.astro.com/swisseph/
and purchase the Swiss Ephemeris Professional Edition from Astrodienst
and sign the corresponding license contract.
The License grants you the right to use, copy, modify and redistribute
Swiss Ephemeris, but only under certain conditions described in the License.
Among other things, the License requires that the copyright notices and
this notice be preserved on all copies.
Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl
The authors of Swiss Ephemeris have no control or influence over any of
the derived works, i.e. over software or services created by other
programmers which use Swiss Ephemeris functions.
The names of the authors or of the copyright holder (Astrodienst) must not
be used for promoting any software, product or service which uses or contains
the Swiss Ephemeris. This copyright notice is the ONLY place where the
names of the authors can legally appear, except in cases where they have
given special permission in writing.
The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used
for promoting such software, products or services.
*/
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _SWEDLL_H
extern EXP32 int swe_date_conversion (
int y , int m , int d , /* year, month, day */
double utime, /* universal time in hours (decimal) */
char c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */
double *tgmt);
extern EXP32 double *swe_julday(
int year, int month, int day, double hour,
int gregflag);
extern EXP32 void swe_revjul (
double jd,
int gregflag,
int *jyear, int *jmon, int *jday, double *jut);
#endif
#ifdef __cplusplus
} /* extern C */
#endif

535
swe/src/swedll.h Normal file
View File

@ -0,0 +1,535 @@
/* SWISSEPH
* $Header: /home/dieter/sweph/RCS/swedll.h,v 1.75 2009/04/08 07:19:08 dieter Exp $
*
* Windows DLL interface imports for the Astrodienst SWISSEPH package
*
**************************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions
------------------
This file is part of Swiss Ephemeris.
Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author
or distributor accepts any responsibility for the consequences of using it,
or for whether it serves any particular purpose or works at all, unless he
or she says so in writing.
Swiss Ephemeris is made available by its authors under a dual licensing
system. The software developer, who uses any part of Swiss Ephemeris
in his or her software, must choose between one of the two license models,
which are
a) GNU public license version 2 or later
b) Swiss Ephemeris Professional License
The choice must be made before the software developer distributes software
containing parts of Swiss Ephemeris to others, and before any public
service using the developed software is activated.
If the developer choses the GNU GPL software license, he or she must fulfill
the conditions of that license, which includes the obligation to place his
or her whole software project under the GNU GPL or a compatible license.
See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
If the developer choses the Swiss Ephemeris Professional license,
he must follow the instructions as found in http://www.astro.com/swisseph/
and purchase the Swiss Ephemeris Professional Edition from Astrodienst
and sign the corresponding license contract.
The License grants you the right to use, copy, modify and redistribute
Swiss Ephemeris, but only under certain conditions described in the License.
Among other things, the License requires that the copyright notices and
this notice be preserved on all copies.
Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl
The authors of Swiss Ephemeris have no control or influence over any of
the derived works, i.e. over software or services created by other
programmers which use Swiss Ephemeris functions.
The names of the authors or of the copyright holder (Astrodienst) must not
be used for promoting any software, product or service which uses or contains
the Swiss Ephemeris. This copyright notice is the ONLY place where the
names of the authors can legally appear, except in cases where they have
given special permission in writing.
The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used
for promoting such software, products or services.
*/
/* $Id: swedll.h,v 1.75 2009/04/08 07:19:08 dieter Exp $ */
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _SWEDLL_H
#define _SWEDLL_H
#ifndef _SWEPHEXP_INCLUDED
#include "swephexp.h"
#endif
#ifdef USE_DLL16 /* 16bit DLL */
#define DllImport extern
#else
# ifdef __cplusplus
#define DllImport extern "C" __declspec( dllimport )
# else
#define DllImport __declspec( dllimport )
# endif
#endif
#if defined (PASCAL) || defined(__stdcall)
#define CALL_CONV_IMP __stdcall
#else
#define CALL_CONV_IMP
#endif
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);
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);
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);
/* the following are secret, for Victor Reijs' */
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);
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);
DllImport double CALL_CONV_IMP swe_degnorm(double deg);
DllImport char * CALL_CONV_IMP swe_version(char *);
DllImport int32 CALL_CONV_IMP swe_calc(
double tjd, int ipl, int32 iflag,
double *xx,
char *serr);
DllImport int32 CALL_CONV_IMP swe_calc_ut(
double tjd_ut, int32 ipl, int32 iflag,
double *xx,
char *serr);
DllImport int32 CALL_CONV_IMP swe_fixstar(
char *star, double tjd, int32 iflag,
double *xx,
char *serr);
DllImport int32 CALL_CONV_IMP swe_fixstar_ut(
char *star, double tjd_ut, int32 iflag,
double *xx,
char *serr);
DllImport int32 CALL_CONV_IMP swe_fixstar_mag(
char *star, double *xx, char *serr);
DllImport double CALL_CONV_IMP swe_sidtime0(double tjd_ut, double ecl, double nut);
DllImport double CALL_CONV_IMP swe_sidtime(double tjd_ut);
DllImport double CALL_CONV_IMP swe_deltat_ex(double tjd, int32 iflag, char *serr);
DllImport double CALL_CONV_IMP swe_deltat(double tjd);
DllImport int CALL_CONV_IMP swe_houses(
double tjd_ut, double geolat, double geolon, int hsys,
double *hcusps, double *ascmc);
DllImport int CALL_CONV_IMP swe_houses_ex(
double tjd_ut, int32 iflag, double geolat, double geolon, int hsys,
double *hcusps, double *ascmc);
DllImport int CALL_CONV_IMP swe_houses_armc(
double armc, double geolat, double eps, int hsys,
double *hcusps, double *ascmc);
DllImport double CALL_CONV_IMP swe_house_pos(
double armc, double geolon, double eps, int hsys, double *xpin, char *serr);
DllImport char * CALL_CONV_IMP swe_house_name(int hsys);
DllImport int32 CALL_CONV_IMP swe_gauquelin_sector(
double t_ut, int32 ipl, char *starname, int32 iflag, int32 imeth, double *geopos, double atpress, double attemp, double *dgsect, char *serr);
DllImport void CALL_CONV_IMP swe_set_sid_mode(
int32 sid_mode, double t0, double ayan_t0);
DllImport int32 CALL_CONV_IMP swe_get_ayanamsa_ex(double tjd_et, int32 iflag, double *daya, char *serr);
DllImport int32 CALL_CONV_IMP swe_get_ayanamsa_ex_ut(double tjd_ut, int32 iflag, double *daya, char *serr);
DllImport double CALL_CONV_IMP swe_get_ayanamsa(double tjd_et);
DllImport double CALL_CONV_IMP swe_get_ayanamsa_ut(double tjd_ut);
DllImport char * CALL_CONV_IMP swe_get_ayanamsa_name(int32 isidmode);
DllImport int CALL_CONV_IMP swe_date_conversion(
int y , int m , int d , /* year, month, day */
double utime, /* universal time in hours (decimal) */
char c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */
double *tjd);
DllImport double CALL_CONV_IMP swe_julday(
int year, int mon, int mday,
double hour,
int gregflag);
DllImport void CALL_CONV_IMP swe_revjul(
double jd, int gregflag,
int *year, int *mon, int *mday,
double *hour);
DllImport void CALL_CONV_IMP 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);
DllImport int32 CALL_CONV_IMP swe_utc_to_jd(
int32 iyear, int32 imonth, int32 iday,
int32 ihour, int32 imin, double dsec,
int32 gregflag, double *dret, char *serr);
DllImport void CALL_CONV_IMP swe_jdet_to_utc(
double tjd_et, int32 gregflag,
int32 *iyear, int32 *imonth, int32 *iday,
int32 *ihour, int32 *imin, double *dsec);
DllImport void CALL_CONV_IMP swe_jdut1_to_utc(
double tjd_ut, int32 gregflag,
int32 *iyear, int32 *imonth, int32 *iday,
int32 *ihour, int32 *imin, double *dsec);
DllImport int CALL_CONV_IMP swe_time_equ(
double tjd, double *e, char *serr);
DllImport int CALL_CONV_IMP swe_lmt_to_lat(double tjd_lmt, double geolon, double *tjd_lat, char *serr);
DllImport int CALL_CONV_IMP swe_lat_to_lmt(double tjd_lat, double geolon, double *tjd_lmt, char *serr);
DllImport double CALL_CONV_IMP swe_get_tid_acc(void);
DllImport void CALL_CONV_IMP swe_set_tid_acc(double tidacc);
DllImport void CALL_CONV_IMP swe_set_ephe_path(char *path);
DllImport void CALL_CONV_IMP swe_set_jpl_file(char *fname);
DllImport void CALL_CONV_IMP swe_close(void);
DllImport char * CALL_CONV_IMP swe_get_planet_name(int ipl, char *spname);
DllImport void CALL_CONV_IMP swe_cotrans(double *xpo, double *xpn, double eps);
DllImport void CALL_CONV_IMP swe_cotrans_sp(double *xpo, double *xpn, double eps);
DllImport void CALL_CONV_IMP swe_set_topo(double geolon, double geolat, double height);
DllImport void CALL_CONV_IMP swe_set_astro_models(int32 *imodel);
/****************************
* from swecl.c
****************************/
/* computes geographic location and attributes of solar
* eclipse at a given tjd */
DllImport int32 CALL_CONV_IMP swe_sol_eclipse_where(double tjd, int32 ifl, double *geopos, double *attr, char *serr);
DllImport int32 CALL_CONV_IMP swe_lun_occult_where(double tjd, int32 ipl, char *starname, int32 ifl, double *geopos, double *attr, char *serr);
/* computes attributes of a solar eclipse for given tjd, geolon, geolat */
DllImport int32 CALL_CONV_IMP swe_sol_eclipse_how(double tjd, int32 ifl, double *geopos, double *attr, char *serr);
/* finds time of next local eclipse */
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);
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);
/* finds time of next eclipse globally */
DllImport int32 CALL_CONV_IMP swe_sol_eclipse_when_glob(double tjd_start, int32 ifl, int32 ifltype, double *tret, int32 backward, char *serr);
/* finds time of next occultation globally */
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);
/* computes attributes of a lunar eclipse for given tjd */
DllImport int32 CALL_CONV_IMP swe_lun_eclipse_how(
double tjd_ut,
int32 ifl,
double *geopos,
double *attr,
char *serr);
DllImport int32 CALL_CONV_IMP swe_lun_eclipse_when(double tjd_start, int32 ifl, int32 ifltype, double *tret, int32 backward, char *serr);
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);
/* planetary phenomena */
DllImport int32 CALL_CONV_IMP swe_pheno(double tjd, int32 ipl, int32 iflag, double *attr, char *serr);
DllImport int32 CALL_CONV_IMP swe_pheno_ut(double tjd_ut, int32 ipl, int32 iflag, double *attr, char *serr);
DllImport double CALL_CONV_IMP swe_refrac(double inalt, double atpress, double attemp, int32 calc_flag);
DllImport double CALL_CONV_IMP swe_refrac_extended(double inalt, double geoalt, double atpress, double attemp, double lapse_rate, int32 calc_flag, double *dret);
DllImport void CALL_CONV_IMP swe_set_lapse_rate(double lapse_rate);
DllImport void CALL_CONV_IMP swe_azalt(
double tjd_ut,
int32 calc_flag,
double *geopos,
double atpress,
double attemp,
double *xin,
double *xaz);
DllImport void CALL_CONV_IMP swe_azalt_rev(
double tjd_ut,
int32 calc_flag,
double *geopos,
double *xin,
double *xout);
DllImport int32 CALL_CONV_IMP swe_rise_trans(
double tjd_ut, int32 ipl, char *starname,
int32 epheflag, int32 rsmi,
double *geopos,
double atpress, double attemp,
double *tret,
char *serr);
DllImport int32 CALL_CONV_IMP swe_rise_trans_true_hor(
double tjd_ut, int32 ipl, char *starname,
int32 epheflag, int32 rsmi,
double *geopos,
double atpress, double attemp,
double horhgt,
double *tret,
char *serr);
DllImport int32 CALL_CONV_IMP swe_nod_aps(double tjd_et, int32 ipl, int32 iflag,
int32 method,
double *xnasc, double *xndsc,
double *xperi, double *xaphe,
char *serr);
DllImport int32 CALL_CONV_IMP swe_nod_aps_ut(double tjd_ut, int32 ipl, int32 iflag,
int32 method,
double *xnasc, double *xndsc,
double *xperi, double *xaphe,
char *serr);
/*******************************************************
* other functions from swephlib.c;
* they are not needed for Swiss Ephemeris,
* but may be useful to former Placalc users.
********************************************************/
/* normalize argument into interval [0..DEG360] */
DllImport centisec CALL_CONV_IMP swe_csnorm(centisec p);
/* distance in centisecs p1 - p2 normalized to [0..360[ */
DllImport centisec CALL_CONV_IMP swe_difcsn (centisec p1, centisec p2);
DllImport double CALL_CONV_IMP swe_difdegn (double p1, double p2);
/* distance in centisecs p1 - p2 normalized to [-180..180[ */
DllImport centisec CALL_CONV_IMP swe_difcs2n(centisec p1, centisec p2);
DllImport double CALL_CONV_IMP swe_difdeg2n(double p1, double p2);
DllImport double CALL_CONV_IMP swe_difdeg2n(double p1, double p2);
DllImport double CALL_CONV_IMP swe_difrad2n(double p1, double p2);
DllImport double CALL_CONV_IMP swe_rad_midp(double x1, double x0);
DllImport double CALL_CONV_IMP swe_deg_midp(double x1, double x0);
/* round second, but at 29.5959 always down */
DllImport centisec CALL_CONV_IMP swe_csroundsec(centisec x);
/* double to int32 with rounding, no overflow check */
DllImport int32 CALL_CONV_IMP swe_d2l(double x);
DllImport void CALL_CONV_IMP swe_split_deg(double ddeg, int32 roundflag, int32 *ideg, int32 *imin, int32 *isec, double *dsecfr, int32 *isgn);
/* monday = 0, ... sunday = 6 */
DllImport int CALL_CONV_IMP swe_day_of_week(double jd);
DllImport char * CALL_CONV_IMP swe_cs2timestr(CSEC t, int sep, AS_BOOL suppressZero, char *a);
DllImport char * CALL_CONV_IMP swe_cs2lonlatstr(CSEC t, char pchar, char mchar, char *s);
DllImport char * CALL_CONV_IMP swe_cs2degstr(CSEC t, char *a);
/* additional functions for antiquated GFA basic DLL interface.
* double -> double *
* char -> char *
* void -> int
*/
DllImport int32 CALL_CONV_IMP swe_calc_d(
double *tjd, int ipl, int32 iflag,
double *x,
char *serr);
DllImport int32 CALL_CONV_IMP swe_calc_ut_d(
double *tjd, int16 ipl, int32 iflag,
double *x,
char *serr);
DllImport int32 CALL_CONV_IMP swe_fixstar_d(
char *star, double *tjd, int32 iflag,
double *x,
char *serr);
DllImport int32 CALL_CONV_IMP swe_fixstar_ut_d(
char *star, double *tjd, int32 iflag,
double *x,
char *serr);
DllImport int CALL_CONV_IMP swe_close_d(int ivoid);
DllImport int CALL_CONV_IMP swe_set_ephe_path_d(char *path);
DllImport int CALL_CONV_IMP swe_set_jpl_file_d(char *fname);
DllImport char * CALL_CONV_IMP swe_get_planet_name_d(int ipl, char *spname);
DllImport int CALL_CONV_IMP swe_deltat_d(double *tjd, double *deltat);
DllImport int CALL_CONV_IMP swe_sidtime0_d(double *tjd_ut, double *eps,
double *nut, double *sidt);
DllImport int CALL_CONV_IMP swe_sidtime_d(double *tjd_ut, double *sidt);
DllImport int CALL_CONV_IMP swe_set_sid_mode_d(
int32 sid_mode, double *t0, double *ayan_t0);
DllImport int CALL_CONV_IMP swe_get_ayanamsa_d(double *tjd_et, double *ayan);
DllImport int CALL_CONV_IMP swe_get_ayanamsa_ut_d(double *tjd_et, double *ayan);
DllImport int CALL_CONV_IMP swe_cotrans_d(double *xpo, double *xpn, double *eps);
DllImport int CALL_CONV_IMP swe_cotrans_sp_d(double *xpo, double *xpn, double *eps);
DllImport int CALL_CONV_IMP swe_set_topo_d(double *geolon, double *geolat, double *height);
DllImport int CALL_CONV_IMP swe_get_tid_acc_d(double *t_acc);
DllImport int CALL_CONV_IMP swe_set_tid_acc_d(double *t_acc);
DllImport int CALL_CONV_IMP swe_degnorm_d(double *x);
DllImport int CALL_CONV_IMP swe_date_conversion_d(
int y , int m , int d , /* year, month, day */
double *utime, /* universal time in hours (decimal) */
char *c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */
double *tjd);
DllImport int CALL_CONV_IMP swe_julday_d(
int year, int month, int day, double *hour,
int gregflag, double *tjd);
DllImport int CALL_CONV_IMP swe_revjul_d(
double *tjd,
int gregflag,
int *jyear, int *jmon, int *jday, double *jut);
DllImport int CALL_CONV_IMP swe_houses_d(
double *tjd, double *geolat, double *geolon, int hsys,
double *hcusps, double *ascmc);
DllImport int CALL_CONV_IMP swe_houses_ex_d(
double *tjd_ut, int32 iflag, double *geolat, double *geolon, int hsys,
double *hcusps, double *ascmc);
DllImport int CALL_CONV_IMP swe_houses_armc_d(
double *armc, double *geolat, double *eps, int hsys,
double *hcusps, double *ascmc);
DllImport int CALL_CONV_IMP swe_house_pos_d(
double *armc, double *geolon, double *eps, int hsys, double *xpin, double *hpos, char *serr);
/* normalize argument into interval [0..DEG360] */
DllImport centisec CALL_CONV_IMP swe_csnorm_d(centisec p);
/* distance in centisecs p1 - p2 normalized to [0..360[ */
DllImport centisec CALL_CONV_IMP swe_difcsn_d(centisec p1, centisec p2);
DllImport int CALL_CONV_IMP swe_difdegn_d(double *p1, double *p2, double *diff);
/* distance in centisecs p1 - p2 normalized to [-180..180[ */
DllImport centisec CALL_CONV_IMP swe_difcs2n_d(centisec p1, centisec p2);
DllImport int CALL_CONV_IMP swe_difdeg2n_d(double *p1, double *p2, double *diff);
/* round second, but at 29.5959 always down */
DllImport centisec CALL_CONV_IMP swe_csroundsec_d(centisec x);
/* double to int32 with rounding, no overflow check */
DllImport int32 CALL_CONV_IMP swe_d2l_d(double *x);
DllImport int CALL_CONV_IMP swe_split_deg_d(double *ddeg, int32 roundflag, int32 *ideg, int32 *imin, int32 *isec, double *dsecfr, int32 *isgn);
/* monday = 0, ... sunday = 6 */
DllImport int CALL_CONV_IMP swe_day_of_week_d(double *jd);
DllImport char * CALL_CONV_IMP swe_cs2timestr_d(CSEC t, int sep, AS_BOOL suppressZero, char *a);
DllImport char * CALL_CONV_IMP swe_cs2lonlatstr_d(CSEC t, char *pchar, char *mchar, char *s);
DllImport char * CALL_CONV_IMP swe_cs2degstr_d(CSEC t, char *a);
/****************************
* from swecl.c
****************************/
/* computes geographic location and attributes of solar
* eclipse at a given tjd */
DllImport int32 CALL_CONV_IMP swe_sol_eclipse_where_d(double *tjd_ut, int32 ifl, double *geopos, double *attr, char *serr);
/* computes attributes of a solar eclipse for given tjd, geolon, geolat */
DllImport int32 CALL_CONV_IMP swe_sol_eclipse_how_d(double *tjd_ut, int32 ifl, double geolon, double geolat, double geohgt, double *attr, char *serr);
/* finds time of next local eclipse */
DllImport int32 CALL_CONV_IMP swe_sol_eclipse_when_loc_d(double *tjd_start, int32 ifl, double *geopos, double *tret, double *attr, AS_BOOL backward, char *serr);
/* finds time of next eclipse globally */
DllImport int32 CALL_CONV_IMP swe_sol_eclipse_when_glob_d(double *tjd_start, int32 ifl, int32 ifltype,
double *tret, AS_BOOL backward, char *serr);
/* computes attributes of a lunar eclipse for given tjd */
DllImport int32 CALL_CONV_IMP swe_lun_eclipse_how_d(
double *tjd_ut,
int32 ifl,
double *attr,
char *serr);
DllImport int32 CALL_CONV_IMP swe_lun_eclipse_when_d(double *tjd_start, int32 ifl, int32 ifltype,
double *tret, AS_BOOL backward, char *serr);
DllImport int32 CALL_CONV_IMP swe_pheno_d(double *tjd, int32 ipl, int32 iflag,
double *attr, char *serr);
DllImport int32 CALL_CONV_IMP swe_pheno_ut_d(double *tjd_ut, int32 ipl, int32 iflag, double *attr, char *serr);
DllImport int CALL_CONV_IMP swe_refrac_d(double *inalt, double *atpress, double *attemp, int32 calc_flag, double *retalt);
DllImport int CALL_CONV_IMP swe_azalt_d(
double *tjd_ut,
int32 calc_flag,
double *geopos,
double *atpress,
double *attemp,
double *xin,
double *xaz);
DllImport int CALL_CONV_IMP swe_azalt_rev_d(
double *tjd_ut,
int32 calc_flag,
double *geopos,
double *xin,
double *xout);
DllImport int32 CALL_CONV_IMP swe_rise_trans_d(
double *tjd_ut, int32 ipl, char *starname,
int32 epheflag, int32 rsmi,
double *geopos,
double *atpress, double *attemp,
double *tret,
char *serr);
DllImport int32 CALL_CONV_IMP swe_nod_aps_d(double *tjd_et, int32 ipl, int32 iflag,
int32 method,
double *xnasc, double *xndsc,
double *xperi, double *xaphe,
char *serr);
DllImport int32 CALL_CONV_IMP swe_nod_aps_ut_d(double *tjd_ut, int32 ipl, int32 iflag,
int32 method,
double *xnasc, double *xndsc,
double *xperi, double *xaphe,
char *serr);
#endif /* !_SWEDLL_H */
#ifdef __cplusplus
} /* extern C */
#endif

3369
swe/src/swehel.c Normal file

File diff suppressed because it is too large Load Diff

1823
swe/src/swehouse.c Normal file

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More