Compare commits

..

No commits in common. "main" and "gh-pages" have entirely different histories.

81 changed files with 891 additions and 12018 deletions

120
.gitignore vendored
View File

@ -1,118 +1,2 @@
# General ignore rules
.deps/
.libs/
*~
*.bak
.*.sw?
*.o
*.lo
*.la
/tags
/*.orig
/*.rej
/*.tab.c
/.dirstamp
*.gir
*.typelib
*.gschema.valid
ChangeLog
# Files created by the build tools
Makefile
Makefile.in
/GPATH
/GRTAGS
/GSYMS
/GTAGS
/ID
/TAGS
/_libs
/config.cache
/config.h
/config.h.in
/aclocal.m4
/ar-lib
/ltmain.sh
/autom4te.cache/
/m4/
/missing
/stamp-h1
/config.guess
/config.log
/config.rpath
/config.lt
/config.status
/config.sub
/config.status.lineno
/configure
/depcomp
/install-sh
/configure.lineno
/libtool
/compile
/so_locations
# Testing related files
/test-driver
/tests/*-test
/tests/*-test.log
/tests/*-test.trs
/swe-glib-lcov*
test-suite.log
*.gcno
*.gcda
*.gcov
# Translation related files
/ABOUT-NLS
/po/POTFILES
/po/Makevars.template
/po/Makefile.in.in
/po/stamp-it
/po/*.gmo
/po/*.mo
/po/*.pot
/po/Rules-quot
/po/boldquot.sed
/po/en@boldquot.header
/po/en@quot.header
/po/insert-header.sin
/po/quot.sed
/po/remove-potcdate.sin
/po/.intltool-merge-cache
/intltool-extract
/intltool-extract.in
/intltool-merge
/intltool-merge.in
/intltool-update
/intltool-update.in
# SWE-GLib related files
/src/gswe-enumtypes.c
/src/gswe-enumtypes.h
/src/gswetest
/data/swe-glib.pc
/data/swe-glib.spec
/src/*.vapi
/src/gswe-version.h
/data/*.gschema.xml
# Documentation related files
/docs/reference/*/*.actions
/docs/reference/*/*.args
/docs/reference/*/*.hierarchy
/docs/reference/*/*.interfaces
/docs/reference/*/*.prerequisites
/docs/reference/*/*.signals
/docs/reference/*/*.stamp
/docs/reference/*/*.types
/docs/reference/*/*-decl-list.txt
/docs/reference/*/*-decl.txt
/docs/reference/*/*-overrides.txt
/docs/reference/*/*-undeclared.txt
/docs/reference/*/version.xml
/docs/reference/*/*-undocumented.txt
/docs/reference/*/*-unused.txt
/docs/reference/*/xml/
/docs/reference/*/html/
/gtk-doc.make
Gemfile.lock
/_site/

View File

@ -1,17 +0,0 @@
sudo: false
language: c
addons:
apt:
packages:
- libglib2.0-dev
- gobject-introspection
- gnome-common
- autopoint
before_script: ./autogen.sh
script:
- make
- make check
before_install:
- pip install --user codecov
after_success:
- codecov

2
Gemfile Normal file
View File

@ -0,0 +1,2 @@
source 'https://rubygems.org'
gem 'github-pages'

View File

@ -1,39 +0,0 @@
include $(top_srcdir)/swe-glib.mk
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = src po data tests
if ENABLE_GTK_DOC
SUBDIRS += docs/reference/swe-glib
endif
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc
intltool_extra = intltool-extract.in intltool-merge.in intltool-update.in
EXTRA_DIST += $(intltool_extra) $(header_DATA) autogen.sh
DISTCLEANFILES += intltool-extract intltool-merge intltool-update
MAINTAINERCLEANFILES += ChangeLog
distclean-local:
if test "$(srcdir)" = "."; then :; else \
rm -f ChangeLog; \
fi
ChangeLog:
$(AM_V_GEN) if test -d "$(srcdir)/.git"; then \
(GIT_DIR=$(top_srcdir)/.git ./missing --run git log -M -C --name-status --date=short --no-color) | fmt --split-only > $@.tmp \
&& mv -f $@.tmp $@ \
|| ($(RM) $@.tmp; \
echo Failed to generate ChangeLog, your ChangeLog may be outdated >&2; \
(test -f $@ || echo git log is required to generate this file >> $@)); \
else \
test -f $@ || \
(echo A git checkout and git log is required to generate ChangeLog >&2 && \
echo A git checkout and git log is required to generate this file >> $@); \
fi
.PHONY: ChangeLog

155
README.md
View File

@ -1,155 +0,0 @@
# SWE-GLib
[![Build Status](https://travis-ci.org/gergelypolonkai/swe-glib.svg?branch=master)](https://travis-ci.org/gergelypolonkai/swe-glib)
[![codecov.io](https://codecov.io/github/gergelypolonkai/swe-glib/coverage.svg?branch=master)](https://codecov.io/github/gergelypolonkai/swe-glib?branch=master)
SWE-GLib is a GLib style wrapper library around Astrodienst's
[Swiss Ephemeris library](http://www.astro.com/swisseph/).
The source tree contains Astrodienst's ephemeride files, as requested
by Alois Treindl of Astrodienst in a mail written to me on 24 July,
2013.
## GTK-Doc
The project utilizes [GTK-Doc](http://www.gtk.org/gtk-doc/), requiring
version 1.19 or later. Although the generated documentation is a bit
messy (not everything is documented, and there are some unresolved
variables, like [SERVER] on the generated index page.
Still, the documentation generates well, and at least gives a clue
about object usage.
## Bindings
SWE-GLib utilizes
[GObject Introspection](https://wiki.gnome.org/GObjectIntrospection),
which means it is available for many languages. Check out the
[examples](examples) directory for some sample code!
## Usage
Many functions return non-opaque C structs; their documentation can be
found inline, and in the generated GTK-Doc. Unless otherwise stated,
the returned values should never be freed.
### Creating the required objects
Then you need to create a `GsweTimestamp` object:
```c
GsweTimestamp *timestamp = gswe_timestamp_new_from_gregorian_full(1983, 3, 7, 11, 54, 45, 0, 1.0);
```
The `GsweTimetamp` object is used to convert dates between the Gregorian calendar dates and Julian Day values (not to be confused with Julian calendar dates).
Next, you have to create a `GsweMoment` object:
```c
GsweMoment *moment = gswe_moment_new_full(timestamp, 19.081599, 47.462485, 300.0, GSWE_HOUSE_PLACIDUS);
```
The `GsweMoment` object holds information of a given moment at a given place on earth. `gswe_moment_new_full()` requires a `GsweTimestamp` object, some geographical coordinates (in degrees) together with altitude above sea level (in meters), and a house system to use.
### Adding planets
After that you have to add some planets you want to do calculations on.
```c
gswe_moment_add_planet(moment, GSWE_PLANET_SUN);
```
Alternatively, you can add every planets known by SWE-GLib with
```c
gswe_moment_add_all_planets(moment);
```
### Getting planet positions and such
Then, you can get the planet data with
```c
GswePlanetData *sun_data = gswe_moment_get_planet(moment, GSWE_PLANET_SUN);
```
### Getting aspects and antiscia
SWE-GLib is also able to calculate aspects and antiscia. This functionality does not exist in the Swiss Ephemeris library, though. For this, of course, you have to add multiple planets (at least two) to your `GsweMoment`. After that, you can call `gswe_moment_get_planet_aspects()` and `gswe_moment_get_planet_antiscia()`.
```c
GList *sun_aspects = gswe_moment_get_planet_aspects(moment, GSWE_PLANET_SUN);
GList *sun_antiscia = gswe_moment_get_planet_antiscia(moment, GSWE_PLANET_SUN);
```
The returned GList objects hold zero or more `GsweAspectData` or
`GsweAntiscionData` objects, respectively.
### Getting the Moon phase
Last, but not least, SWE-GLib can calculate Moon's phase at the given
moment. For that, you have to call `gswe_moment_get_moon_phase()`:
```c
GsweMoonPhaseData *moon_phase = gswe_moment_get_moon_phase(moment);
```
### About altitude
The Swiss Ephemeris library requires the altitude value to be
specified for several calculations. It also notifies how important it
is:
> the altitude above sea must be in meters. Neglecting the altitude
> can result in an error of about 2 arc seconds with the moon and at
> an altitude 3000m.
2 arc seconds is about 0.000555 degrees of error, which is, well, kind
of small. Of course, if you need very precise horoscopes or need
planetary positions for a totally different thing, you should really
provide a (close to) exact value; otherwise, it is safe to pass any
value (well, which seems logical: the average level of all dry lands
is about 840 meters; the average level of the whole planet Earth
(including oceans and seas) is around 280 meters. Providing a value of
~400 should be OK most of the time).
## API stability
The project is currently transitioning to 2.0. master is a bit fragile
at the moment, 1.x versions are considered to be stable (although see
commit 8f52aba about a huge typo-bug).
## Limitations
### Topocentric calculations only
Although the original Swiss Ephemeris library supports it, SWE-GLib
can't do Heliocentric, nor Geocentric (as seen from the center of
Earth) calculations, only Topocentric (as seen from a given point on
Earths surface) calculations yet.
### Database size
The size of all data files provided by Astrodienst is around
40MB. Although it should not be a problem with today's home hardware,
it can be a hard requirement on embedded systems. For basic
calculations, keeping the following files under $(datadir)/swe-glib is
usually enough:
* `seas_18.se1`
* `semo_18.se1`
* `sepl_18.se1`
### Fixed stars are not known yet
Although Swiss Ephemeris has the functionality to calculate the
position of fixed stars, SWE-GLib doesn't provide such
functionality. This, however, is a planned feature for the close
future.
## Licencing
As the underlying Swiss Ephemeris is published under GPL (or a
commercial license I can not afford), SWE-GLib is also uses that. This
means that you can currently use SWE-GLib in software published under
the GNU GPL v3 (or, at your option, any later version).

View File

@ -1,63 +0,0 @@
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
PKG_NAME="swe-glib"
(test -f $srcdir/configure.ac \
&& test -f $srcdir/src/swe-glib.c) || {
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
echo " top-level $PKG_NAME directory"
exit 1
}
m4dir=`grep '^AC_CONFIG_MACRO_DIR' configure.ac | sed -n -e 's/AC_CONFIG_MACRO_DIR(\([^()]*\))/\1/p' | sed -e 's/^\[\(.*\)\]$/\1/' | sed -e 1q`
if [ -n "$m4dir" ]; then
m4dir="-I $m4dir"
fi
echo "Running libtoolize"
libtoolize --force --copy || exit $?
echo "Running autopoint"
autopoint --force || exit $?
echo "Running intltoolize"
intltoolize --force --copy --automake || exit $?
GTKDOCIZE=$(which gtkdocize 2>/dev/null)
if test -z $GTKDOCIZE; then
echo "You don't have gtk-doc installed, and thus won't be able to generate the documentation."
rm -f gtk-doc.make
rm -f $m4dir/gtk-doc.m4
cat > gtk-doc.make <<EOF
EXTRA_DIST =
CLEANFILES =
EOF
else
echo "Running gtkdocize"
gtkdocize --copy || exit $?
fi
echo "Running aclocal"
aclocal $m4dir $ACLOCAL_FLAGS || exit $?
echo "Running autoconf"
autoconf || exit $?
if grep "^A[CM]_CONFIG_HEADER" configure.ac >/dev/null; then
echo "Running autoheader"
autoheader || exit $?
# this prevents automake from thinking config.h.in is out of
# date, since autoheader doesn't touch the file if it doesn't
# change.
test -f config.h.in && touch config.h.in
fi
echo "Running automake"
automake --gnu --add-missing --copy -Wno-portability || exit $?
"$srcdir/configure" "$@"

View File

@ -1,182 +0,0 @@
m4_define([swe_glib_major_version], [2])
m4_define([swe_glib_minor_version], [1])
m4_define([swe_glib_micro_version], [0])
m4_define([swe_glib_version], [swe_glib_major_version.swe_glib_minor_version.swe_glib_micro_version])
m4_define([swe_glib_api_version], [swe_glib_major_version.0])
m4_define([swe_major_version], [2])
m4_define([swe_minor_version], [0])
m4_define([swe_version], [swe_major_version.swe_minor_version])
AC_INIT([SWE-GLib], [swe_glib_version], [gergely@polonkai.eu], [swe-glib])
AM_INIT_AUTOMAKE([-Wall foreign])
AC_CONFIG_HEADERS([config.h])
AM_SILENT_RULES([yes])
dnl ********************************
dnl *** Enable debugging support ***
dnl ********************************
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],
[compile with debugging support]),
[enable_debug=$enableval], [enable_debug=no])
if test "x$enable_debug" = "xyes" ; then
AC_DEFINE([DEBUG], [1], [Define if debugging is enabled])
if test x$cflags_set != xset ; then
case " $CFLAGS " in
*[[\ \ ]]-g[[\ \ ]]*) ;;
*) CFLAGS="$CFLAGS -g" ;;
esac
fi
fi
AC_SUBST([SWE_GLIB_MAJOR_VERSION], [swe_glib_major_version])
AC_SUBST([SWE_GLIB_MINOR_VERSION], [swe_glib_minor_version])
AC_SUBST([SWE_GLIB_MICRO_VERSION], [swe_glib_micro_version])
AC_SUBST([SWE_GLIB_VERSION], [swe_glib_version])
AC_SUBST([SWE_GLIB_API_VERSION], [swe_glib_api_version])
AC_SUBST([SWE_GLIB_API_VERSION_U], [AS_TR_SH([swe_glib_api_version])])
AC_SUBST([SWE_VERSION], [swe_version])
AC_PROG_CC
AM_PROG_CC_C_O
AM_PROG_AR
AC_PROG_LIBTOOL
IT_PROG_INTLTOOL([0.35.0])
GETTEXT_PACKAGE=swe-glib
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [GETTEXT package name])
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.17])
LT_INIT
AC_CHECK_LIB([m], [atan])
m4_ifdef([GTK_DOC_CHECK], [
GTK_DOC_CHECK([1.19], [--flavour no-tmpl])
],[
AM_CONDITIONAL([ENABLE_GTK_DOC], false)
])
GOBJECT_INTROSPECTION_CHECK([1.0])
m4_ifdef([VALA_PROG_VAPIGEN], [
VALA_PROG_VAPIGEN([0.21])
AM_CONDITIONAL([HAVE_VAPIGEN], true)
],[
AM_CONDITIONAL([HAVE_VAPIGEN], false)
])
PKG_PROG_PKG_CONFIG
AC_PATH_PROG([GLIB_MKENUMS], [glib-mkenums])
AC_CANONICAL_HOST
native_win32=no
case "$host" in
*-*-mingw*)
native_win32=yes
;;
esac
AM_CONDITIONAL(OS_WIN32, [test "$native_win32" = "yes"])
AM_CONDITIONAL(OS_UNIX, [test "$native_win32" != "yes"])
AC_PATH_PROG([GTESTER], [gtester])
AC_PATH_PROG([GTESTER_REPORT], [gtester-report])
dnl ************************************
dnl *** Enable lcov coverage reports ***
dnl ************************************
AC_ARG_ENABLE(coverage,
AS_HELP_STRING([--enable-coverage],
[enable coverage testing with gcov]),
[use_gcov=$enableval], [use_gcov=no])
AS_IF([ test "x$use_gcov" = "xyes"], [
dnl we need gcc:
if test "$GCC" != "yes"; then
AC_MSG_ERROR([GCC is required for --enable-coverage])
fi
dnl Check if ccache is being used
AC_CHECK_PROG(SHTOOL, shtool, shtool)
case `$SHTOOL path $CC` in
*ccache*[)] gcc_ccache=yes;;
*[)] gcc_ccache=no;;
esac
if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then
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"
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, [
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
if test "$ltp_version" = "$ltp_check_version"; then
swe_glib_cv_ltp_version="$ltp_check_version (ok)"
fi
done
])
], [
ltp_msg="To enable code coverage reporting you must have one of the following LTP versions installed: $ltp_version_list"
AC_MSG_ERROR([$ltp_msg])
])
case $swe_glib_cv_ltp_version in
""|invalid[)]
ltp_msg="You must have one of the following versions of LTP: $ltp_version_list (found: $ltp_version)."
AC_MSG_ERROR([$ltp_msg])
LTP="exit 0;"
;;
esac
if test -z "$LTP_GENHTML"; then
AC_MSG_ERROR([Could not find genhtml from the LTP package])
fi
dnl Remove all optimization flags from CFLAGS
changequote({,})
CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'`
changequote([,])
dnl Add the special gcc flags
CFLAGS="$CFLAGS -O0 -fprofile-arcs -ftest-coverage"
LDFLAGS="$LDFLAGS -lgcov"
])
if test "x$enable_debug" = "xyes" ; then
AC_DEFINE([DEBUG], [1], [Define if debugging is enabled])
if test x$cflags_set != xset ; then
case " $CFLAGS " in
*[[\ \ ]]-g[[\ \ ]]*) ;;
*) CFLAGS="$CFLAGS -g" ;;
esac
fi
fi
PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.32.0])
PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.32.0])
PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26])
GLIB_GSETTINGS
AC_CONFIG_MACRO_DIR([m4])
LIBSWE_GLIB_LIBS='$(top_builddir)/src/libswe-glib-$(SWE_GLIB_API_VERSION).la'
AC_SUBST(LIBSWE_GLIB_LIBS)
AC_CONFIG_FILES([
Makefile
src/Makefile
data/Makefile
po/Makefile.in
tests/Makefile
data/swe-glib.pc
data/swe-glib.spec
src/gswe-version.h
])
AM_COND_IF([ENABLE_GTK_DOC], [
AC_CONFIG_FILES([
docs/reference/swe-glib/version.xml
docs/reference/swe-glib/Makefile
])
])
AC_OUTPUT

View File

@ -1,16 +0,0 @@
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = swe-glib.pc $(NULL)
eu.polonkai.gergely.swe-glib.gschema.xml: gschema.template $(top_builddir)/src/gswe-types.h
$(GLIB_MKENUMS) --comments "<!-- @comment@ -->" --template $(filter %.template,$^) $(filter-out %.template,$^) > \
$@.tmp && mv $@.tmp $@
gsettings_SCHEMAS = eu.polonkai.gergely.swe-glib.gschema.xml
@GSETTINGS_RULES@
EXTRA_DIST = \
swe-glib.spec \
gschema.template
DISTCLEANFILES = $(gsettings_SCHEMAS)

View File

@ -1,22 +0,0 @@
/*** BEGIN file-header ***/
<schemalist>
/*** END file-header ***/
/*** BEGIN file-production ***/
/*** END file-production ***/
/*** BEGIN value-header ***/
<enum id="eu.polonkai.gergely.swe-glib.@EnumName@">
/*** END value-header ***/
/*** BEGIN value-production ***/
<value nick="@valuenick@" value="@valuenum@"/>
/*** END value-production ***/
/*** BEGIN value-tail ***/
</enum>
/*** END value-tail ***/
/*** BEGIN file-tail ***/
</schemalist>
/*** END file-tail ***/

View File

@ -1,11 +0,0 @@
prefix=@prefix@
exec_prefix = @exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: SWE-GLib
Description: GLib wrapper functions for the Swiss Ephemeris library
Version: @VERSION@
Requires: glib-2.0
Libs: -L${libdir} -lswe-glib-@SWE_GLIB_API_VERSION@
Cflags: -I${includedir}/swe-glib

View File

@ -1,93 +0,0 @@
Name: swe-glib
Version: @SWE_GLIB_VERSION@
Release: 1%{?dist}
Summary: A GLib style wrapper library around the Swiss Ephemeris library, created by Astrodienst.
Group: Development/Libraries
License: LGPLv3+
URL: http://gergely.polonkai.eu/swe-glib/
Source: http://gergely.polonkai.eu/download/%{name}-%{version}.tar.gz
BuildRequires: pkgconfig
BuildRequires: glib2-devel
BuildRequires: gettext
BuildRequires: automake autoconf libtool
BuildRequires: gtk-doc
Requires: glib2
Requires: %{name}-data = %{version}-%{release}
%description
SWE-GLib is a GLib style wrapper library around the Swiss Ephemeris library,
created by Astrodienst. It can be used for precise astronomical calculation
based on time and topographic location.
%package data
Summary: A GLib style wrapper library around the Swiss Ephemeris library, created by Astrodienst.
Group: Development/Libraries
BuildArch: noarch
%description data
The swe-glib-data package includes data files for the SWE-GLib library.
%package devel
Summary: A GLib style wrapper library around the Swiss Ephemeris library, created by Astrodienst.
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
%description devel
The swe-glib-devel package includes the header files for the SWE-GLib library.
%package doc
Summary: A GLib style wrapper library around the Swiss Ephemeris library, created by Astrodienst.
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
%description doc
The swe-glib-doc package includes documentation for the SWE-GLib library.
%prep
%setup -q
%build
%configure --enable-gtk-doc
make %{?_smp_mflags}
%install
make install DESTDIR=%{buildroot}
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/*.a
rm -f $RPM_BUILD_ROOT%{_datadir}/locale/hu/LC_MESSAGES/swe-glib.mo
%post
/sbin/ldconfig
%postun
/sbin/ldconfig
%files
%doc ChangeLog
%{_libdir}/libswe-@SWE_VERSION@.so.*
%{_libdir}/libswe-glib-@SWE_GLIB_API_VERSION@.so.*
%{_libdir}/girepository-1.0/SweGlib-@SWE_GLIB_API_VERSION@.typelib
%files data
%{_datadir}/swe-glib/*.se1
%{_datadir}/swe-glib/seleapsec.txt
%files doc
%doc %{_datadir}/gtk-doc/html/*
%files devel
%{_includedir}/*
%{_libdir}/pkgconfig/*
%{_datadir}/gir-1.0/SweGlib-@SWE_GLIB_API_VERSION@.gir
%{_libdir}/libswe-@SWE_VERSION@.so
%{_libdir}/libswe-glib-@SWE_GLIB_API_VERSION@.so
%{_datadir}/vala/vapi/SweGlib-@SWE_GLIB_API_VERSION@.vapi
%changelog

View File

@ -1,117 +0,0 @@
## Process this file with automake to produce Makefile.in
# We require automake 1.6 at least.
AUTOMAKE_OPTIONS = 1.6
# This is a blank Makefile.am for using gtk-doc.
# Copy this to your project's API docs directory and modify the variables to
# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples
# of using the various options.
# The name of the module, e.g. 'glib'.
DOC_MODULE=swe-glib
# Uncomment for versioned docs and specify the version of the module, e.g. '2'.
DOC_MODULE_VERSION=$(SWE_GLIB_API_VERSION)
# The top-level XML file (SGML in the past). You can change this if you want to.
DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml
# Directories containing the source code.
# gtk-doc will search all .c and .h files beneath these paths
# for inline comments documenting functions and macros.
# e.g. DOC_SOURCE_DIR=$(top_srcdir)/gtk $(top_srcdir)/gdk
DOC_SOURCE_DIR=$(top_srcdir)/src
# Extra options to pass to gtkdoc-scangobj. Not normally needed.
SCANGOBJ_OPTIONS=
# Extra options to supply to gtkdoc-scan.
# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED"
SCAN_OPTIONS=--rebuild-types --deprecated-guards="GSWE_DISABLE_DEPRECATED"
# Extra options to supply to gtkdoc-mkdb.
# e.g. MKDB_OPTIONS=--xml-mode --output-format=xml
MKDB_OPTIONS=--xml-mode --output-format=xml
# Extra options to supply to gtkdoc-mktmpl
# e.g. MKTMPL_OPTIONS=--only-section-tmpl
MKTMPL_OPTIONS=
# Extra options to supply to gtkdoc-mkhtml
MKHTML_OPTIONS=
# Extra options to supply to gtkdoc-fixref. Not normally needed.
# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html
FIXXREF_OPTIONS=
# Used for dependencies. The docs will be rebuilt if any of these change.
# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h
# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c
HFILE_GLOB=$(top_srcdir)/src/*.h
CFILE_GLOB=$(top_srcdir)/src/*.c
# Extra header to include when scanning, which are not under DOC_SOURCE_DIR
# e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h
EXTRA_HFILES=
# Header files or dirs to ignore when scanning. Use base file/dir names
# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h private_code
IGNORE_HFILES = \
swe-glib-private.h \
gswe-enumtypes.h \
gswe-moon-phase-data-private.h \
gswe-sign-info-private.h \
gswe-planet-info-private.h \
gswe-planet-data-private.h \
gswe-aspect-info-private.h \
gswe-aspect-data-private.h \
gswe-antiscion-axis-info-private.h \
gswe-antiscion-data-private.h \
gswe-house-system-info-private.h \
gswe-house-data-private.h \
$(NULL)
# Images to copy into HTML directory.
# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
HTML_IMAGES=
# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
# e.g. content_files=running.sgml building.sgml changes-2.0.sgml
content_files=
# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded
# These files must be listed here *and* in content_files
# e.g. expand_content_files=running.sgml
expand_content_files=
# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library.
# Only needed if you are using gtkdoc-scangobj to dynamically query widget
# signals and properties.
# 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)
# This includes the standard gtk-doc make rules, copied by gtkdocize.
include $(top_srcdir)/gtk-doc.make
# Other files to distribute
# e.g. EXTRA_DIST += version.xml.in
EXTRA_DIST += version.xml.in
# Files not to distribute
# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types
# for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt
DISTCLEANFILES = $(DOC_MODULE).types
# Comment this out if you want 'make check' to test you doc status
# and run some sanity checks
if ENABLE_GTK_DOC
TESTS_ENVIRONMENT = cd $(srcdir) && \
DOC_MODULE=$(DOC_MODULE) DOC_MAIN_SGML_FILE=$(DOC_MAIN_SGML_FILE) \
SRCDIR=$(abs_srcdir) BUILDDIR=$(abs_builddir)
#TESTS = $(GTKDOC_CHECK)
endif

View File

@ -1,52 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
[
<!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY version SYSTEM "version.xml">
<!ENTITY server "gergely.polonkai.eu">
]>
<book id="index">
<bookinfo>
<title>SWE-GLib Reference Manual</title>
<releaseinfo>
for SWE-GLib &version;.
The latest version of this documentation can be found on-line at
<ulink role="online-location" url="http://&server;/swe-glib/index.html">http://&server;/swe-glib/</ulink>.
</releaseinfo>
</bookinfo>
<chapter>
<title>SWE-GLib</title>
<xi:include href="xml/gswe-types.xml"/>
<xi:include href="xml/gswe-sign-info.xml" />
<xi:include href="xml/gswe-planet-info.xml" />
<xi:include href="xml/gswe-planet-data.xml" />
<xi:include href="xml/gswe-moon-phase-data.xml"/>
<xi:include href="xml/gswe-aspect-data.xml" />
<xi:include href="xml/gswe-aspect-info.xml" />
<xi:include href="xml/gswe-antiscion-axis-info.xml" />
<xi:include href="xml/gswe-antiscion-data.xml" />
<xi:include href="xml/gswe-house-system-info.xml" />
<xi:include href="xml/gswe-house-data.xml" />
<xi:include href="xml/swe-glib.xml"/>
<xi:include href="xml/gswe-moment.xml"/>
<xi:include href="xml/gswe-timestamp.xml"/>
<xi:include href="xml/gswe-version.xml"/>
</chapter>
<chapter id="object-tree">
<title>Object Hierarchy</title>
<xi:include href="xml/tree_index.sgml"/>
</chapter>
<index id="api-index-full">
<title>API Index</title>
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
</index>
<index id="deprecated-api-index" role="deprecated">
<title>Index of deprecated API</title>
<xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
</index>
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
</book>

View File

@ -1,331 +0,0 @@
<SECTION>
<FILE>gswe-moment</FILE>
<TITLE>GsweMoment</TITLE>
GsweMoment
GsweMomentClass
gswe_moment_new
gswe_moment_new_full
gswe_moment_set_timestamp
gswe_moment_get_timestamp
gswe_moment_set_coordinates
gswe_moment_get_coordinates
gswe_moment_set_house_system
gswe_moment_get_house_system
gswe_moment_get_house_cusps
gswe_moment_get_house
gswe_moment_has_planet
gswe_moment_add_planet
gswe_moment_add_all_planets
gswe_moment_get_all_planets
gswe_moment_get_planet
gswe_moment_get_sign_planets
gswe_moment_get_house_planets
gswe_moment_get_element_points
gswe_moment_get_quality_points
gswe_moment_get_moon_phase
gswe_moment_get_all_aspects
gswe_moment_get_planet_aspects
gswe_moment_get_aspect_by_planets
gswe_moment_get_all_antiscia
gswe_moment_get_all_planet_antiscia
gswe_moment_get_axis_all_antiscia
gswe_moment_get_axis_planet_antiscia
gswe_moment_get_antiscion_by_planets
<SUBSECTION Standard>
GSWE_IS_MOMENT
GSWE_IS_MOMENT_CLASS
GSWE_MOMENT
GSWE_MOMENT_CLASS
GSWE_MOMENT_GET_CLASS
GSWE_TYPE_MOMENT
GsweMomentPrivate
gswe_moment_get_type
</SECTION>
<SECTION>
<FILE>gswe-moon-phase-data</FILE>
gswe_moon_phase_data_new
gswe_moon_phase_data_ref
gswe_moon_phase_data_unref
gswe_moon_phase_data_calculate_by_timestamp
gswe_moon_phase_data_calculate_by_jd
gswe_moon_phase_data_get_phase
gswe_moon_phase_data_get_illumination
GsweMoonPhaseData
<SUBSECTION Standard>
GSWE_TYPE_MOON_PHASE_DATA
gswe_moon_phase_data_get_type
</SECTION>
<SECTION>
<FILE>gswe-sign-info</FILE>
GsweSignInfo
gswe_find_sign_info_by_id
gswe_sign_info_new
gswe_sign_info_ref
gswe_sign_info_unref
gswe_sign_info_set_sign
gswe_sign_info_get_sign
gswe_sign_info_set_name
gswe_sign_info_get_name
gswe_sign_info_set_element
gswe_sign_info_get_element
gswe_sign_info_set_quality
gswe_sign_info_get_quality
<SUBSECTION Standard>
GSWE_TYPE_SIGN_INFO
gswe_sign_info_get_type
</SECTION>
<SECTION>
<FILE>gswe-planet-info</FILE>
GswePlanetInfo
gswe_find_planet_info_by_id
gswe_all_planets
gswe_planet_info_new
gswe_planet_info_ref
gswe_planet_info_unref
gswe_planet_info_set_name
gswe_planet_info_get_name
gswe_planet_info_set_orb
gswe_planet_info_get_orb
gswe_planet_info_set_planet
gswe_planet_info_get_planet
gswe_planet_info_set_points
gswe_planet_info_get_points
gswe_planet_info_set_real_body
gswe_planet_info_get_real_body
gswe_planet_info_set_sweph_id
gswe_planet_info_get_sweph_id
<SUBSECTION Standard>
GSWE_TYPE_PLANET_INFO
gswe_planet_info_get_type
</SECTION>
<SECTION>
<FILE>gswe-planet-data</FILE>
GswePlanetData
gswe_planet_data_new
gswe_planet_data_ref
gswe_planet_data_unref
gswe_planet_data_set_planet
gswe_planet_data_get_planet
gswe_planet_data_set_planet_info
gswe_planet_data_get_planet_info
gswe_planet_data_get_position
gswe_planet_data_get_retrograde
gswe_planet_data_get_house
gswe_planet_data_get_sign
gswe_planet_data_get_sign_info
<SUBSECTION Standard>
GSWE_TYPE_PLANET_DATA
gswe_planet_data_get_type
</SECTION>
<SECTION>
<FILE>gswe-aspect-info</FILE>
GsweAspectInfo
gswe_find_aspect_info_by_id
gswe_all_aspects
gswe_aspect_info_new
gswe_aspect_info_ref
gswe_aspect_info_unref
gswe_aspect_info_set_aspect
gswe_aspect_info_get_aspect
gswe_aspect_info_set_name
gswe_aspect_info_get_name
gswe_aspect_info_set_size
gswe_aspect_info_get_size
gswe_aspect_info_set_orb_modifier
gswe_aspect_info_get_orb_modifier
gswe_aspect_info_set_harmonic
gswe_aspect_info_get_harmonic
gswe_aspect_info_set_major
gswe_aspect_info_get_major
<SUBSECTION Standard>
GSWE_TYPE_ASPECT_INFO
gswe_aspect_info_get_type
</SECTION>
<SECTION>
<FILE>gswe-aspect-data</FILE>
GsweAspectData
gswe_aspect_data_new
gswe_aspect_data_new_with_planets
gswe_aspect_data_ref
gswe_aspect_data_unref
gswe_aspect_data_set_planet1
gswe_aspect_data_get_planet1
gswe_aspect_data_set_planet2
gswe_aspect_data_get_planet2
gswe_aspect_data_get_distance
gswe_aspect_data_get_aspect
gswe_aspect_data_get_aspect_info
gswe_aspect_data_get_difference
<SUBSECTION Standard>
GSWE_TYPE_ASPECT_DATA
gswe_aspect_data_get_type
</SECTION>
<SECTION>
<FILE>gswe-antiscion-axis-info</FILE>
GsweAntiscionAxisInfo
gswe_find_antiscion_axis_info_by_id
gswe_all_antiscion_axes
gswe_antiscion_axis_info_new
gswe_antiscion_axis_info_ref
gswe_antiscion_axis_info_unref
gswe_antiscion_axis_info_set_axis
gswe_antiscion_axis_info_get_axis
gswe_antiscion_axis_info_set_name
gswe_antiscion_axis_info_get_name
gswe_antiscion_axis_info_set_sign_offset
gswe_antiscion_axis_info_get_sign_offset
gswe_antiscion_axis_info_set_start_sign_info
gswe_antiscion_axis_info_get_start_sign_info
gswe_antiscion_axis_info_set_start_sign
gswe_antiscion_axis_info_get_start_sign
<SUBSECTION Standard>
GSWE_TYPE_ANTISCION_AXIS_INFO
gswe_antiscion_axis_info_get_type
</SECTION>
<SECTION>
<FILE>gswe-antiscion-data</FILE>
GsweAntiscionData
gswe_antiscion_data_new
gswe_antiscion_data_new_with_planets
gswe_antiscion_data_ref
gswe_antiscion_data_unref
gswe_antiscion_data_set_planet1
gswe_antiscion_data_get_planet1
gswe_antiscion_data_set_planet2
gswe_antiscion_data_get_planet2
gswe_antiscion_data_calculate
gswe_antiscion_data_get_axis
gswe_antiscion_data_get_antiscion_axis_info
gswe_antiscion_data_get_difference
<SUBSECTION Standard>
GSWE_TYPE_ANTISCION_DATA
gswe_antiscion_data_get_type
</SECTION>
<SECTION>
<FILE>gswe-house-system-info</FILE>
GsweHouseSystemInfo
gswe_find_house_system_info_by_id
gswe_all_house_systems
gswe_house_system_info_new
gswe_house_system_info_ref
gswe_house_system_info_unref
gswe_house_system_info_set_house_system
gswe_house_system_info_get_house_system
gswe_house_system_info_set_sweph_id
gswe_house_system_info_get_sweph_id
gswe_house_system_info_set_name
gswe_house_system_info_get_name
<SUBSECTION Standard>
GSWE_TYPE_HOUSE_SYSTEM_INFO
gswe_house_system_info_get_type
</SECTION>
<SECTION>
<FILE>gswe-house-data</FILE>
GsweHouseData
gswe_house_data_new
gswe_house_data_ref
gswe_house_data_unref
gswe_house_data_get_house
gswe_house_data_get_cusp_position
gswe_house_data_get_sign
gswe_house_data_get_sign_info
<SUBSECTION Standard>
GSWE_TYPE_HOUSE_DATA
gswe_house_data_get_type
</SECTION>
<SECTION>
<FILE>gswe-timestamp</FILE>
<TITLE>GsweTimestamp</TITLE>
GsweTimestamp
GsweTimestampClass
GsweTimestampValidityFlags
gswe_timestamp_new
gswe_timestamp_new_from_julian_day
gswe_timestamp_new_from_gregorian_full
gswe_timestamp_new_from_now_local
gswe_timestamp_set_gregorian_full
gswe_timestamp_set_instant_recalc
gswe_timestamp_get_instant_recalc
gswe_timestamp_set_gregorian_year
gswe_timestamp_get_gregorian_year
gswe_timestamp_set_gregorian_month
gswe_timestamp_get_gregorian_month
gswe_timestamp_set_gregorian_day
gswe_timestamp_get_gregorian_day
gswe_timestamp_set_gregorian_hour
gswe_timestamp_get_gregorian_hour
gswe_timestamp_set_gregorian_minute
gswe_timestamp_get_gregorian_minute
gswe_timestamp_set_gregorian_second
gswe_timestamp_get_gregorian_second
gswe_timestamp_set_gregorian_microsecond
gswe_timestamp_get_gregorian_microsecond
gswe_timestamp_set_gregorian_timezone
gswe_timestamp_get_gregorian_timezone
gswe_timestamp_set_now_local
gswe_timestamp_set_julian_day
gswe_timestamp_get_julian_day
gswe_timestamp_set_julian_day_et
gswe_timestamp_get_julian_day_et
gswe_timestamp_set_julian_day_ut
gswe_timestamp_get_julian_day_ut
gswe_timestamp_get_sidereal_time
<SUBSECTION Standard>
GSWE_IS_TIMESTAMP
GSWE_IS_TIMESTAMP_CLASS
GSWE_TIMESTAMP
GSWE_TIMESTAMP_CLASS
GSWE_TIMESTAMP_GET_CLASS
GSWE_TYPE_TIMESTAMP
GsweTimestampPrivate
gswe_timestamp_get_type
</SECTION>
<SECTION>
<FILE>gswe-types</FILE>
GswePlanet
GSWE_PLANET_LILITH
GSWE_PLANET_OFFSET_VIRTUAL_NODES
GSWE_PLANET_OFFSET_PLANETS
GSWE_PLANET_OFFSET_ASTEROIDS
GSWE_PLANET_OFFSET_CUSTOM
GsweZodiac
GsweAspect
GsweAntiscionAxis
GsweElement
GsweQuality
GsweHouseSystem
GsweMoonPhase
GsweCoordinates
<SUBSECTION Standard>
GSWE_TYPE_COORDINATES
gswe_coordinates_get_type
</SECTION>
<SECTION>
<FILE>swe-glib</FILE>
GsweError
gswe_error_quark
GSWE_ERROR
gswe_init
</SECTION>
<SECTION>
<FILE>gswe-version</FILE>
GSWE_MAJOR_VERSION
GSWE_MINOR_VERSION
GSWE_MICRO_VERSION
GSWE_CHECK_VERSION
gswe_check_version
</SECTION>

View File

@ -1 +0,0 @@
@SWE_GLIB_API_VERSION@

View File

@ -1,52 +0,0 @@
const GLib = imports.gi.GLib;
const Swe = imports.gi.SweGlib;
const Format = imports.format;
String.prototype.format = Format.format;
Swe.init();
var timestamp = new Swe.Timestamp();
timestamp.set_gregorian_full(1983, 3, 7, 11, 54, 45, 0, 1);
var moment = new Swe.Moment();
moment.add_all_planets();
moment.set_timestamp(timestamp);
moment.set_coordinates(19.03991, 47.49801, 280);
moment.set_house_system(Swe.HouseSystem.PLACIDUS);
var all_planets = moment.get_all_planets()
for (var i = 0; i < all_planets.length; i++) {
var planet = all_planets[i];
var position = planet.get_position();
var sign_position = position % 30;
var degree = Math.floor(sign_position);
var minute = Math.floor((sign_position - degree) * 60);
var second = Math.floor(((sign_position - degree) * 60 - minute) * 60)
print("%s: %.6f (%d°%d%d″ %s)".format(planet.get_planet_info().get_name(), position, degree, minute, second, planet.get_sign_info().get_name()));
}
var all_aspects = moment.get_all_aspects();
for (var i = 0; i < all_aspects.length; i++) {
var aspect = all_aspects[i];
if (aspect.get_aspect() != Swe.Aspect.NONE) {
var planet1 = aspect.get_planet1();
var planet2 = aspect.get_planet2();
print("%s in %s with %s (±%.2f%%)".format(planet1.get_planet_info().get_name(), aspect.get_aspect_info().get_name(), planet2.get_planet_info().get_name(), aspect.get_difference()));
}
}
var all_antiscia = moment.get_all_antiscia();
for (var i = 0; i < all_antiscia.length; i++) {
var antiscion = all_antiscia[i];
if (antiscion.get_axis() != Swe.AntiscionAxis.NONE) {
var planet1 = antiscion.get_planet1();
var planet2 = antiscion.get_planet2();
print("%s is antiscion of %s on axis %s (±%.2f%%)".format(planet1.get_planet_info().get_name(), planet2.get_planet_info().get_name(), antiscion.get_antiscion_axis_info().get_name(), antiscion.get_difference().toFixed(2)));
}
}

View File

@ -1,44 +0,0 @@
local lgi = require 'lgi'
local SweGlib = lgi.require('SweGlib', '2.0')
SweGlib.init()
local timestamp = SweGlib.Timestamp.new()
timestamp:set_gregorian_full(1983, 3, 7, 11, 54, 45, 0, 1)
local moment = SweGlib.Moment.new()
moment:set_timestamp(timestamp)
moment:set_timestamp(timestamp)
moment:set_coordinates(19.03990999, 47.49801000, 280)
moment:set_house_system(SweGlib.HouseSystem.PLACIDUS)
moment:add_all_planets()
local all_planets = moment:get_all_planets()
for _, planet in ipairs(all_planets) do
local position = planet:get_position()
local sign_position = math.fmod(position, 30)
local degree = math.floor(sign_position)
local minute = math.floor((sign_position - degree) * 60)
local second = math.floor(((sign_position - degree) * 60 - minute) * 60)
io.write(string.format("%s: %f (%d°%d%d″ %s)\n", planet:get_planet_info():get_name(), position, degree, minute, second, planet:get_sign_info():get_name()))
end
local all_aspects = moment:get_all_aspects()
for _, aspect in ipairs(all_aspects) do
if aspect:get_aspect() ~= "NONE" then
local planet1 = aspect:get_planet1()
local planet2 = aspect:get_planet2()
io.write(string.format("%s in %s with %s (±%.2f%%)\n", planet1:get_planet_info():get_name(), aspect:get_aspect_info():get_name(), planet2:get_planet_info():get_name(), aspect:get_difference()))
end
end
local all_antiscia = moment:get_all_antiscia()
for _, antiscion in ipairs(all_antiscia) do
if antiscion:get_axis() ~= "NONE" then
local planet1 = antiscion:get_planet1()
local planet2 = antiscion:get_planet2()
io.write(string.format("%s is antiscion of %s on axis %s (±%.2f%%)\n", planet1:get_planet_info():get_name(), planet2:get_planet_info():get_name(), antiscion:get_antiscion_axis_info():get_name(), antiscion:get_difference()))
end
end

View File

@ -1,55 +0,0 @@
#!/bin/env perl
package SweGlib;
use utf8;
use strict;
use POSIX;
use Glib::Object::Introspection;
binmode STDOUT, ':encoding(UTF-8)';
Glib::Object::Introspection->setup(basename => 'SweGlib', version => '2.0', package => 'SweGlib');
package main;
SweGlib::init();
my $timestamp = SweGlib::Timestamp->new();
$timestamp->set_gregorian_full(1983, 3, 7, 11, 54, 45, 0, 1);
my $moment = SweGlib::Moment->new();
$moment->set_timestamp($timestamp);
$moment->set_coordinates(19.03991, 47.49801, 280);
$moment->set_house_system("placidus");
$moment->add_all_planets();
my $all_planets = $moment->get_all_planets();
foreach my $planet (@{$all_planets}) {
my $position = $planet->get_position();
my $sign_position = POSIX::fmod($position, 30);
my $degree = POSIX::floor($sign_position);
my $minute = POSIX::floor(($sign_position - $degree) * 60);
my $second = POSIX::floor((($sign_position - $degree) * 60 - $minute) * 60);
printf("%s: %f (%d°%d%d″ %s)\n", $planet->get_planet_info()->get_name(), $position, $degree, $minute, $second, $planet->get_sign_info()->get_name());
}
my $all_aspects = $moment->get_all_aspects();
foreach my $aspect (@{$all_aspects}) {
if ($aspect->get_aspect() ne "none") {
my $planet1 = $aspect->get_planet1();
my $planet2 = $aspect->get_planet2();
printf("%s in %s with %s (±%.2f%%)\n", $planet1->get_planet_info()->get_name(), $aspect->get_aspect_info->get_name(), $planet2->get_planet_info()->get_name(), $aspect->get_difference());
}
}
my $all_antiscia = $moment->get_all_antiscia();
foreach my $antiscion (@{$all_antiscia}) {
if ($antiscion->get_axis() ne "none") {
my $planet1 = $antiscion->get_planet1();
my $planet2 = $antiscion->get_planet2();
printf("%s is antiscion of %s on axis %s (±%.2f%%)\n", $planet1->get_planet_info()->get_name(), $planet2->get_planet_info()->get_name(), $antiscion->get_antiscion_axis_info()->get_name(), $antiscion->get_difference());
}
}

View File

@ -1,44 +0,0 @@
# -*- coding: utf-8 -*-
from gi.repository import SweGlib
import math
import codecs
import sys
sys.stdout = codecs.getwriter('utf-8')(sys.stdout)
SweGlib.init()
timestamp = SweGlib.Timestamp()
timestamp.set_gregorian_full(1983, 3, 7, 11, 54, 45, 0, 1)
moment = SweGlib.Moment()
moment.set_timestamp(timestamp)
moment.set_coordinates(19.03991, 47.49801, 280)
moment.set_house_system(SweGlib.HouseSystem.PLACIDUS)
moment.add_all_planets()
all_planets = moment.get_all_planets()
for planet in all_planets:
position = planet.get_position()
sign_position = position % 30
degree = math.floor(sign_position)
minute = math.floor((sign_position - degree) * 60)
second = math.floor(((sign_position - degree) * 60 - minute) * 60)
print u"%s: %f (%d°%d%d%s)" % (planet.get_planet_info().get_name(), position, degree, minute, second, planet.get_sign_info().get_name())
all_aspects = moment.get_all_aspects()
for aspect in all_aspects:
if aspect.get_aspect() != SweGlib.Aspect.NONE:
planet1 = aspect.get_planet1()
planet2 = aspect.get_planet2()
print u"%s in %s with %s%.2f%%)" % (planet1.get_planet_info().get_name(), aspect.get_aspect_info().get_name(), planet2.get_planet_info().get_name(), aspect.get_difference())
all_antiscia = moment.get_all_antiscia()
for antiscion in all_antiscia:
if antiscion.get_axis() != SweGlib.AntiscionAxis.NONE:
planet1 = antiscion.get_planet1()
planet2 = antiscion.get_planet2()
print u"%s is antiscion of %s on axis %s%.2f%%)" % (planet1.get_planet_info().get_name(), planet2.get_planet_info().get_name(), antiscion.get_antiscion_axis_info().get_name(), antiscion.get_difference())

BIN
images/code.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
images/pattern.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
images/tar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
images/top.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
images/zip.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

184
index.html Normal file
View File

@ -0,0 +1,184 @@
<!doctype html>
<!-- The Time Machine GitHub pages theme was designed and developed by Jon Rohan, on Feb 7, 2012. -->
<!-- Follow him for fun. http://twitter.com/jonrohan. Tail his code on http://github.com/jonrohan -->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="stylesheet" href="stylesheets/stylesheet.css" media="screen"/>
<link rel="stylesheet" href="stylesheets/pygment_trac.css"/>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="javascripts/script.js"></script>
<title>SWE-GLib</title>
<meta name="description" content="A GLib style wrapper library around Swiss Ephemeris">
<meta name="viewport" content="width=device-width,initial-scale=1">
</head>
<body>
<div class="wrapper">
<header>
<h1 class="title">SWE-GLib</h1>
</header>
<div id="container">
<p class="tagline">A GLib style wrapper library around Swiss Ephemeris</p>
<div id="main" role="main">
<div class="download-bar">
<div class="inner">
<a href="https://github.com/gergelypolonkai/swe-glib/tarball/master" class="download-button tar"><span>Download</span></a>
<a href="https://github.com/gergelypolonkai/swe-glib/zipball/master" class="download-button zip"><span>Download</span></a>
<a href="https://github.com/gergelypolonkai/swe-glib" class="code">View SWE-GLib on GitHub</a>
</div>
<span class="blc"></span><span class="trc"></span>
</div>
<article class="markdown-body">
<h1>
<a name="swe-glib" class="anchor" href="#swe-glib"><span class="octicon octicon-link"></span></a>SWE-GLib</h1>
<p>SWE-GLib is a GLib style wrapper library around Astrodienst's <a href="http://www.astro.com/swisseph/">Swiss Ephemeris library</a>.</p>
<p>The source tree contains Astrodienst's ephemeride files, as requested by Alois Treindl of Astrodienst in a mail written to me on 24 July, 2013.</p>
<h2>
<a name="gtk-doc" class="anchor" href="#gtk-doc"><span class="octicon octicon-link"></span></a>GTK-Doc</h2>
<p>The project utilizes <a href="http://www.gtk.org/gtk-doc/">GTK-Doc</a>, requiring version 1.19 or later. Although the generated documentation is a bit messy (not everything is documented, and there are some unresolved variables, like [SERVER] on the generated index page.</p>
<p>Still, the documentation generates well, and at least gives a clue about object usage.</p>
<h2>
<a name="bindings" class="anchor" href="#bindings"><span class="octicon octicon-link"></span></a>Bindings</h2>
<p>SWE-GLib utilizes <a href="https://wiki.gnome.org/GObjectIntrospection">GObject Introspection</a>, which means it is available for many languages. Check out the <a href="examples">examples</a> directory for some sample code!</p>
<h2>
<a name="usage" class="anchor" href="#usage"><span class="octicon octicon-link"></span></a>Usage</h2>
<p>Many functions return non-opaque C structs; their documentation can be found inline, and in the generated GTK-Doc. Unless otherwise stated, the returned values should never be freed.</p>
<h3>
<a name="creating-the-required-objects" class="anchor" href="#creating-the-required-objects"><span class="octicon octicon-link"></span></a>Creating the required objects</h3>
<p>Then you need to create a <code>GsweTimestamp</code> object:</p>
<div class="highlight highlight-c"><pre><span class="n">GsweTimestamp</span> <span class="o">*</span><span class="n">timestamp</span> <span class="o">=</span> <span class="n">gswe_timestamp_new_from_gregorian_full</span><span class="p">(</span><span class="mi">1983</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">11</span><span class="p">,</span> <span class="mi">54</span><span class="p">,</span> <span class="mi">45</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mf">1.0</span><span class="p">);</span>
</pre></div>
<p>The <code>GsweTimetamp</code> object is used to convert dates between the Gregorian calendar dates and Julian Day values (not to be confused with Julian calendar dates).</p>
<p>Next, you have to create a <code>GsweMoment</code> object:</p>
<div class="highlight highlight-c"><pre><span class="n">GsweMoment</span> <span class="o">*</span><span class="n">moment</span> <span class="o">=</span> <span class="n">gswe_moment_new_full</span><span class="p">(</span><span class="n">timestamp</span><span class="p">,</span> <span class="mf">19.081599</span><span class="p">,</span> <span class="mf">47.462485</span><span class="p">,</span> <span class="mf">300.0</span><span class="p">,</span> <span class="n">GSWE_HOUSE_PLACIDUS</span><span class="p">);</span>
</pre></div>
<p>The <code>GsweMoment</code> object holds information of a given moment at a given place on earth. <code>gswe_moment_new_full()</code> requires a <code>GsweTimestamp</code> object, some geographical coordinates (in degrees) together with altitude above sea level (in meters), and a house system to use.</p>
<h3>
<a name="adding-planets" class="anchor" href="#adding-planets"><span class="octicon octicon-link"></span></a>Adding planets</h3>
<p>After that you have to add some planets you want to do calculations on.</p>
<div class="highlight highlight-c"><pre><span class="n">gswe_moment_add_planet</span><span class="p">(</span><span class="n">moment</span><span class="p">,</span> <span class="n">GSWE_PLANET_SUN</span><span class="p">);</span>
</pre></div>
<p>Alternatively, you can add every planets known by SWE-GLib with</p>
<div class="highlight highlight-c"><pre><span class="n">gswe_moment_add_all_planets</span><span class="p">(</span><span class="n">moment</span><span class="p">);</span>
</pre></div>
<h3>
<a name="getting-planet-positions-and-such" class="anchor" href="#getting-planet-positions-and-such"><span class="octicon octicon-link"></span></a>Getting planet positions and such</h3>
<p>Then, you can get the planet data with</p>
<div class="highlight highlight-c"><pre><span class="n">GswePlanetData</span> <span class="o">*</span><span class="n">sun_data</span> <span class="o">=</span> <span class="n">gswe_moment_get_planet</span><span class="p">(</span><span class="n">moment</span><span class="p">,</span> <span class="n">GSWE_PLANET_SUN</span><span class="p">);</span>
</pre></div>
<h3>
<a name="getting-aspects-and-antiscia" class="anchor" href="#getting-aspects-and-antiscia"><span class="octicon octicon-link"></span></a>Getting aspects and antiscia</h3>
<p>SWE-GLib is also able to calculate aspects and antiscia. This functionality does not exist in the Swiss Ephemeris library, though. For this, of course, you have to add multiple planets (at least two) to your <code>GsweMoment</code>. After that, you can call <code>gswe_moment_get_planet_aspects()</code> and <code>gswe_moment_get_planet_antiscia()</code>.</p>
<div class="highlight highlight-c"><pre><span class="n">GList</span> <span class="o">*</span><span class="n">sun_aspects</span> <span class="o">=</span> <span class="n">gswe_moment_get_planet_aspects</span><span class="p">(</span><span class="n">moment</span><span class="p">,</span> <span class="n">GSWE_PLANET_SUN</span><span class="p">);</span>
<span class="n">GList</span> <span class="o">*</span><span class="n">sun_antiscia</span> <span class="o">=</span> <span class="n">gswe_moment_get_planet_antiscia</span><span class="p">(</span><span class="n">moment</span><span class="p">,</span> <span class="n">GSWE_PLANET_SUN</span><span class="p">);</span>
</pre></div>
<p>The returned GList objects hold zero or more <code>GsweAspectData</code> or <code>GsweAntiscionData</code> objects, respectively.</p>
<h3>
<a name="getting-the-moon-phase" class="anchor" href="#getting-the-moon-phase"><span class="octicon octicon-link"></span></a>Getting the Moon phase</h3>
<p>Last, but not least, SWE-GLib can calculate Moon's phase at the given moment. For that, you have to call <code>gswe_moment_get_moon_phase()</code>:</p>
<div class="highlight highlight-c"><pre><span class="n">GsweMoonPhaseData</span> <span class="o">*</span><span class="n">moon_phase</span> <span class="o">=</span> <span class="n">gswe_moment_get_moon_phase</span><span class="p">(</span><span class="n">moment</span><span class="p">);</span>
</pre></div>
<h3>
<a name="about-altitude" class="anchor" href="#about-altitude"><span class="octicon octicon-link"></span></a>About altitude</h3>
<p>The Swiss Ephemeris library requires the altitude value to be specified for several calculations. It also notifies how important it is:</p>
<blockquote>
<p>the altitude above sea must be in meters. Neglecting the altitude can result in an error of about 2 arc seconds with the moon and at an altitude 3000m.</p>
</blockquote>
<p>2 arc seconds is about 0.000555 degrees of error, which is, well, kind of small. Of course, if you need very precise horoscopes or need planetary positions for a totally different thing, you should really provide a (close to) exact value; otherwise, it is safe to pass any value (well, which seems logical: the average level of all dry lands is about 840 meters; the average level of the whole planet Earth (including oceans and seas) is around 280 meters. Providing a value of ~400 should be OK most of the time).</p>
<h2>
<a name="api-stability" class="anchor" href="#api-stability"><span class="octicon octicon-link"></span></a>API stability</h2>
<p>The project is currently transitioning to 2.0. master is a bit fragile at the moment, 1.x versions are considered to be stable (although see commit 8f52aba about a huge typo-bug).</p>
<h2>
<a name="limitations" class="anchor" href="#limitations"><span class="octicon octicon-link"></span></a>Limitations</h2>
<h3>
<a name="topocentric-calculations-only" class="anchor" href="#topocentric-calculations-only"><span class="octicon octicon-link"></span></a>Topocentric calculations only</h3>
<p>Although the original Swiss Ephemeris library supports it, SWE-GLib can't do Heliocentric, nor Geocentric (as seen from the center of Earth) calculations, only Topocentric (as seen from a given point on Earth"s surface) calculations yet.</p>
<h3>
<a name="database-size" class="anchor" href="#database-size"><span class="octicon octicon-link"></span></a>Database size</h3>
<p>The size of all data files provided by Astrodienst is around 40MB. Although it should not be a problem with today's home hardware, it can be a hard requirement on embedded systems. For basic calculations, keeping the following files under $(datadir)/swe-glib is usually enough:</p>
<ul>
<li>seas_18.se1</li>
<li>semo_18.se1</li>
<li>sepl_18.se1</li>
</ul><h3>
<a name="fixed-stars-are-not-known-yet" class="anchor" href="#fixed-stars-are-not-known-yet"><span class="octicon octicon-link"></span></a>Fixed stars are not known yet</h3>
<p>Although Swiss Ephemeris has the functionality to calculate the position of fixed stars, SWE-GLib doesn't provide such functionality. This, however, is a planned feature for the close future.</p>
<h2>
<a name="licencing" class="anchor" href="#licencing"><span class="octicon octicon-link"></span></a>Licencing</h2>
<p>As the underlying Swiss Ephemeris is published under GPL (or a commercial license I can not afford), SWE-GLib is also uses that. This means that you can currently use SWE-GLib in software published under the GNU GPL v3.</p>
</article>
</div>
</div>
<footer>
<div class="owner">
<p><a href="https://github.com/gergelypolonkai" class="avatar"><img src="https://0.gravatar.com/avatar/586cd837b40cb957deed4942ba1850d5?d=https%3A%2F%2Fidenticons.github.com%2F8cecd48a0cc0a82daf4f56a9c2140d9b.png&amp;s=30" width="48" height="48"/></a> <a href="https://github.com/gergelypolonkai">gergelypolonkai</a> maintains <a href="https://github.com/gergelypolonkai/swe-glib">SWE-GLib</a></p>
</div>
<div class="creds">
<small>This page generated using <a href="https://pages.github.com/">GitHub Pages</a><br/>theme by <a href="https://twitter.com/jonrohan/">Jon Rohan</a></small>
</div>
</footer>
</div>
<div class="current-section">
<a href="#top">Scroll to top</a>
<a href="https://github.com/gergelypolonkai/swe-glib/tarball/master" class="tar">tar</a><a href="https://github.com/gergelypolonkai/swe-glib/zipball/master" class="zip">zip</a><a href="" class="code">source code</a>
<p class="name"></p>
</div>
</body>
</html>

52
javascripts/script.js Normal file
View File

@ -0,0 +1,52 @@
(function($) {
$(document).ready(function(){
// putting lines by the pre blocks
$("pre").each(function(){
var pre = $(this).text().split("\n");
var lines = new Array(pre.length+1);
for(var i = 0; i < pre.length; i++) {
var wrap = Math.floor(pre[i].split("").length / 70)
if (pre[i]==""&&i==pre.length-1) {
lines.splice(i, 1);
} else {
lines[i] = i+1;
for(var j = 0; j < wrap; j++) {
lines[i] += "\n";
}
}
}
$(this).before("<pre class='lines'>" + lines.join("\n") + "</pre>");
});
var headings = [];
var collectHeaders = function(){
headings.push({"top":$(this).offset().top - 15,"text":$(this).text()});
}
if($(".markdown-body h1").length > 1) $(".markdown-body h1").each(collectHeaders)
else if($(".markdown-body h2").length > 1) $(".markdown-body h2").each(collectHeaders)
else if($(".markdown-body h3").length > 1) $(".markdown-body h3").each(collectHeaders)
$(window).scroll(function(){
if(headings.length==0) return true;
var scrolltop = $(window).scrollTop() || 0;
if(headings[0] && scrolltop < headings[0].top) {
$(".current-section").css({"opacity":0,"visibility":"hidden"});
return false;
}
$(".current-section").css({"opacity":1,"visibility":"visible"});
for(var i in headings) {
if(scrolltop >= headings[i].top) {
$(".current-section .name").text(headings[i].text);
}
}
});
$(".current-section a").click(function(){
$(window).scrollTop(0);
return false;
})
});
})(jQuery)

1
params.json Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,2 +0,0 @@
# Please keep this list sorted alphabetically.
hu

View File

@ -1,53 +0,0 @@
# Makefile variables for PO directory in any package using GNU gettext.
# Usually the message domain is the same as the package name.
DOMAIN = $(PACKAGE)
# These two variables depend on the location of this directory.
subdir = po
top_builddir = ..
# These options get passed to xgettext.
XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
# This is the copyright holder that gets inserted into the header of the
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
# package. (Note that the msgstr strings, extracted from the package's
# sources, belong to the copyright holder of the package.) Translators are
# expected to transfer the copyright for their translations to this person
# or entity, or to disclaim their copyright. The empty string stands for
# the public domain; in this case the translators are expected to disclaim
# their copyright.
COPYRIGHT_HOLDER = Gergely POLONKAI
# This is the email address or URL to which the translators shall report
# bugs in the untranslated strings:
# - Strings which are not entire sentences, see the maintainer guidelines
# in the GNU gettext documentation, section 'Preparing Strings'.
# - Strings which use unclear terms or require additional context to be
# understood.
# - Strings which make invalid assumptions about notation of date, time or
# money.
# - Pluralisation problems.
# - Incorrect English spelling.
# - Incorrect formatting.
# It can be your email address, or a mailing list address where translators
# can write to without being subscribed, or the URL of a web page through
# which the translators can contact you.
MSGID_BUGS_ADDRESS = gergely@polonkai.eu
# This is the list of locale categories, beyond LC_MESSAGES, for which the
# message catalogs shall be used. It is usually empty.
EXTRA_LOCALE_CATEGORIES =
# This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
# context. Possible values are "yes" and "no". Set this to yes if the
# package uses functions taking also a message context, like pgettext(), or
# if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
USE_MSGCTXT = no
# These options get passed to msgmerge.
# Useful options are in particular:
# --previous to keep previous msgids of translated messages,
# --quiet to reduce the verbosity.
MSGMERGE_OPTIONS =

View File

@ -1,3 +0,0 @@
# List of source files containing translatable strings.
src/swe-glib.c

224
po/hu.po
View File

@ -1,224 +0,0 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2013 Gergely Polonkai
# This file is distributed under the same license as the SWE-GLib package.
# Gergely Polonkai <gergely@polonkai.eu>, 2013.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: SWE-GLib 1.0\n"
"Report-Msgid-Bugs-To: gergely@polonkai.eu\n"
"POT-Creation-Date: 2013-09-10 00:51+0200\n"
"PO-Revision-Date: 2013-09-10 00:55+0100\n"
"Last-Translator: Gergely Polonkai <gergely@polonkai.eu>\n"
"Language-Team: Hungarian <astrognome-hu@polonkai.eu>\n"
"Language: hu\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../src/swe-glib.c:116
msgid "Sun"
msgstr "Nap"
#: ../src/swe-glib.c:117
msgid "Moon"
msgstr "Hold"
#: ../src/swe-glib.c:118
msgid "Mercury"
msgstr "Merkúr"
#: ../src/swe-glib.c:119
msgid "Venus"
msgstr "Vénusz"
#: ../src/swe-glib.c:120
msgid "Mars"
msgstr "Mars"
#: ../src/swe-glib.c:121
msgid "Jupiter"
msgstr "Jupiter"
#: ../src/swe-glib.c:122
msgid "Saturn"
msgstr "Szaturnusz"
#: ../src/swe-glib.c:123
msgid "Uranus"
msgstr "Uránusz"
#: ../src/swe-glib.c:124
msgid "Neptune"
msgstr "Neptunusz"
#: ../src/swe-glib.c:125
msgid "Pluto"
msgstr "Plútó"
#: ../src/swe-glib.c:126
msgid "Chiron"
msgstr "Chiron"
#: ../src/swe-glib.c:127
msgid "Ceres"
msgstr "Ceresz"
#: ../src/swe-glib.c:128
msgid "Pallas"
msgstr "Pallasz"
#: ../src/swe-glib.c:129
msgid "Juno"
msgstr "Júnó"
#: ../src/swe-glib.c:130
msgid "Vesta"
msgstr "Veszta"
#: ../src/swe-glib.c:131
msgid "Ascending Moon Node"
msgstr "Felszálló Hold-csomópont"
#: ../src/swe-glib.c:132
msgid "Dark Moon"
msgstr "Sötét Hold"
#: ../src/swe-glib.c:133
msgid "Ascendant"
msgstr "Aszcendens"
#: ../src/swe-glib.c:134
msgid "Midheaven"
msgstr "MC"
#: ../src/swe-glib.c:135
msgid "Vertex"
msgstr "Vertex"
#: ../src/swe-glib.c:139
msgid "Aries"
msgstr "Kos"
#: ../src/swe-glib.c:140
msgid "Taurus"
msgstr "Bika"
#: ../src/swe-glib.c:141
msgid "Gemini"
msgstr "Ikrek"
#: ../src/swe-glib.c:142
msgid "Cancer"
msgstr "Rák"
#: ../src/swe-glib.c:143
msgid "Leo"
msgstr "Oroszlán"
#: ../src/swe-glib.c:144
msgid "Virgo"
msgstr "Szűz"
#: ../src/swe-glib.c:145
msgid "Libra"
msgstr "Mérleg"
#: ../src/swe-glib.c:146
msgid "Scorpio"
msgstr "Skorpió"
#: ../src/swe-glib.c:147
msgid "Sagittarius"
msgstr "Nyilas"
#: ../src/swe-glib.c:148
msgid "Capricorn"
msgstr "Bak"
#: ../src/swe-glib.c:149
msgid "Aquarius"
msgstr "Vízöntő"
#: ../src/swe-glib.c:150
msgid "Pisces"
msgstr "Halak"
#. Note that because all aspects must be <= 180°, GSWE_ASPECT_NONE can
#. never really exist. It is provided for name fetching purposes only.
#: ../src/swe-glib.c:154 ../src/swe-glib.c:163 ../src/swe-glib.c:178
msgid "None"
msgstr "Nincs"
#: ../src/swe-glib.c:155
msgid "Placidus"
msgstr "Placidus"
#: ../src/swe-glib.c:156
msgid "Koch"
msgstr "Koch"
#: ../src/swe-glib.c:157
msgid "Equal"
msgstr "Egyenlő"
#: ../src/swe-glib.c:164
msgid "Conjuction"
msgstr "Együtállás"
#: ../src/swe-glib.c:165
msgid "Opposition"
msgstr "Szembenállás"
#: ../src/swe-glib.c:166
msgid "Trine"
msgstr "Trigon"
#: ../src/swe-glib.c:167
msgid "Square"
msgstr "Kvadrát"
#: ../src/swe-glib.c:168
msgid "Sextile"
msgstr "Szextil"
#: ../src/swe-glib.c:169
msgid "Quincunx"
msgstr "Kvinkunx"
#: ../src/swe-glib.c:170
msgid "Semi-sextile"
msgstr "Fél-szextil"
#: ../src/swe-glib.c:171
msgid "Semi-square"
msgstr "Fél-kvadrát"
#: ../src/swe-glib.c:172
msgid "Sesqui-square"
msgstr "Másfél-kvadrát"
#: ../src/swe-glib.c:173
msgid "Quintile"
msgstr "Kvintil"
#: ../src/swe-glib.c:174
msgid "Bi-quintile"
msgstr "Bi-kvintil"
#: ../src/swe-glib.c:179
msgid "Aries/Libra"
msgstr "Kos/Mérleg"
#: ../src/swe-glib.c:180
msgid "mid Taurus/Scorpio"
msgstr "Bika/Skorpió közepe"
#: ../src/swe-glib.c:181
msgid "Cancer/Capricorn"
msgstr "Rák/Bak"
#: ../src/swe-glib.c:182
msgid "mid Leo/Aquarius"
msgstr "Oroszlán/Vízöntő közepe"

View File

@ -1,120 +0,0 @@
## Process this file with automake to produce Makefile.in
include $(top_srcdir)/swe-glib.mk
AM_CPPFLAGS = -DG_LOG_DOMAIN=\"SWE-GLib\" -DLOCALEDIR=\"$(localedir)\" -D__SWE_GLIB_BUILDING__ -DPKGDATADIR=\"$(pkgdatadir)\"
lib_LTLIBRARIES = libswe-glib-2.0.la
INST_H_SRC_FILES = \
swe-glib.h \
gswe-types.h \
gswe-moon-phase-data.h \
gswe-sign-info.h \
gswe-planet-info.h \
gswe-planet-data.h \
gswe-aspect-info.h \
gswe-aspect-data.h \
gswe-antiscion-axis-info.h \
gswe-antiscion-data.h \
gswe-house-system-info.h \
gswe-house-data.h \
gswe-moment.h \
gswe-timestamp.h \
$(NULL)
INST_H_BUILT_FILES = \
gswe-enumtypes.h \
gswe-version.h \
$(NULL)
PRIV_H_SRC_FILES = \
swe-glib-private.h \
gswe-moon-phase-data-private.h \
gswe-sign-info-private.h \
gswe-planet-info-private.h \
gswe-planet-data-private.h \
gswe-aspect-info-private.h \
gswe-aspect-data-private.h \
gswe-antiscion-axis-info-private.h \
gswe-antiscion-data-private.h \
gswe-house-system-info-private.h \
gswe-house-data-private.h \
$(NULL)
gswe_enum_headers = gswe-timestamp.h gswe-types.h
libswe_glib_2_0_la_SOURCES = \
swe-glib.c \
gswe-types.c \
gswe-moon-phase-data.c \
gswe-sign-info.c \
gswe-planet-info.c \
gswe-planet-data.c \
gswe-aspect-info.c \
gswe-aspect-data.c \
gswe-antiscion-axis-info.c \
gswe-antiscion-data.c \
gswe-house-system-info.c \
gswe-house-data.c \
gswe-moment.c \
gswe-timestamp.c \
gswe-enumtypes.c \
gswe-version.c \
$(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_DEPENDENCIES = \
$(NULL)
BUILT_SOURCES = gswe-enumtypes.c gswe-enumtypes.h
CLEANFILES = $(BUILT_SOURCES)
EXTRA_DIST = gswe-enumtypes.h.template gswe-enumtypes.c.template $(PRIV_H_SRC_FILES) $(INST_H_SRC_FILES)
gswe-enumtypes.h: $(gswe_enum_headers) gswe-enumtypes.h.template
$(GLIB_MKENUMS) --template $(filter %.template,$^) $(filter-out %.template,$^) > \
gswe-enumtypes.h.tmp && mv gswe-enumtypes.h.tmp gswe-enumtypes.h
gswe-enumtypes.c: $(gswe_enum_headers) gswe-enumtypes.h gswe-enumtypes.c.template
$(GLIB_MKENUMS) --template $(filter %.template,$^) $(filter-out %.template,$^) > \
gswe-enumtypes.c.tmp && mv gswe-enumtypes.c.tmp gswe-enumtypes.c
SweGlib-2.0.vapi: SweGlib-$(SWE_GLIB_API_VERSION).gir
$(AM_V_GEN)$(VAPIGEN) --library=SweGlib-2.0 SweGlib-2.0.gir
if HAVE_INTROSPECTION
include $(INTROSPECTION_MAKEFILE)
SweGlib-$(SWE_GLIB_API_VERSION).gir: libswe-glib-2.0.la
SweGlib_@SWE_GLIB_API_VERSION_U@_gir_FILES = $(INST_H_SRC_FILES) $(INST_H_BUILT_FILES) $(filter %.c,$(libswe_glib_2_0_la_SOURCES))
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
girdir = $(datadir)/gir-1.0
gir_DATA = SweGlib-$(SWE_GLIB_API_VERSION).gir
typelibsdir = $(libdir)/girepository-1.0
typelibs_DATA = SweGlib-$(SWE_GLIB_API_VERSION).typelib
headerdir = $(includedir)/swe-glib
header_DATA = \
$(INST_H_SRC_FILES) \
$(INST_H_BUILT_FILES) \
$(NULL)
CLEANFILES += $(gir_DATA) $(typelibs_DATA)
if HAVE_VAPIGEN
vapidir = $(datadir)/vala/vapi
vapi_DATA = SweGlib-$(SWE_GLIB_API_VERSION).vapi
endif
endif

View File

@ -1,46 +0,0 @@
/* gswe-antiscion-axis-info-private.h: Private parts of GsweAntiscionAxisInfo
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifdef __SWE_GLIB_BUILDING__
#ifndef __SWE_GLIB_GSWE_ANTISCION_AXIS_INFO_PRIVATE_H__
#define __SWE_GLIB_GSWE_ANTISCION_AXIS_INFO_PRIVATE_H__
#include "gswe-types.h"
#include "gswe-antiscion-axis-info.h"
struct _GsweAntiscionAxisInfo {
/* the identifier of this mirror's axis */
GsweAntiscionAxis axis;
/* represents the sign in whict the mirror axis starts */
GsweSignInfo *start_sign;
/* the name of the mirror */
gchar *name;
/* if TRUE, the axis runs through the middle of its starting sign */
gdouble sign_offset;
/* Reference counter */
guint refcount;
};
#endif /* __SWE_GLIB_GSWE_ANTISCION_AXIS_INFO_PRIVATE_H__ */
#else /* not defined __SWE_GLIB_BUILDING__ */
#error __FILE__ "Can not be included, unless building SWE-GLib"
#endif /* __SWE_GLIB_BUILDING__ */

View File

@ -1,290 +0,0 @@
/* gswe-antiscion-axis-info.c: Antiscion axis related information
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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 "swe-glib.h"
#include "swe-glib-private.h"
#include "gswe-antiscion-axis-info.h"
#include "gswe-antiscion-axis-info-private.h"
/**
* SECTION:gswe-antiscion-axis-info
* @short_description: a structure storing information about antiscion axes
* @title: GsweAntiscionAxisInfo
* @stability: Stable
* @include: swe-glib.h
*
* The #GsweAntiscionAxisInfo stores information about an antiscion axis.
*/
G_DEFINE_BOXED_TYPE(
GsweAntiscionAxisInfo,
gswe_antiscion_axis_info,
(GBoxedCopyFunc)gswe_antiscion_axis_info_ref,
(GBoxedFreeFunc)gswe_antiscion_axis_info_unref
);
static void
gswe_antiscion_axis_info_free(GsweAntiscionAxisInfo *antiscion_axis_info)
{
if (antiscion_axis_info->name) {
g_free(antiscion_axis_info->name);
}
if (antiscion_axis_info->start_sign != NULL) {
gswe_sign_info_unref(antiscion_axis_info->start_sign);
}
g_free(antiscion_axis_info);
}
/**
* gswe_antiscion_axis_info_new:
*
* Creates a new #GsweAntiscionAxisInfo object with reference count set to 1.
*
* Returns: (transfer full): a new #GsweAntiscionAxisInfo
*/
GsweAntiscionAxisInfo *
gswe_antiscion_axis_info_new(void)
{
GsweAntiscionAxisInfo *ret;
ret = g_new0(GsweAntiscionAxisInfo, 1);
ret->refcount = 1;
return ret;
}
/**
* gswe_antiscion_axis_info_ref:
* @antiscion_axis_info: (in): a #GsweAntiscionAxisInfo
*
* Increases reference count on @antiscion_axis_info.
*
* Returns: (transfer none): the same #GsweAntiscionAxisInfo
*/
GsweAntiscionAxisInfo *
gswe_antiscion_axis_info_ref(GsweAntiscionAxisInfo *antiscion_axis_info)
{
antiscion_axis_info->refcount++;
return antiscion_axis_info;
}
/**
* gswe_antiscion_axis_info_unref:
* @antiscion_axis_info: (in): a #GsweAntiscionAxisInfo
*
* Decreases reference count on @antiscion_axis_info. If reference count
* reaches zero, @antiscion_axis_info is freed.
*/
void
gswe_antiscion_axis_info_unref(GsweAntiscionAxisInfo *antiscion_axis_info)
{
if (--antiscion_axis_info->refcount == 0) {
gswe_antiscion_axis_info_free(antiscion_axis_info);
}
}
/**
* gswe_antiscion_axis_info_set_axis:
* @antiscion_axis_info: (in): a #GsweAntiscionAxisInfo
* @axis: the new axis
*
* Sets the axis ID.
*/
void
gswe_antiscion_axis_info_set_axis(
GsweAntiscionAxisInfo *antiscion_axis_info,
GsweAntiscionAxis axis)
{
antiscion_axis_info->axis = axis;
}
/**
* gswe_antiscion_axis_info_get_axis:
* @antiscion_axis_info: (in): a #GsweAntiscionAxisInfo
*
* Gets the axis ID.
*
* Returns: the axis this #GsweAntiscionAxisInfo represents
*/
GsweAntiscionAxis
gswe_antiscion_axis_info_get_axis(GsweAntiscionAxisInfo *antiscion_axis_info)
{
return antiscion_axis_info->axis;
}
/**
* gswe_antiscion_axis_info_set_start_sign_info:
* @antiscion_axis_info: (in): a #GsweAntiscionAxisInfo
* @sign_info: a #GsweSignInfo to set as the starting sign of
* @antiscion_axis_info
*
* Sets the starting sign of the axis.
*/
void
gswe_antiscion_axis_info_set_start_sign_info(
GsweAntiscionAxisInfo *antiscion_axis_info,
GsweSignInfo *sign_info)
{
if (antiscion_axis_info->start_sign != NULL) {
gswe_sign_info_unref(antiscion_axis_info->start_sign);
}
antiscion_axis_info->start_sign = gswe_sign_info_ref(sign_info);
}
/**
* gswe_antiscion_axis_info_get_start_sign_info:
* @antiscion_axis_info: (in): a #GsweAntiscionAxisInfo
*
* Gets the starting sign of the axis.
*
* Returns: (transfer none): the #GsweSignInfo of the sign in which this axis
* starts
*/
GsweSignInfo *
gswe_antiscion_axis_info_get_start_sign_info(
GsweAntiscionAxisInfo *antiscion_axis_info)
{
return antiscion_axis_info->start_sign;
}
/**
* gswe_antiscion_axis_info_set_start_sign:
* @antiscion_axis_info: (in): a #GsweAntiscionAxisInfo
* @sign: the new starting sign of @antiscion_axis_info
* @err: a #GError
*
* Sets the starting sign of the axis. Unlike
* gswe_antiscion_axis_info_set_start_sign(), this method searches through the
* registered signs for a #GsweSignInfo record, and sets that as the starting
* sign. @err is populated with GSWE_ERROR_UNKNOWN_SIGN if such record can not
* be found.
*/
void
gswe_antiscion_axis_info_set_start_sign(
GsweAntiscionAxisInfo *antiscion_axis_info,
GsweZodiac sign,
GError **err)
{
GsweSignInfo *sign_info;
if ((sign_info = g_hash_table_lookup(
gswe_sign_info_table,
GINT_TO_POINTER(sign)
)) == NULL) {
g_warning("Trying to fetch an unregistered sign");
g_set_error(
err,
GSWE_ERROR, GSWE_ERROR_UNKNOWN_SIGN,
"The requested sign is not registered"
);
return;
}
if (antiscion_axis_info->start_sign != NULL) {
gswe_sign_info_unref(antiscion_axis_info->start_sign);
}
antiscion_axis_info->start_sign = gswe_sign_info_ref(sign_info);
}
/**
* gswe_antiscion_axis_info_get_start_sign:
* @antiscion_axis_info: (in): a #GsweAntiscionAxisInfo
*
* Gets the starting sign of the axis.
*
* Returns: the corresponding sign ID
*/
GsweZodiac
gswe_antiscion_axis_info_get_start_sign(
GsweAntiscionAxisInfo *antiscion_axis_info)
{
if (antiscion_axis_info->start_sign) {
return antiscion_axis_info->start_sign->sign;
} else {
return GSWE_SIGN_NONE;
}
}
/**
* gswe_antiscion_axis_info_set_name:
* @antiscion_axis_info: (in): a #GsweAntiscionAxisInfo
* @name: the new name of the axis
*
* Sets the name of the axis
*/
void
gswe_antiscion_axis_info_set_name(
GsweAntiscionAxisInfo *antiscion_axis_info,
const gchar *name)
{
if (antiscion_axis_info->name != NULL) {
g_free(antiscion_axis_info->name);
}
antiscion_axis_info->name = g_strdup(name);
}
/**
* gswe_antiscion_axis_info_get_name:
* @antiscion_axis_info: (in): a #GsweAntiscionAxisInfo
*
* Gets the name of the axis.
*
* Returns: (transfer none): the name of the axis
*/
const gchar *
gswe_antiscion_axis_info_get_name(GsweAntiscionAxisInfo *antiscion_axis_info)
{
return antiscion_axis_info->name;
}
/**
* gswe_antiscion_axis_info_set_sign_offset:
* @antiscion_axis_info: (in): a #GsweAntiscionAxisInfo
* @sign_offset: the new sign offset, in degree
*
* Sets the offset at which the axis starts.
*/
void
gswe_antiscion_axis_info_set_sign_offset(
GsweAntiscionAxisInfo *antiscion_axis_info,
gdouble sign_offset)
{
antiscion_axis_info->sign_offset = sign_offset;
}
/**
* gswe_antiscion_axis_info_get_sign_offset:
* @antiscion_axis_info: (in): a #GsweAntiscionAxisInfo
*
* Gets the offset at which the axis starts.
*
* Returns: the offset, in degrees
*/
gdouble
gswe_antiscion_axis_info_get_sign_offset(
GsweAntiscionAxisInfo *antiscion_axis_info)
{
return antiscion_axis_info->sign_offset;
}

View File

@ -1,88 +0,0 @@
/* gswe-antiscion-axis-info.h: Antiscion axis related information
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __SWE_GLIB_GSWE_ANTISCION_AXIS_INFO_H__
#define __SWE_GLIB_GSWE_ANTISCION_AXIS_INFO_H__
#include <glib-object.h>
#include "gswe-types.h"
#include "gswe-sign-info.h"
G_BEGIN_DECLS
/**
* GsweAntiscionAxisInfo:
*
* <structname>GsweAntiscionAxisInfo</structname> is an opaque structure whose
* members cannot be accessed directly.
*
* Since: 1.1
*/
typedef struct _GsweAntiscionAxisInfo GsweAntiscionAxisInfo;
GType gswe_antiscion_axis_info_get_type(void);
#define GSWE_TYPE_ANTISCION_AXIS_INFO (gswe_antiscion_axis_info_get_type())
GsweAntiscionAxisInfo *gswe_antiscion_axis_info_new(void);
GsweAntiscionAxisInfo *gswe_antiscion_axis_info_ref(
GsweAntiscionAxisInfo *antiscion_axis_info);
void gswe_antiscion_axis_info_unref(
GsweAntiscionAxisInfo *antiscion_axis_info);
void gswe_antiscion_axis_info_set_axis(
GsweAntiscionAxisInfo *antiscion_axis_info,
GsweAntiscionAxis axis);
GsweAntiscionAxis gswe_antiscion_axis_info_get_axis(
GsweAntiscionAxisInfo *antiscion_axis_info);
void gswe_antiscion_axis_info_set_start_sign_info(
GsweAntiscionAxisInfo *antiscion_axis_info,
GsweSignInfo *sign_info);
GsweSignInfo *gswe_antiscion_axis_info_get_start_sign_info(
GsweAntiscionAxisInfo *antiscion_axis_info);
void gswe_antiscion_axis_info_set_start_sign(
GsweAntiscionAxisInfo *antiscion_axis_info,
GsweZodiac sign,
GError **err);
GsweZodiac gswe_antiscion_axis_info_get_start_sign(
GsweAntiscionAxisInfo *antiscion_axis_info);
void gswe_antiscion_axis_info_set_name(
GsweAntiscionAxisInfo *antiscion_axis_info,
const gchar *name);
const gchar *gswe_antiscion_axis_info_get_name(
GsweAntiscionAxisInfo *antiscion_axis_info);
void gswe_antiscion_axis_info_set_sign_offset(
GsweAntiscionAxisInfo *antiscion_axis_info,
gdouble sign_offset);
gdouble gswe_antiscion_axis_info_get_sign_offset(
GsweAntiscionAxisInfo *antiscion_axis_info);
G_END_DECLS
#endif /* __SWE_GLIB_GSWE_ANTISCION_AXIS_INFO_H__ */

View File

@ -1,48 +0,0 @@
/* gswe-antiscion-data-private.h: Private parts of GsweAntiscionData
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifdef __SWE_GLIB_BUILDING__
#ifndef __SWE_GLIB_GSWE_ANTISCION_DATA_PRIVATE_H__
#define __SWE_GLIB_GSWE_ANTISCION_DATA_PRIVATE_H__
#include "gswe-planet-data.h"
#include "gswe-antiscion-data.h"
struct _GsweAntiscionData {
/* the first planet in the antiscion */
GswePlanetData *planet1;
/* the second planet in the antiscion */
GswePlanetData *planet2;
/* the #GsweAntiscionAxisInfo structure associated with this antiscion */
GsweAntiscionAxisInfo *antiscion_axis_info;
/* the difference in degrees between an exact antiscion and this given
* antiscion */
gdouble difference;
/* reference count */
guint refcount;
};
#endif /* __SWE_GLIB_GSWE_ANTISCION_DATA_PRIVATE_H__ */
#else /* not defined __SWE_GLIB_BUILDING__ */
#error __FILE__ "Can not be included, unless building SWE-GLib"
#endif /* __SWE_GLIB_BUILDING__ */

View File

@ -1,425 +0,0 @@
/* gswe-antiscion-data.c: Antiscia related data
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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 <math.h>
#include <glib-object.h>
#include "swe-glib-private.h"
#include "swe-glib.h"
#include "gswe-antiscion-data.h"
#include "gswe-antiscion-data-private.h"
/**
* SECTION:gswe-antiscion-data
* @short_description: a structure representing a planet's position-related data
* @title: GsweAntiscionData
* @stability: Stable
* @include: swe-glib.h
* @see_also: #GsweAntiscionAxisInfo
*
* #GsweAntiscionData is a structure that represents an antiscion relationship
* between two planets, based on a specified axis.
*/
G_DEFINE_BOXED_TYPE(
GsweAntiscionData,
gswe_antiscion_data,
(GBoxedCopyFunc)gswe_antiscion_data_ref,
(GBoxedFreeFunc)gswe_antiscion_data_unref
);
static void
gswe_antiscion_data_free(GsweAntiscionData *antiscion_data)
{
if (antiscion_data->planet1) {
gswe_planet_data_unref(antiscion_data->planet1);
}
if (antiscion_data->planet2) {
gswe_planet_data_unref(antiscion_data->planet2);
}
if (antiscion_data->antiscion_axis_info) {
gswe_antiscion_axis_info_unref(antiscion_data->antiscion_axis_info);
}
g_free(antiscion_data);
}
/**
* gswe_antiscion_data_new:
*
* Creates a new #GsweAntiscionData object with reference count set to 1.
*
* Returns: (transfer full): a new #GsweAntiscionData object
*/
GsweAntiscionData *
gswe_antiscion_data_new(void)
{
GsweAntiscionData *ret;
ret = g_new0(GsweAntiscionData, 1);
ret->refcount = 1;
return ret;
}
/*
* find_antiscion:
* @axis_p: a pointer made with GINT_TO_POINTER(), holding the antiscion axis ID
* @antiscion_axis_info: a GsweAntiscionAxisInfo, which will be checked against
* @antiscion_data
* @antiscion_data: a GsweAntiscionData, whose planets' positions will be
* checked against @antiscion_axis_info
*
* This function is called internally by gswe_antiscion_data_calculate() to
* check if the two planets in @antiscion_data are antiscia of each other on
* the axis in @antiscion_axis_info
*/
static gboolean
find_antiscion(
gpointer axis_p,
GsweAntiscionAxisInfo *antiscion_axis_info,
GsweAntiscionData *antiscion_data)
{
GsweAntiscionAxis axis;
gdouble start_point,
axis_position,
planet_orb;
if ((axis = GPOINTER_TO_INT(axis_p)) == GSWE_ANTISCION_AXIS_NONE) {
return FALSE;
}
planet_orb = fmin(
antiscion_data->planet1->planet_info->orb,
antiscion_data->planet2->planet_info->orb
);
start_point = (antiscion_axis_info->start_sign->sign - 1) * 30.0;
start_point += antiscion_axis_info->sign_offset;
axis_position = 2 * start_point - antiscion_data->planet1->position;
if (axis_position < 0) {
axis_position += 360.0;
}
if ((antiscion_data->difference = fabs(
antiscion_data->planet2->position - axis_position
)) <= planet_orb) {
antiscion_data->antiscion_axis_info = antiscion_axis_info;
return TRUE;
} else {
antiscion_data->difference = 0.0;
}
return FALSE;
}
/**
* gswe_antiscion_data_calculate:
* @antiscion_data: a #GsweAntiscionData
*
* Calculates the antiscion between the planets set in @antiscion_data. Planets
* can be set either by calling gswe_antiscion_data_set_planet1() and
* gswe_antiscion_data_set_planet2(), or by creating the #GsweAntiscionData
* with gswe_antiscion_data_new_with_planets().
*
* <note><para>If the object is created by
* gswe_antiscion_data_new_with_planets(), or when both planets are set by
* calling gswe_antiscion_data_set_planet1() and
* gswe_antiscion_data_set_planet2(), the antiscion information is
* automatically calculated. However, when either planet's data changes, the
* antiscion data is not calculated automatically, so if you expect the planets
* to get a new position (e.g. the #GsweTimestamp changes in a #GsweMoment
* which holds the @antiscion_data, in which case the planet positions are
* automatically adjusted), this function should be called.</para></note>
*/
void
gswe_antiscion_data_calculate(GsweAntiscionData *antiscion_data)
{
if ((antiscion_data->antiscion_axis_info = g_hash_table_find(
gswe_antiscion_axis_info_table,
(GHRFunc)find_antiscion,
antiscion_data
)) == NULL) {
antiscion_data->antiscion_axis_info = gswe_antiscion_axis_info_ref(
g_hash_table_lookup(
gswe_antiscion_axis_info_table,
GINT_TO_POINTER(GSWE_ANTISCION_AXIS_NONE)
)
);
} else {
gswe_antiscion_axis_info_ref(antiscion_data->antiscion_axis_info);
}
}
/**
* gswe_antiscion_data_new_with_planets:
* @planet1: a #GswePlanetData
* @planet2: a #GswePlanetData
*
* Creates a new #GsweAntiscionData object with both planets initially set. The
* respective antiscion is instantly calculated.
*
* Returns: (transfer full): a new #GsweAntiscionData
*/
GsweAntiscionData *
gswe_antiscion_data_new_with_planets(
GswePlanetData *planet1,
GswePlanetData *planet2)
{
GsweAntiscionData *ret;
ret = gswe_antiscion_data_new();
ret->planet1 = gswe_planet_data_ref(planet1);
ret->planet2 = gswe_planet_data_ref(planet2);
gswe_antiscion_data_calculate(ret);
return ret;
}
/**
* gswe_antiscion_data_ref:
* @antiscion_data: (in): a #GsweAntiscionData
*
* Increases reference count on @antiscion_data.
*
* Returns: (transfer none): the same #GsweAntiscionData
*/
GsweAntiscionData *
gswe_antiscion_data_ref(GsweAntiscionData *antiscion_data)
{
antiscion_data->refcount++;
return antiscion_data;
}
/**
* gswe_antiscion_data_unref:
* @antiscion_data: (in): a #GsweAntiscionData
*
* Decreases reference count on @antiscion_data. If reference count reaches
* zero, @antiscion_data is freed.
*/
void
gswe_antiscion_data_unref(GsweAntiscionData *antiscion_data)
{
if (antiscion_data == NULL) {
return;
}
if (--antiscion_data->refcount == 0) {
gswe_antiscion_data_free(antiscion_data);
}
}
/**
* gswe_antiscion_data_set_planet1:
* @antiscion_data: (in): a #GsweAntiscionData
* @planet1: (in): a #GswePlanetData
*
* Sets @planet1 as the first planet of the antiscion.
*/
void
gswe_antiscion_data_set_planet1(
GsweAntiscionData *antiscion_data,
GswePlanetData *planet1)
{
if (antiscion_data->planet1) {
gswe_planet_data_unref(antiscion_data->planet1);
}
antiscion_data->planet1 = gswe_planet_data_ref(planet1);
}
/**
* gswe_antiscion_data_get_planet1:
* @antiscion_data: (in): a #GsweAntiscionData
*
* Gets the first in the antiscion relationship.
*
* Returns: (transfer none): The #GswePlanetData associated with the first
* planet.
*/
GswePlanetData *
gswe_antiscion_data_get_planet1(GsweAntiscionData *antiscion_data)
{
return antiscion_data->planet1;
}
/**
* gswe_antiscion_data_set_planet2:
* @antiscion_data: (in): a #GsweAntiscionData
* @planet2: (in): a #GswePlanetData
*
* Sets @planet2 as the second planet of the antiscion.
*/
void
gswe_antiscion_data_set_planet2(
GsweAntiscionData *antiscion_data,
GswePlanetData *planet2)
{
if (antiscion_data->planet2) {
gswe_planet_data_unref(antiscion_data->planet2);
}
antiscion_data->planet2 = gswe_planet_data_ref(planet2);
}
/**
* gswe_antiscion_data_get_planet2:
* @antiscion_data: (in): a #GsweAntiscionData
*
* Gets the second in the antiscion relationship.
*
* Returns: (transfer none): The #GswePlanetData associated with the second
* planet.
*/
GswePlanetData *
gswe_antiscion_data_get_planet2(GsweAntiscionData *antiscion_data)
{
return antiscion_data->planet2;
}
/**
* gswe_antiscion_data_set_axis:
* @antiscion_data: a #GsweAntiscionData
* @axis: the axis to set in @antiscion_data
* @err: a #GError
*
* Sets the antiscion axis, which must be known by SWE-GLib (e.g. by calling
* gswe_init()). @err is populated with GSWE_ERROR_UNKNOWN_ANTISCION_AXIS if
* the axis is not known.
*/
void
gswe_antiscion_data_set_axis(
GsweAntiscionData *antiscion_data,
GsweAntiscionAxis axis,
GError **err)
{
GsweAntiscionAxisInfo *antiscion_axis_info;
if ((antiscion_axis_info = g_hash_table_lookup(
gswe_antiscion_axis_info_table,
GINT_TO_POINTER(axis)
)) == NULL) {
g_set_error(
err,
GSWE_ERROR, GSWE_ERROR_UNKNOWN_ANTISCION_AXIS,
"Unknown antiscion axis"
);
return;
}
if (antiscion_data->antiscion_axis_info) {
gswe_antiscion_axis_info_unref(antiscion_data->antiscion_axis_info);
}
antiscion_data->antiscion_axis_info = gswe_antiscion_axis_info_ref(
antiscion_axis_info
);
}
/**
* gswe_antiscion_data_get_axis:
* @antiscion_data: (in): a #GsweAntiscionData
*
* Gets the axis on which the antiscion relationship exists.
*
* Returns: the axis ID
*/
GsweAntiscionAxis
gswe_antiscion_data_get_axis(GsweAntiscionData *antiscion_data)
{
if (antiscion_data->antiscion_axis_info) {
return antiscion_data->antiscion_axis_info->axis;
} else {
return GSWE_ANTISCION_AXIS_NONE;
}
}
/**
* gswe_antiscion_data_set_antiscion_axis_info:
* @antiscion_data: (in): a #GsweAntiscionData
* @antiscion_axis_info: (in): a #GsweAntiscionAxisInfo
*
* Sets @antiscion_axis_info as the axis of this #GsweAntiscionData.
*/
void
gswe_antiscion_data_set_antiscion_axis_info(
GsweAntiscionData *antiscion_data,
GsweAntiscionAxisInfo *antiscion_axis_info)
{
if (antiscion_data->antiscion_axis_info) {
gswe_antiscion_axis_info_unref(antiscion_data->antiscion_axis_info);
}
antiscion_data->antiscion_axis_info = gswe_antiscion_axis_info_ref(
antiscion_axis_info
);
}
/**
* gswe_antiscion_data_get_antiscion_axis_info:
* @antiscion_data: (in): a #GsweAntiscionData
*
* Gets the axis information related to the antiscion relationship's axis.
*
* Returns: (transfer none): the #GsweAntiscionAxisInfo associated with this
* axis
*/
GsweAntiscionAxisInfo *
gswe_antiscion_data_get_antiscion_axis_info(GsweAntiscionData *antiscion_data)
{
return antiscion_data->antiscion_axis_info;
}
/**
* gswe_antiscion_data_set_difference:
* @antiscion_data: a #GsweAntiscionData
* @difference: the difference from an exact antiscion, in degrees
*
* Sets the difference of this antiscion from an exact antiscion.
*/
void
gswe_antiscion_data_set_difference(
GsweAntiscionData *antiscion_data,
gdouble difference)
{
antiscion_data->difference = difference;
}
/**
* gswe_antiscion_data_get_difference:
* @antiscion_data: (in): a #GsweAntiscionData
*
* Gets the difference between an exact antiscion and this antiscion
* relationship.
*
* Returns: the difference, in degrees
*/
gdouble
gswe_antiscion_data_get_difference(GsweAntiscionData *antiscion_data)
{
return antiscion_data->difference;
}

View File

@ -1,78 +0,0 @@
/* gswe-antiscion-data.h: Antiscia related data
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __SWE_GLIB_GSWE_ANTISCION_DATA_H__
#define __SWE_GLIB_GSWE_ANTISCION_DATA_H__
#include <glib-object.h>
#include "gswe-planet-data.h"
#include "gswe-antiscion-axis-info.h"
G_BEGIN_DECLS
/**
* GsweAntiscionData:
*
* <structname>GsweAntiscionData</structname> is an opaque structure whose
* members cannot be accessed directly.
*
* Since: 1.1
*/
typedef struct _GsweAntiscionData GsweAntiscionData;
GType gswe_antiscion_data_get_type(void);
#define GSWE_TYPE_ANTISCION_DATA (gswe_antiscion_data_get_type())
GsweAntiscionData *gswe_antiscion_data_new(void);
GsweAntiscionData *gswe_antiscion_data_new_with_planets(
GswePlanetData *planet1,
GswePlanetData *planet2);
GsweAntiscionData *gswe_antiscion_data_ref(GsweAntiscionData *antiscion_data);
void gswe_antiscion_data_unref(GsweAntiscionData *antiscion_data);
void gswe_antiscion_data_calculate(GsweAntiscionData *antiscion_data);
void gswe_antiscion_data_set_planet1(
GsweAntiscionData *antiscion_data,
GswePlanetData *planet1);
GswePlanetData *gswe_antiscion_data_get_planet1(
GsweAntiscionData *antiscion_data);
void gswe_antiscion_data_set_planet2(
GsweAntiscionData *antiscion_data,
GswePlanetData *planet2);
GswePlanetData *gswe_antiscion_data_get_planet2(
GsweAntiscionData *antiscion_data);
GsweAntiscionAxis gswe_antiscion_data_get_axis(
GsweAntiscionData *antiscion_data);
GsweAntiscionAxisInfo *gswe_antiscion_data_get_antiscion_axis_info(
GsweAntiscionData *antiscion_data);
gdouble gswe_antiscion_data_get_difference(GsweAntiscionData *antiscion_data);
G_END_DECLS
#endif /* __SWE_GLIB_GSWE_ANTISCION_DATA_H__ */

View File

@ -1,51 +0,0 @@
/* gswe-aspect-data-private.h: Private parts of GsweAspectData
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifdef __SWE_GLIB_BUILDING__
#ifndef __SWE_GLIB_GSWE_ASPECT_DATA_PRIVATE_H__
#define __SWE_GLIB_GSWE_ASPECT_DATA_PRIVATE_H__
#include "gswe-aspect-data.h"
#include "gswe-planet-data.h"
struct _GsweAspectData {
/* the first planet in the aspect */
GswePlanetData *planet1;
/* the second planet in the aspect */
GswePlanetData *planet2;
/* the distance between the two planets, in degrees */
gdouble distance;
/* the #GsweAspectInfo structure associated with the aspect */
GsweAspectInfo *aspect_info;
/* the difference in percent between an exact aspect and this given
* aspect */
gdouble difference;
/* reference count */
guint refcount;
};
void gswe_aspect_data_calculate(GsweAspectData *aspect_data);
#endif /* __SWE_GLIB_GSWE_ASPECT_DATA_PRIVATE_H__ */
#else /* not defined __SWE_GLIB_BUILDING__ */
#error __FILE__ "Can not be included, unless building SWE-GLib"
#endif /* __SWE_GLIB_BUILDING__ */

View File

@ -1,350 +0,0 @@
/* gswe-aspect-data.c: Aspect related data
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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 <math.h>
#include <glib-object.h>
#include "swe-glib-private.h"
#include "swe-glib.h"
#include "gswe-planet-data-private.h"
#include "gswe-planet-info-private.h"
#include "gswe-aspect-info.h"
#include "gswe-aspect-info-private.h"
#include "gswe-aspect-data.h"
#include "gswe-aspect-data-private.h"
/**
* SECTION:gswe-aspect-data
* @short_description: a structure representing an aspect between two planets
* @title: GsweAspectData
* @stability: Stable
* @include: swe-glib.h
* @see_also: #GsweAspectInfo
*
* #GsweAspectData is a structure that represents two planets relation to each
* other, like their aspect and the aspect's difference from an exact aspect.
*/
G_DEFINE_BOXED_TYPE(
GsweAspectData,
gswe_aspect_data,
(GBoxedCopyFunc)gswe_aspect_data_ref,
(GBoxedFreeFunc)gswe_aspect_data_unref
);
static void
gswe_aspect_data_free(GsweAspectData *aspect_data)
{
if (aspect_data->planet1) {
gswe_planet_data_unref(aspect_data->planet1);
}
if (aspect_data->planet2) {
gswe_planet_data_unref(aspect_data->planet2);
}
if (aspect_data->aspect_info) {
gswe_aspect_info_unref(aspect_data->aspect_info);
}
g_free(aspect_data);
}
/*
* find_aspect:
* @aspect_p: a pointer made with GINT_TO_POINTER(), holding the aspect ID
* @aspect_info: a GsweAspectInfo, which will be checked against @aspect_data
* @aspect_data: a GsweAspectData, whose planets' positions will be checked
* against @aspect_info
*
* This function is called internally by gswe_aspect_data_calculate() to check
* if the two planets in @aspect_data are in aspect according to @aspect_info
*/
static gboolean
find_aspect(
gpointer aspect_p,
GsweAspectInfo *aspect_info,
GsweAspectData *aspect_data)
{
gdouble diff,
planet_orb,
aspect_orb;
diff = fabs(aspect_info->size - aspect_data->distance);
planet_orb = fmin(
aspect_data->planet1->planet_info->orb,
aspect_data->planet2->planet_info->orb
);
aspect_orb = fmax(1.0, planet_orb - aspect_info->orb_modifier);
if (diff < aspect_orb) {
aspect_data->aspect_info = gswe_aspect_info_ref(aspect_info);
if (aspect_info->size == 0) {
aspect_data->difference = (1 - ((360.0 - diff) / 360.0)) * 100.0;
} else {
aspect_data->difference = (1
- ((aspect_info->size - diff) / aspect_info->size)) * 100.0;
}
return TRUE;
}
return FALSE;
}
void
gswe_aspect_data_calculate(GsweAspectData *aspect_data)
{
if ((aspect_data->distance = fabs(
aspect_data->planet1->position
- aspect_data->planet2->position
)) > 180.0) {
aspect_data->distance = 360.0 - aspect_data->distance;
}
if ((aspect_data->aspect_info = g_hash_table_find(
gswe_aspect_info_table,
(GHRFunc)find_aspect, aspect_data
)) == NULL) {
aspect_data->aspect_info = gswe_aspect_info_ref(
g_hash_table_lookup(
gswe_aspect_info_table,
GINT_TO_POINTER(GSWE_ASPECT_NONE)
)
);
} else {
gswe_aspect_info_ref(aspect_data->aspect_info);
}
}
/**
* gswe_aspect_data_new:
*
* Creates a new #GsweAspectData with reference count set to 1.
*
* Returns: (transfer full): a new #GsweAspectData
*/
GsweAspectData *
gswe_aspect_data_new(void)
{
GsweAspectData *ret;
gswe_init();
ret = g_new0(GsweAspectData, 1);
ret->refcount = 1;
return ret;
}
/**
* gswe_aspect_data_new_with_planets:
* @planet1: (in): a #GswePlanetData
* @planet2: (in): a #GswePlanetData
*
* Creates a new #GsweAspectData with a reference count of 1, and both planets
* initially set. Also calculates the aspect between them.
*
* Returns: (transfer full): a new #GsweAspectData with all data set.
*/
GsweAspectData *
gswe_aspect_data_new_with_planets(
GswePlanetData *planet1,
GswePlanetData *planet2)
{
GsweAspectData *ret;
ret = gswe_aspect_data_new();
ret->planet1 = gswe_planet_data_ref(planet1);
ret->planet2 = gswe_planet_data_ref(planet2);
gswe_aspect_data_calculate(ret);
return ret;
}
/**
* gswe_aspect_data_ref:
* @aspect_data: a #GsweAspectData
*
* Increases reference count of @aspect_data.
*
* Returns: (transfer none): the same #GsweAspectData
*/
GsweAspectData *
gswe_aspect_data_ref(GsweAspectData *aspect_data)
{
aspect_data->refcount++;
return aspect_data;
}
/**
* gswe_aspect_data_unref:
* @aspect_data: (in): a #GsweAspectData
*
* Decreases reference count on @aspect_data. If reference count reaches zero,
* @aspect_data is freed.
*/
void
gswe_aspect_data_unref(GsweAspectData *aspect_data)
{
if (aspect_data == NULL) {
return;
}
if (--aspect_data->refcount == 0) {
gswe_aspect_data_free(aspect_data);
}
}
/**
* gswe_aspect_data_set_planet1:
* @aspect_data: (in): a #GsweAspectData
* @planet1: (in): a #GswePlanetData
*
* Sets @planet1 as the first planet of the aspect.
*/
void
gswe_aspect_data_set_planet1(
GsweAspectData *aspect_data,
GswePlanetData *planet1)
{
if (aspect_data->planet1) {
gswe_planet_data_unref(aspect_data->planet1);
}
aspect_data->planet1 = gswe_planet_data_ref(planet1);
if (planet1 && aspect_data->planet2) {
gswe_aspect_data_calculate(aspect_data);
}
}
/**
* gswe_aspect_data_get_planet1:
* @aspect_data: (in): a #GsweAspectData
*
* Gets the first planet in the aspect.
*
* Returns: (transfer none): The #GswePlanetData associated with the first
* planet
*/
GswePlanetData *
gswe_aspect_data_get_planet1(GsweAspectData *aspect_data)
{
return aspect_data->planet1;
}
/**
* gswe_aspect_data_set_planet2:
* @aspect_data: (in): a #GsweAspectData
* @planet2: (in): a #GswePlanetData
*
* Sets @planet2 as the second planet of the aspect.
*/
void
gswe_aspect_data_set_planet2(
GsweAspectData *aspect_data,
GswePlanetData *planet2)
{
if (aspect_data->planet2) {
gswe_planet_data_unref(aspect_data->planet2);
}
aspect_data->planet2 = gswe_planet_data_ref(planet2);
if (aspect_data->planet1 && planet2) {
gswe_aspect_data_calculate(aspect_data);
}
}
/**
* gswe_aspect_data_get_planet2:
* @aspect_data: (in): a #GsweAspectData
*
* Gets the second planet in the aspect.
*
* Returns: (transfer none): The #GswePlanetData associated with the second
* planet
*/
GswePlanetData *
gswe_aspect_data_get_planet2(GsweAspectData *aspect_data)
{
return aspect_data->planet2;
}
/**
* gswe_aspect_data_get_distance:
* @aspect_data: (in): a #GsweAspectData
*
* Gets the exact distance between the two planets in the aspect.
*
* Returns: the distance, in degrees
*/
gdouble
gswe_aspect_data_get_distance(GsweAspectData *aspect_data)
{
return aspect_data->distance;
}
/**
* gswe_aspect_data_get_aspect:
* @aspect_data: (in): a #GsweAspectData
*
* Gets the actual aspect between the two planets.
*
* Returns: the aspect ID
*/
GsweAspect
gswe_aspect_data_get_aspect(GsweAspectData *aspect_data)
{
if (aspect_data->aspect_info) {
return aspect_data->aspect_info->aspect;
} else {
return GSWE_ASPECT_NONE;
}
}
/**
* gswe_aspect_data_get_aspect_info:
* @aspect_data: (in): a #GsweAspectData
*
* Gets the the #GsweAspectInfo object for this aspect.
*
* Returns: (transfer none): a #GsweAspectInfo
*/
GsweAspectInfo *
gswe_aspect_data_get_aspect_info(GsweAspectData *aspect_data)
{
return aspect_data->aspect_info;
}
/**
* gswe_aspect_data_get_difference:
* @aspect_data: (in): a #GsweAspectData
*
* Gets the difference between an exact aspect and this one.
*
* Returns: the difference in percent.
*/
gdouble
gswe_aspect_data_get_difference(GsweAspectData *aspect_data)
{
return aspect_data->difference;
}

View File

@ -1,76 +0,0 @@
/* gswe-aspect-data.h: Aspect related data
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __SWE_GLIB_GSWE_ASPECT_DATA_H__
#define __SWE_GLIB_GSWE_ASPECT_DATA_H__
#include <glib-object.h>
#include "gswe-types.h"
#include "gswe-aspect-info.h"
#include "gswe-planet-data.h"
G_BEGIN_DECLS
/**
* GsweAspectData:
*
* <structname>GsweAspectData</structname> is an opaque structure whose members
* cannot be accessed directly.
*
* Since: 1.1
*/
typedef struct _GsweAspectData GsweAspectData;
GType gswe_aspect_data_get_type(void);
#define GSWE_TYPE_ASPECT_DATA (gswe_aspect_data_get_type())
GsweAspectData *gswe_aspect_data_new(void);
GsweAspectData *gswe_aspect_data_new_with_planets(
GswePlanetData *planet1,
GswePlanetData *planet2);
GsweAspectData *gswe_aspect_data_ref(GsweAspectData *aspect_data);
void gswe_aspect_data_unref(GsweAspectData *aspect_data);
void gswe_aspect_data_set_planet1(
GsweAspectData *aspect_data,
GswePlanetData *planet1);
GswePlanetData *gswe_aspect_data_get_planet1(GsweAspectData *aspect_data);
void gswe_aspect_data_set_planet2(
GsweAspectData *aspect_data,
GswePlanetData *planet2);
GswePlanetData *gswe_aspect_data_get_planet2(GsweAspectData *aspect_data);
gdouble gswe_aspect_data_get_distance(GsweAspectData *aspect_data);
GsweAspect gswe_aspect_data_get_aspect(GsweAspectData *aspect_data);
GsweAspectInfo *gswe_aspect_data_get_aspect_info(GsweAspectData *aspect_data);
gdouble gswe_aspect_data_get_difference(GsweAspectData *aspect_data);
G_END_DECLS
#endif /* __SWE_GLIB_GSWE_ASPECT_DATA_H__ */

View File

@ -1,53 +0,0 @@
/* gswe-aspect-info-private.h: Private parts of GsweAspectInfo
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifdef __SWE_GLIB_BUILDING__
#ifndef __SWE_GLIB_GSWE_ASPECT_INFO_PRIVATE_H__
#define __SWE_GLIB_GSWE_ASPECT_INFO_PRIVATE_H__
#include "gswe-types.h"
#include "gswe-aspect-info.h"
struct _GsweAspectInfo {
/* the identifier of this aspect */
GsweAspect aspect;
/* the name of the aspect */
gchar *name;
/* the size of the aspect, in degrees */
guint size;
/* the modifier of the orb (the maximum allowable difference from an exact
* orb) */
gdouble orb_modifier;
/* shows whether this aspect is harmonic or not */
gboolean harmonic;
/* shows whether this aspect is major (Ptolemaic) or not */
gboolean major;
/** reference count */
guint refcount;
};
#endif /* __SWE_GLIB_GSWE_ASPECT_INFO_PRIVATE_H__ */
#else /* not defined __SWE_GLIB_BUILDING__ */
#error __FILE__ "Can not be included, unless building SWE-GLib"
#endif /* __SWE_GLIB_BUILDING__ */

View File

@ -1,282 +0,0 @@
/* gswe-aspect-info.c: Aspect related information
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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 <glib-object.h>
#include "gswe-types.h"
#include "gswe-aspect-info.h"
#include "gswe-aspect-info-private.h"
/**
* SECTION:gswe-aspect-info
* @short_description: a structure storing information about an aspect
* @title: GsweAspectInfo
* @stability: Stable
* @include: swe-glib.h
*
* The #GsweAspectInfo stores information about an aspect.
*
* <warning><para>Using set_* type of funcions on an already registered
* #GsweAspectInfo can currently cause undocumented side effects, if a
* #GsweMoment is already instantiated. Currently, this covers all
* #GsweAspectInfo objects. In the future, registering custom aspects may be
* possible; until then, you should never use such functions.</para></warning>
*/
G_DEFINE_BOXED_TYPE(
GsweAspectInfo,
gswe_aspect_info,
(GBoxedCopyFunc)gswe_aspect_info_ref,
(GBoxedFreeFunc)gswe_aspect_info_unref
);
static void
gswe_aspect_info_free(GsweAspectInfo *aspect_info)
{
if (aspect_info->name) {
g_free(aspect_info->name);
}
g_free(aspect_info);
}
/**
* gswe_aspect_info_new:
*
* Creates a new #GsweAspectInfo with reference count set to 1.
*
* Returns: (transfer full): a new #GsweAspectInfo
*/
GsweAspectInfo *
gswe_aspect_info_new(void)
{
GsweAspectInfo *ret;
ret = g_new0(GsweAspectInfo, 1);
ret->refcount = 1;
return ret;
}
/**
* gswe_aspect_info_ref:
* @aspect_info: (in): a #GsweAspectInfo
*
* Increases reference count on @aspect_info by one.
*
* Returns: (transfer none): the same #GsweAspectInfo
*/
GsweAspectInfo *
gswe_aspect_info_ref(GsweAspectInfo *aspect_info)
{
aspect_info->refcount++;
return aspect_info;
}
/**
* gswe_aspect_info_unref:
* @aspect_info: (in): a #GsweAspectInfo
*
* Decreases reference count of @aspect_info by one. If reference count drops
* to zero, @aspect_info is freed.
*/
void
gswe_aspect_info_unref(GsweAspectInfo *aspect_info)
{
if (--aspect_info->refcount == 0) {
gswe_aspect_info_free(aspect_info);
}
}
/**
* gswe_aspect_info_set_aspect:
* @aspect_info: (in): a #GsweAspectInfo
* @aspect: the aspect to set in @aspect_info
*
* Sets @aspect_info to represenc @aspect.
*/
void
gswe_aspect_info_set_aspect(GsweAspectInfo *aspect_info, GsweAspect aspect)
{
aspect_info->aspect = aspect;
}
/**
* gswe_aspect_info_get_aspect:
* @aspect_info: (in): a #GsweAspectInfo
*
* Gets the aspect ID
*/
GsweAspect
gswe_aspect_info_get_aspect(GsweAspectInfo *aspect_info)
{
return aspect_info->aspect;
}
/**
* gswe_aspect_info_set_name:
* @aspect_info: (in): a #GsweAspectInfo
* @name: (in): the name to be set as @aspect_infos name
*
* Sets the name of @aspect_info to @name.
*/
void
gswe_aspect_info_set_name(GsweAspectInfo *aspect_info, const gchar *name)
{
if (aspect_info->name) {
g_free(aspect_info->name);
}
aspect_info->name = g_strdup(name);
}
/**
* gswe_aspect_info_get_name:
* @aspect_info: (in): a #GsweAspectInfo
*
* Gets the name of this aspect. If NLS is enabled, name is translated in
* gswe_init(), so if you switch locale in your program, it will remain in the
* old locale. The returned string should not be freed or modified. It remains
* valid until @aspect_info exists.
*
* Returns: (transfer none): the name of the aspect
*/
const gchar *
gswe_aspect_info_get_name(GsweAspectInfo *aspect_info)
{
return aspect_info->name;
}
/**
* gswe_aspect_info_set_size:
* @aspect_info: (in): a #GsweAspectInfo
* @size: the new size for @aspect_info, in degrees
*
* Sets the size of @aspect info.
*/
void
gswe_aspect_info_set_size(GsweAspectInfo *aspect_info, gdouble size)
{
aspect_info->size = size;
}
/**
* gswe_aspect_info_get_size:
* @aspect_info: (in): a #GsweAspectInfo
*
* Gets the size of the aspect.
*
* Returns: the size of the aspect, in degrees
*/
gdouble
gswe_aspect_info_get_size(GsweAspectInfo *aspect_info)
{
return aspect_info->size;
}
/**
* gswe_aspect_info_set_orb_modifier:
* @aspect_info: (in): a #GsweAspectInfo
* @orb_modifier: the new orb modifier of @aspect_info
*
* Sets the orb modifier for @aspect_info. The orb modifier is used in aspect
* calculation; if the difference between an exact aspect and the distance
* between two positions exceeds this limit, the aspect is not considered.
*/
void
gswe_aspect_info_set_orb_modifier(
GsweAspectInfo *aspect_info,
gdouble orb_modifier)
{
aspect_info->orb_modifier = orb_modifier;
}
/**
* gswe_aspect_info_get_orb_modifier:
* @aspect_info: (in): a #GsweAspectInfo
*
* Gets the orb modifier of this aspect. The orb modifier is subtracted from
* the planets' orb during aspect calculation.
*
* Returns: the orb modifier, in degrees
*/
gdouble
gswe_aspect_info_get_orb_modifier(GsweAspectInfo *aspect_info)
{
return aspect_info->orb_modifier;
}
/**
* gswe_aspect_info_set_harmonic:
* @aspect_info: (in): a #GsweAspectInfo
* @harmonic: TRUE, if @aspect_info should be considered harmonic; FALSE
* otherwise
*
* Sets the harmonic state of @aspect_info.
*/
void
gswe_aspect_info_set_harmonic(GsweAspectInfo *aspect_info, gboolean harmonic)
{
aspect_info->harmonic = harmonic;
}
/**
* gswe_aspect_info_get_harmonic:
* @aspect_info: (in): a #GsweAspectInfo
*
* Tells if this aspect is considered harmonic.
*
* Returns: TRUE if the aspect is harmonic; FALSE otherwise
*/
gboolean
gswe_aspect_info_get_harmonic(GsweAspectInfo *aspect_info)
{
return aspect_info->harmonic;
}
/**
* gswe_aspect_info_set_major:
* @aspect_info: (in): a #GsweAspectInfo
* @major: TRUE, if @aspect_info should be considered major (Ptolemaic); FALSE
* otherwise
*
* Sets the major state of @aspect_info.
*
* <note><para>As all Ptolemaic aspects are registered during gswe_init(), you
* should never set @major to TRUE on new aspects.</para></note>
*/
void
gswe_aspect_info_set_major(GsweAspectInfo *aspect_info, gboolean major)
{
aspect_info->major = major;
}
/**
* gswe_aspect_info_get_major:
* @aspect_info: (in): a #GsweAspectInfo
*
* Gets the significance of the aspect, e.g. if its Ptolemaic or note.
*
* Returns: TRUE if the aspect is a major (Ptolemaic) one; FALSE otherwise
*/
gboolean
gswe_aspect_info_get_major(GsweAspectInfo *aspect_info)
{
return aspect_info->major;
}

View File

@ -1,78 +0,0 @@
/* gswe-aspect-info.h: Aspect related information
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __SWE_GLIB_GSWE_ASPECT_INFO_H__
#define __SWE_GLIB_GSWE_ASPECT_INFO_H__
#include <glib-object.h>
#include "gswe-types.h"
G_BEGIN_DECLS
/**
* GsweAspectInfo:
*
* <structname>GsweAspectInfo</structname> is an opaque structure whose members
* cannot be accessed directly.
*
* Since: 1.1
*/
typedef struct _GsweAspectInfo GsweAspectInfo;
GType gswe_aspect_info_get_type(void);
#define GSWE_TYPE_ASPECT_INFO (gswe_aspect_info_get_type())
GsweAspectInfo *gswe_aspect_info_new(void);
GsweAspectInfo *gswe_aspect_info_ref(GsweAspectInfo *aspect_info);
void gswe_aspect_info_unref(GsweAspectInfo *aspect_info);
void gswe_aspect_info_set_aspect(
GsweAspectInfo *aspect_info,
GsweAspect aspect);
GsweAspect gswe_aspect_info_get_aspect(GsweAspectInfo *aspect_info);
void gswe_aspect_info_set_name(GsweAspectInfo *aspect_info, const gchar *name);
const gchar *gswe_aspect_info_get_name(GsweAspectInfo *aspect_info);
void gswe_aspect_info_set_size(GsweAspectInfo *aspect_info, gdouble size);
gdouble gswe_aspect_info_get_size(GsweAspectInfo *aspect_info);
void gswe_aspect_info_set_orb_modifier(
GsweAspectInfo *aspect_info,
gdouble orb_modifier);
gdouble gswe_aspect_info_get_orb_modifier(GsweAspectInfo *aspect_info);
void gswe_aspect_info_set_harmonic(
GsweAspectInfo *aspect_info,
gboolean harmonic);
gboolean gswe_aspect_info_get_harmonic(GsweAspectInfo *aspect_info);
void gswe_aspect_info_set_major(GsweAspectInfo *aspect_info, gboolean major);
gboolean gswe_aspect_info_get_major(GsweAspectInfo *aspect_info);
G_END_DECLS
#endif /* __SWE_GLIB_GSWE_ASPECT_INFO_H__ */

View File

@ -1,65 +0,0 @@
/*** BEGIN file-header ***/
/* gswe-enumtypes.c - Enumeration types for SWE-GLib
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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 "swe-glib.h"
#include "gswe-enumtypes.h"
/*** END file-header ***/
/*** BEGIN file-production ***/
#include "@filename@"
/* enumerations from "@filename@" */
/*** END file-production ***/
/*** BEGIN value-header ***/
GType
@enum_name@_get_type(void)
{
static volatile gsize g_define_type_id__volatile = 0;
gswe_init();
if (g_once_init_enter(&g_define_type_id__volatile)) {
static const G@Type@Value values[] = {
/*** END value-header ***/
/*** BEGIN value-production ***/
{
@VALUENAME@,
"@VALUENAME@",
"@valuenick@"
},
/*** END value-production ***/
/*** BEGIN value-tail ***/
{ 0, NULL, NULL }
};
GType g_define_type_id = g_@type@_register_static(
g_intern_static_string("@EnumName@"),
values
);
g_once_init_leave(&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
/*** END value-tail ***/

View File

@ -1,42 +0,0 @@
/*** BEGIN file-header ***/
/* gswe-enumtypes.h - Enumeration types for SWE-GLib
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GSWE_ENUM_TYPES_H__
#define __GSWE_ENUM_TYPES_H__
#include <glib-object.h>
/*** END file-header ***/
/*** BEGIN file-production ***/
/* enumerations from "@filename@" */
#include "@filename@"
/*** END file-production ***/
/*** BEGIN value-header ***/
GType @enum_name@_get_type(void);
#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type())
/*** END value-header ***/
/*** BEGIN file-tail ***/
#endif /* __GSWE_ENUM_TYPES_H__ */
/*** END file-tail ***/

View File

@ -1,44 +0,0 @@
/* gswe-house-data-private.h: Private parts of GsweHouseData
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifdef __SWE_GLIB_BUILDING__
#ifndef __SWE_GLIB_GSWE_HOUSE_DATA_PRIVATE_H__
#define __SWE_GLIB_GSWE_HOUSE_DATA_PRIVATE_H__
#include "gswe-house-data.h"
struct _GsweHouseData {
/* the number of the house (usually in the range [1;12]. Sometimes may be
* [1;36]) */
guint house;
/* the position of the house's cusp on the sky */
gdouble cusp_position;
/* the #GsweSignInfo structure associated with the sign in which the house
* cusp is in */
GsweSignInfo *sign_info;
/* reference count */
guint refcount;
};
#endif /* __SWE_GLIB_GSWE_HOUSE_DATA_PRIVATE_H__ */
#else /* not defined __SWE_GLIB_BUILDING__ */
#error __FILE__ "Can not be included, unless building SWE-GLib"
#endif /* __SWE_GLIB_BUILDING__ */

View File

@ -1,165 +0,0 @@
/* gswe-house-data.c: House related data
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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 "gswe-types.h"
#include "swe-glib-private.h"
#include "swe-glib.h"
#include "gswe-house-data.h"
#include "gswe-house-data-private.h"
/**
* SECTION:gswe-house-data
* @short_description: a structure representing a house's position-related data
* @title: GsweHouseData
* @stability: Stable
* @include: swe-glib.h
* @see_also: #GsweHouseSystemInfo
*
* #GsweHouseData is a structure that represents a house's position.
*/
G_DEFINE_BOXED_TYPE(
GsweHouseData,
gswe_house_data,
(GBoxedCopyFunc)gswe_house_data_ref,
(GBoxedFreeFunc)gswe_house_data_unref
);
static void
gswe_house_data_free(GsweHouseData *house_data)
{
if (house_data->sign_info) {
gswe_sign_info_unref(house_data->sign_info);
}
g_free(house_data);
}
/**
* gswe_house_data_new:
*
* Creates a new #GsweHouseData with reference count set to 1.
*
* Returns: (transfer full): a new #GsweHouseData
*/
GsweHouseData *
gswe_house_data_new(void)
{
GsweHouseData *ret;
ret = g_new0(GsweHouseData, 1);
ret->refcount = 1;
return ret;
}
/**
* gswe_house_data_ref:
* @house_data: a #GsweHouseData
*
* Increases reference count on @house_data by one.
*
* Returns: (transfer none): the same #GsweHouseData
*/
GsweHouseData *
gswe_house_data_ref(GsweHouseData *house_data)
{
house_data->refcount++;
return house_data;
}
/**
* gswe_house_data_unref:
* @house_data: a #GsweHouseData
*
* Decreases reference count on @house_data by one. If reference count drops to
* zero, @house_data is freed.
*/
void
gswe_house_data_unref(GsweHouseData *house_data)
{
if (house_data == NULL) {
return;
}
if (--house_data->refcount == 0) {
gswe_house_data_free(house_data);
}
}
/**
* gswe_house_data_get_house:
* @house_data: (in): a #GsweHouseData
*
* Gets the number of the house.
*
* Returns: the house number
*/
guint
gswe_house_data_get_house(GsweHouseData *house_data)
{
return house_data->house;
}
/**
* gswe_house_data_get_cusp_position:
* @house_data: (in): a #GsweHouseData
*
* Gets the position of the house's cusp.
*
* Returns: the cusp position, in degrees
*/
gdouble
gswe_house_data_get_cusp_position(GsweHouseData *house_data)
{
return house_data->cusp_position;
}
/**
* gswe_house_data_get_sign:
* @house_data: a #GsweHouseData
*
* Gets the sign which the house's cusp is in.
*
* Returns: the GsweZodiac of the house cusp's sign
*/
GsweZodiac
gswe_house_data_get_sign(GsweHouseData *house_data)
{
if (house_data->sign_info) {
return house_data->sign_info->sign;
} else {
return GSWE_SIGN_NONE;
}
}
/**
* gswe_house_data_get_sign_info:
* @house_data: (in): a #GsweHouseData
*
* Gets the #GsweSignInfo that represents the sign which the house's cusp is in.
*
* Returns: (transfer none): a #GsweSignInfo representing the sign
*/
GsweSignInfo *
gswe_house_data_get_sign_info(GsweHouseData *house_data)
{
return house_data->sign_info;
}

View File

@ -1,53 +0,0 @@
/* gswe-house-data.h: House related data
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __SWE_GLIB_GSWE_HOUSE_DATA_H__
#define __SWE_GLIB_GSWE_HOUSE_DATA_H__
#include <glib-object.h>
#include "gswe-sign-info.h"
G_BEGIN_DECLS
/**
* GsweHouseData:
*
* <structname>GsweHouseData</structname> is an opaque structure whose members
* cannot be accessed directly.
*
* Since: 1.1
*/
typedef struct _GsweHouseData GsweHouseData;
GType gswe_house_data_get_type(void);
#define GSWE_TYPE_HOUSE_DATA (gswe_house_data_get_type())
GsweHouseData *gswe_house_data_new(void);
GsweHouseData *gswe_house_data_ref(GsweHouseData *house_data);
void gswe_house_data_unref(GsweHouseData *house_data);
guint gswe_house_data_get_house(GsweHouseData *house_data);
gdouble gswe_house_data_get_cusp_position(GsweHouseData *house_data);
GsweZodiac gswe_house_data_get_sign(GsweHouseData *house_data);
GsweSignInfo *gswe_house_data_get_sign_info(GsweHouseData *house_data);
G_END_DECLS
#endif /* __SWE_GLIB_GSWE_HOUSE_DATA_H__ */

View File

@ -1,45 +0,0 @@
/* gswe-house-system-info-private.h: Private parts of GsweHouseSystemInfo
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifdef __SWE_GLIB_BUILDING__
#ifndef __SWE_GLIB_GSWE_HOUSE_SYSTEM_INFO_PRIVATE_H__
#define __SWE_GLIB_GSWE_HOUSE_SYSTEM_INFO_PRIVATE_H__
#include "gswe-types.h"
#include "gswe-house-system-info.h"
struct _GsweHouseSystemInfo {
/* the house system's ID */
GsweHouseSystem house_system;
/* the character value that represents this house system in the Swiss
* Ephemeris library */
gchar sweph_id;
/* the name of this house system */
gchar *name;
/* reference count */
guint refcount;
};
#endif /* __SWE_GLIB_GSWE_HOUSE_SYSTEM_INFO_PRIVATE_H__ */
#else /* not defined __SWE_GLIB_BUILDING__ */
#error __FILE__ "Can not be included, unless building SWE-GLib"
#endif /* __SWE_GLIB_BUILDING__ */

View File

@ -1,189 +0,0 @@
/* gswe-house-system-info.c: House system information
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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 "gswe-types.h"
#include "gswe-house-system-info.h"
#include "gswe-house-system-info-private.h"
/**
* SECTION:gswe-house-system-info
* @short_description: a structure storing information about a house system
* @title: GsweHouseSystemInfo
* @stability: Stable
* @include: swe-glib.h
*
* #GsweHouseSystemInfo stores information of a house system.
*/
G_DEFINE_BOXED_TYPE(
GsweHouseSystemInfo,
gswe_house_system_info,
(GBoxedCopyFunc)gswe_house_system_info_ref,
(GBoxedFreeFunc)gswe_house_system_info_unref
);
static void
gswe_house_system_info_free(GsweHouseSystemInfo *house_system_info)
{
if (house_system_info->name) {
g_free(house_system_info->name);
}
g_free(house_system_info);
}
/**
* gswe_house_system_info_new:
*
* Creates a new #GsweHouseSystemInfo with reference count of 1.
*
* Returns: (transfer full): a new #GsweHouseSystemInfo
*/
GsweHouseSystemInfo *
gswe_house_system_info_new(void)
{
GsweHouseSystemInfo *ret;
ret = g_new0(GsweHouseSystemInfo, 1);
ret->refcount = 1;
return ret;
}
/**
* gswe_house_system_info_ref:
* @house_system_info: (in): a #GsweHouseSystemInfo
*
* Increases reference count on @house_system_info by one.
*
* Returns: (transfer none): the same #GsweHouseSystemInfo
*/
GsweHouseSystemInfo *
gswe_house_system_info_ref(GsweHouseSystemInfo *house_system_info)
{
house_system_info->refcount++;
return house_system_info;
}
/**
* gswe_house_system_info_unref:
* @house_system_info: a #GsweHouseSystemInfo
*
* Decreases reference count on @house_system_info by one. If reference count
* drops to zero, @house_system_info is freed.
*/
void
gswe_house_system_info_unref(GsweHouseSystemInfo *house_system_info)
{
if (--house_system_info->refcount == 0) {
gswe_house_system_info_free(house_system_info);
}
}
/**
* gswe_house_system_info_set_house_system:
* @house_system_info: (in): a #GsweHouseSystemInfo
* @house_system: a #GsweHouseSystem
*
* Sets up @house_system_info to represent @house_system.
*/
void
gswe_house_system_info_set_house_system(
GsweHouseSystemInfo *house_system_info,
GsweHouseSystem house_system)
{
house_system_info->house_system = house_system;
}
/**
* gswe_house_system_info_get_house_system:
* @house_system_info: (in): a #GsweHouseSystemInfo
*
* Gets the house system ID this #GsweHouseSystemInfo represents.
*
* Returns: the house system ID
*/
GsweHouseSystem
gswe_house_system_info_get_house_system(GsweHouseSystemInfo *house_system_info)
{
return house_system_info->house_system;
}
/**
* gswe_house_system_info_set_sweph_id:
* @house_system_info: a #GsweHouseSystemInfo
* @sweph_id: a character recognized by Swiss Ephemeris as a house system
*
* Sets up @house_system_info to represent the Swiss Ephemeris house system
* marked by @sweph_id.
*/
void
gswe_house_system_info_set_sweph_id(
GsweHouseSystemInfo *house_system_info,
gchar sweph_id)
{
house_system_info->sweph_id = sweph_id;
}
/**
* gswe_house_system_info_get_sweph_id:
* @house_system_info: (in): a #GsweHouseSystemInfo
*
* Gets the Swiss Ephemeris ID for the house system.
*
* Returns: the character representing this house system in Swiss Ephemeris
*/
gchar
gswe_house_system_info_get_sweph_id(GsweHouseSystemInfo *house_system_info)
{
return house_system_info->sweph_id;
}
/**
* gswe_house_system_info_set_name:
* @house_system_info: a #GsweHouseSystemInfo
* @name: the new name for this house system
*
* Sets the name of @house_system_info.
*/
void
gswe_house_system_info_set_name(
GsweHouseSystemInfo *house_system_info,
const gchar *name)
{
if (house_system_info->name) {
g_free(house_system_info->name);
}
house_system_info->name = g_strdup(name);
}
/**
* gswe_house_system_info_get_name:
* @house_system_info: (in): a #GsweHouseSystemInfo
*
* Gets the name of the house system.
*
* Returns: (transfer none): the name of the house system
*/
const gchar *
gswe_house_system_info_get_name(GsweHouseSystemInfo *house_system_info)
{
return house_system_info->name;
}

View File

@ -1,71 +0,0 @@
/* gswe-house-system-info.h: House system information
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __SWE_GLIB_GSWE_HOUSE_SYSTEM_INFO_H__
#define __SWE_GLIB_GSWE_HOUSE_SYSTEM_INFO_H__
#include <glib-object.h>
#include "gswe-types.h"
G_BEGIN_DECLS
/**
* GsweHouseSystemInfo:
*
* <structname>GsweHouseSystemInfo</structname> is an opaque structure whose
* members cannot be accessed directly.
*
* Since: 1.1
*/
typedef struct _GsweHouseSystemInfo GsweHouseSystemInfo;
GType gswe_house_system_info_get_type(void);
#define GSWE_TYPE_HOUSE_SYSTEM_INFO (gswe_house_system_info_get_type())
GsweHouseSystemInfo *gswe_house_system_info_new(void);
GsweHouseSystemInfo *gswe_house_system_info_ref(
GsweHouseSystemInfo *house_system_info);
void gswe_house_system_info_unref(GsweHouseSystemInfo *house_system_info);
void gswe_house_system_info_set_house_system(
GsweHouseSystemInfo *house_system_info,
GsweHouseSystem house_system);
GsweHouseSystem gswe_house_system_info_get_house_system(
GsweHouseSystemInfo *house_system_info);
void gswe_house_system_info_set_sweph_id(
GsweHouseSystemInfo *house_system_info,
gchar sweph_id);
gchar gswe_house_system_info_get_sweph_id(
GsweHouseSystemInfo *house_system_info);
void gswe_house_system_info_set_name(
GsweHouseSystemInfo *house_system_info,
const gchar *name);
const gchar *gswe_house_system_info_get_name(
GsweHouseSystemInfo *house_system_info);
G_END_DECLS
#endif /* __SWE_GLIB_GSWE_HOUSE_SYSTEM_INFO_H__ */

File diff suppressed because it is too large Load Diff

View File

@ -1,199 +0,0 @@
/* gswe-moment.h - Planetary moment object for SWE-GLib
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GSWE_MOMENT_H__
#define __GSWE_MOMENT_H__
#include <glib-object.h>
#include "gswe-timestamp.h"
#include "gswe-moon-phase-data.h"
#include "gswe-planet-data.h"
#include "gswe-types.h"
#define GSWE_TYPE_MOMENT (gswe_moment_get_type())
#define GSWE_MOMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST( \
(obj), \
GSWE_TYPE_MOMENT, \
GsweMoment))
#define GSWE_IS_MOMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE( \
(obj), \
GSWE_TYPE_MOMENT))
#define GSWE_MOMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST( \
(klass), \
GSWE_TYPE_MOMENT, \
GsweMomentClass))
#define GSWE_IS_MOMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE( \
(klass), \
GSWE_TYPE_MOMENT))
#define GSWE_MOMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS( \
(obj), \
GSWE_TYPE_MOMENT, \
GsweMomentClass))
typedef struct _GsweMoment GsweMoment;
typedef struct _GsweMomentClass GsweMomentClass;
typedef struct _GsweMomentPrivate GsweMomentPrivate;
/**
* GsweMoment:
*
* The GsweMoment object's instance definition.
*/
struct _GsweMoment {
/* Parent instance structure */
GObject parent_instance;
/* Instance members */
/*< private >*/
GsweMomentPrivate *priv;
};
/**
* GsweMomentClass:
* @parent_class: the parent class (#GObjectClass)
*
* The GsweMoment object's class definition.
*/
struct _GsweMomentClass {
/* Parent class structure */
GObjectClass parent_class;
/*< private >*/
/* Padding for future expansion */
void (*_swe_glib_reserved1)(void);
void (*_swe_glib_reserved2)(void);
void (*_swe_glib_reserved3)(void);
void (*_swe_glib_reserved4)(void);
void (*_swe_glib_reserved5)(void);
void (*_swe_glib_reserved6)(void);
void (*_swe_glib_reserved7)(void);
void (*_swe_glib_reserved8)(void);
void (*_swe_glib_reserved9)(void);
void (*_swe_glib_reserved10)(void);
void (*_swe_glib_reserved11)(void);
void (*_swe_glib_reserved12)(void);
void (*_swe_glib_reserved13)(void);
void (*_swe_glib_reserved14)(void);
void (*_swe_glib_reserved15)(void);
void (*_swe_glib_reserved16)(void);
void (*_swe_glib_reserved17)(void);
void (*_swe_glib_reserved18)(void);
void (*_swe_glib_reserved19)(void);
void (*_swe_glib_reserved20)(void);
};
/* used by GSWE_TYPE_MOMENT */
GType gswe_moment_get_type(void);
/* Method definitions */
GsweMoment *gswe_moment_new(void);
GsweMoment *gswe_moment_new_full(
GsweTimestamp *timestamp,
gdouble longitude,
gdouble latitude,
gdouble altitude,
GsweHouseSystem house_system);
void gswe_moment_set_timestamp(GsweMoment *moment, GsweTimestamp *timestamp);
GsweTimestamp *gswe_moment_get_timestamp(GsweMoment *moment);
void gswe_moment_set_coordinates(
GsweMoment *moment,
gdouble longitude,
gdouble latitude,
gdouble altitude);
GsweCoordinates *gswe_moment_get_coordinates(GsweMoment *moment);
void gswe_moment_set_house_system(
GsweMoment *moment,
GsweHouseSystem house_system);
GsweHouseSystem gswe_moment_get_house_system(GsweMoment *moment);
GList *gswe_moment_get_house_cusps(GsweMoment *moment, GError **err);
gint gswe_moment_get_house(GsweMoment *moment, gdouble position, GError **err);
gboolean gswe_moment_has_planet(GsweMoment *moment, GswePlanet planet);
void gswe_moment_add_planet(
GsweMoment *moment,
GswePlanet planet,
GError **err);
void gswe_moment_add_all_planets(GsweMoment *moment);
GList *gswe_moment_get_all_planets(GsweMoment *moment);
GswePlanetData *gswe_moment_get_planet(
GsweMoment *moment,
GswePlanet planet,
GError **err);
GList *gswe_moment_get_sign_planets(GsweMoment *moment, GsweZodiac sign);
GList *gswe_moment_get_house_planets(GsweMoment *moment, guint house);
guint gswe_moment_get_element_points(GsweMoment *moment, GsweElement element);
guint gswe_moment_get_quality_points(GsweMoment *moment, GsweQuality quality);
GsweMoonPhaseData *gswe_moment_get_moon_phase(GsweMoment *moment, GError **err);
GList *gswe_moment_get_all_aspects(GsweMoment *moment);
GList *gswe_moment_get_planet_aspects(
GsweMoment *moment,
GswePlanet planet,
GError **err);
GsweAspectData *gswe_moment_get_aspect_by_planets(
GsweMoment *moment,
GswePlanet planet1,
GswePlanet planet2,
GError **err);
GList *gswe_moment_get_all_antiscia(GsweMoment *moment);
GList *gswe_moment_get_all_planet_antiscia(
GsweMoment *moment,
GswePlanet planet,
GError **err);
GList *gswe_moment_get_axis_all_antiscia(
GsweMoment *moment,
GsweAntiscionAxis axis);
GList *gswe_moment_get_axis_planet_antiscia(
GsweMoment *moment,
GsweAntiscionAxis axis,
GswePlanet planet,
GError **err);
GsweAntiscionData *gswe_moment_get_antiscion_by_planets(
GsweMoment *moment,
GswePlanet planet1,
GswePlanet planet2,
GError **err);
#endif /* __GSWE_MOMENT_H__ */

View File

@ -1,40 +0,0 @@
/* gswe-moon-phase-data-private.h: Private parts of GsweMoonPhaseData
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifdef __SWE_GLIB_BUILDING__
#ifndef __SWE_GLIB_GSWE_MOON_PHASE_DATA_PRIVATE_H__
#define __SWE_GLIB_GSWE_MOON_PHASE_DATA_PRIVATE_H__
#include "gswe-moon-phase-data.h"
#include "gswe-types.h"
struct _GsweMoonPhaseData {
/* the actual phase of the Moon */
GsweMoonPhase phase;
/* the illumination percentage of the Moon */
gdouble illumination;
/* reference count */
guint refcount;
};
#endif /* __SWE_GLIB_GSWE_MOON_PHASE_DATA_PRIVATE_H__ */
#else /* not defined __SWE_GLIB_BUILDING__ */
#error __FILE__ "Can not be included, unless building SWE-GLib"
#endif /* __SWE_GLIB_BUILDING__ */

View File

@ -1,206 +0,0 @@
/* gswe-moon-phase-data.c: Moon phase representation
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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 <math.h>
#include "gswe-types.h"
#include "swe-glib-private.h"
#include "gswe-moon-phase-data.h"
#include "gswe-moon-phase-data-private.h"
#include "gswe-timestamp.h"
#define SYNODIC 29.53058867
/**
* SECTION:gswe-moon-phase-data
* @short_description: a structure representing the phase of the Moon
* @title: GsweMoonPhaseData
* @stability: Stable
* @include: swe-glib.h
* @see_also: #GsweMoonPhase
*
* #GsweMoonPhaseData is a structure that represents the actual phase of the
* Moon, including its illumination percentage.
*/
G_DEFINE_BOXED_TYPE(
GsweMoonPhaseData,
gswe_moon_phase_data,
(GBoxedCopyFunc)gswe_moon_phase_data_ref,
(GBoxedFreeFunc)gswe_moon_phase_data_unref);
/**
* gswe_moon_phase_data_new:
*
* Creates a new #GsweMoonPhaseData object with reference count set to 1.
*
* Returns: (transfer full): a new #GsweMoonPhaseData object
*/
GsweMoonPhaseData *
gswe_moon_phase_data_new(void)
{
GsweMoonPhaseData *ret;
ret = g_new0(GsweMoonPhaseData, 1);
ret->refcount = 1;
return ret;
}
/**
* gswe_moon_phase_data_ref:
* @moon_phase_data: (in): a #GsweMoonPhaseData
*
* Increases reference count on @moon_phase_data by one.
*
* Returns: (transfer none): the same #GsweMoonPhaseData
*/
GsweMoonPhaseData *
gswe_moon_phase_data_ref(GsweMoonPhaseData *moon_phase_data)
{
moon_phase_data->refcount++;
return moon_phase_data;
}
/**
* gswe_moon_phase_data_unref:
* @moon_phase_data: (in): a #GsweMoonPhaseData
*
* Decreases reference count on @moon_phase_data by one. If reference count
* drops to zero, @moon_phase_data is freed.
*/
void
gswe_moon_phase_data_unref(GsweMoonPhaseData *moon_phase_data)
{
if (moon_phase_data == NULL) {
return;
}
if (--moon_phase_data->refcount == 0) {
g_free(moon_phase_data);
}
}
/**
* gswe_moon_phase_data_calculate_by_jd:
* @moon_phase_data: a #GsweMoonPhaseData
* @jd: a Julian Day number, with hours as fractions
* @err: a #GError
*
* Calculates the moon at a given time, specified by @jd.
*/
void
gswe_moon_phase_data_calculate_by_jd(
GsweMoonPhaseData *moon_phase_data,
gdouble jd,
GError **err)
{
gdouble jdb,
phase_percent;
jdb = gswe_timestamp_get_julian_day_et(gswe_full_moon_base_date, err);
if ((err) && (*err)) {
return;
}
if ((phase_percent = fmod(((jd - jdb) * 100) / SYNODIC, 100)) < 0) {
phase_percent += 100.0;
}
if ((phase_percent < 0) || (phase_percent > 100)) {
g_error("Error during Moon phase calculation!");
}
moon_phase_data->illumination = (50.0 - fabs(phase_percent - 50.0)) * 2;
if (phase_percent == 0) {
moon_phase_data->phase = GSWE_MOON_PHASE_NEW;
} else if (phase_percent < 25) {
moon_phase_data->phase = GSWE_MOON_PHASE_WAXING_CRESCENT;
} else if (phase_percent == 25) {
moon_phase_data->phase = GSWE_MOON_PHASE_WAXING_HALF;
} else if (phase_percent < 50) {
moon_phase_data->phase = GSWE_MOON_PHASE_WAXING_GIBBOUS;
} else if (phase_percent == 50) {
moon_phase_data->phase = GSWE_MOON_PHASE_FULL;
} else if (phase_percent < 75) {
moon_phase_data->phase = GSWE_MOON_PHASE_WANING_GIBBOUS;
} else if (phase_percent == 75) {
moon_phase_data->phase = GSWE_MOON_PHASE_WANING_HALF;
} else if (phase_percent < 100) {
moon_phase_data->phase = GSWE_MOON_PHASE_WANING_CRESCENT;
} else {
moon_phase_data->phase = GSWE_MOON_PHASE_DARK;
}
}
/**
* gswe_moon_phase_data_calculate_by_timestamp:
* @moon_phase_data: a #GsweMoonPhaseData
* @timestamp: a #GsweTimestamp with a valid timestamp set
* @err: a #GError
*
* Calculates the moon at a given time, specified by @timestamp.
*/
void
gswe_moon_phase_data_calculate_by_timestamp(
GsweMoonPhaseData *moon_phase_data,
GsweTimestamp *timestamp,
GError **err)
{
gdouble jd;
jd = gswe_timestamp_get_julian_day_et(timestamp, err);
if (err && *err) {
return;
}
gswe_moon_phase_data_calculate_by_jd(moon_phase_data, jd, err);
}
/**
* gswe_moon_phase_data_get_phase:
* @moon_phase_data: (in): a GsweMoonPhaseData
*
* Gets the phase of the Moon in the given GsweMoonPhaseData.
*
* Returns: the Moon phase
*/
GsweMoonPhase
gswe_moon_phase_data_get_phase(GsweMoonPhaseData *moon_phase_data)
{
return moon_phase_data->phase;
}
/**
* gswe_moon_phase_data_get_illumination:
* @moon_phase_data: (in): a GsweMoonPhaseData
*
* Gets the illumination percentage from the given GsweMoonPhaseData.
*
* Returns: the illumination percentage
*/
gdouble
gswe_moon_phase_data_get_illumination(GsweMoonPhaseData *moon_phase_data)
{
return moon_phase_data->illumination;
}

View File

@ -1,66 +0,0 @@
/* gswe-moon-phase-data.h: Moon phase representation
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __SWE_GLIB_GSWE_MOON_PHASE_DATA_H__
#define __SWE_GLIB_GSWE_MOON_PHASE_DATA_H__
#include <glib-object.h>
#include "gswe-types.h"
#include "gswe-timestamp.h"
G_BEGIN_DECLS
/**
* GsweMoonPhaseData:
*
* <structname>GsweMoonPhaseData</structname> is an opaque structure whose
* members cannot be accessed directly.
*
* Since: 1.1
*/
typedef struct _GsweMoonPhaseData GsweMoonPhaseData;
GsweMoonPhaseData *gswe_moon_phase_data_new(void);
GsweMoonPhaseData *gswe_moon_phase_data_ref(GsweMoonPhaseData *moon_phase_data);
void gswe_moon_phase_data_unref(GsweMoonPhaseData *moon_phase_data);
void gswe_moon_phase_data_calculate_by_jd(
GsweMoonPhaseData *moon_phase_data,
gdouble jd,
GError **err);
void gswe_moon_phase_data_calculate_by_timestamp(
GsweMoonPhaseData *moon_phase_data,
GsweTimestamp *timestamp,
GError **err);
GsweMoonPhase gswe_moon_phase_data_get_phase(
GsweMoonPhaseData *moon_phase_data);
gdouble gswe_moon_phase_data_get_illumination(
GsweMoonPhaseData *moon_phase_data);
GType gswe_moon_phase_data_get_type(void);
#define GSWE_TYPE_MOON_PHASE_DATA (gswe_moon_phase_data_get_type())
G_END_DECLS
#endif /* __SWE_GLIB_GSWE_MOON_PHASE_DATA_H__ */

View File

@ -1,53 +0,0 @@
/* gswe-planet-data-private.h: Private parts of GswePlanetData
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifdef __SWE_GLIB_BUILDING__
#ifndef __SWE_GLIB_GSWE_PLANET_DATA_PRIVATE_H__
#define __SWE_GLIB_GSWE_PLANET_DATA_PRIVATE_H__
#include "gswe-planet-data.h"
#include "gswe-planet-info.h"
struct _GswePlanetData {
/* A GswePlanetInfo structure, holding every information about the planet */
GswePlanetInfo *planet_info;
/* The longitude position of the planet */
gdouble position;
/* TRUE if the planet is in retrograde motion */
gboolean retrograde;
/* Number of the house in which the planet is in */
gint house;
/* A GsweSignInfo structure, holding every information about the sign the
* planet is in */
GsweSignInfo *sign_info;
/* An internal version number of the calculation */
guint revision;
/* reference count */
guint refcount;
};
#endif /* __SWE_GLIB_GSWE_PLANET_DATA_PRIVATE_H__ */
#else /* not defined __SWE_GLIB_BUILDING__ */
#error __FILE__ "Can not be included, unless building SWE-GLib"
#endif /* __SWE_GLIB_BUILDING__ */

View File

@ -1,306 +0,0 @@
/* gswe-planet-data.c: Planetary positions
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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 "gswe-types.h"
#include "swe-glib-private.h"
#include "swe-glib.h"
#include "gswe-planet-data.h"
#include "gswe-planet-data-private.h"
/**
* SECTION:gswe-planet-data
* @short_description: a structure representing a planet's position-related data
* @title: GswePlanetData
* @stability: Stable
* @include: swe-glib.h
* @see_also: #GswePlanetInfo
*
* #GswePlanetData is a structure that represents a planet's position-related
* data, like its actual position on the sky or the house and sign the planet
* is in.
*/
G_DEFINE_BOXED_TYPE(
GswePlanetData,
gswe_planet_data,
(GBoxedCopyFunc)gswe_planet_data_ref,
(GBoxedFreeFunc)gswe_planet_data_unref);
static void
gswe_planet_data_free(GswePlanetData *planet_data)
{
if (planet_data->planet_info) {
gswe_planet_info_unref(planet_data->planet_info);
}
if (planet_data->sign_info) {
gswe_sign_info_unref(planet_data->sign_info);
}
g_free(planet_data);
}
/**
* gswe_planet_data_new:
*
* Creates a new #GswePlanetData object with reference count set to 1.
*
* Returns: (transfer full): a new #GswePlanetData
*/
GswePlanetData *
gswe_planet_data_new(void)
{
GswePlanetData *ret;
ret = g_new0(GswePlanetData, 1);
ret->refcount = 1;
return ret;
}
/**
* gswe_planet_data_ref:
* @planet_data: a #GswePlanetData
*
* Increases reference count on @planet_data by one.
*
* Returns: (transfer none): the same #GswePlanetData
*/
GswePlanetData *
gswe_planet_data_ref(GswePlanetData *planet_data)
{
planet_data->refcount++;
return planet_data;
}
/**
* gswe_planet_data_unref:
* @planet_data: a #GswePlanetData
*
* Decreases reference count on @planet_data by one. If reference count drops
* to zero, @planet_data is freed.
*/
void
gswe_planet_data_unref(GswePlanetData *planet_data)
{
if (planet_data == NULL) {
return;
}
if (--planet_data->refcount == 0) {
gswe_planet_data_free(planet_data);
}
}
/**
* gswe_planet_data_set_planet:
* @planet_data: (in): a #GswePlanetData
* @planet: the planet to add
* @err: a #GError
*
* Sets @planet as the planet ID of @planet_data. @planet must be registered
* via gswe_init(); otherwise, @err is populated with
* GSWE_ERROR_UNKNOWN_PLANET, and the planet ID is not set.
*/
void
gswe_planet_data_set_planet(
GswePlanetData *planet_data,
GswePlanet planet,
GError **err)
{
GswePlanetInfo *planet_info;
if ((planet_info = g_hash_table_lookup(
gswe_planet_info_table,
GINT_TO_POINTER(planet)
)) == NULL) {
g_set_error(err,
GSWE_ERROR, GSWE_ERROR_UNKNOWN_PLANET,
"Planet is unknown"
);
return;
}
if (planet_data->planet_info) {
gswe_planet_info_unref(planet_data->planet_info);
}
planet_data->planet_info = gswe_planet_info_ref(planet_info);
}
/**
* gswe_planet_data_get_planet:
* @planet_data: (in): a #GswePlanetData
*
* Gets the planet ID for this #GswePlanetData.
*
* Returns: the planet ID
*/
GswePlanet
gswe_planet_data_get_planet(GswePlanetData *planet_data)
{
if (planet_data == NULL) {
return GSWE_PLANET_NONE;
}
if (planet_data->planet_info) {
return planet_data->planet_info->planet;
} else {
return GSWE_PLANET_NONE;
}
}
/**
* gswe_planet_data_set_planet_info:
* @planet_data: a #GswePlanetData
* @planet_info: a #GswePlanetInfo
*
* Sets @planet_info as the planet information for @planet_data.
*/
void
gswe_planet_data_set_planet_info(
GswePlanetData *planet_data,
GswePlanetInfo *planet_info)
{
if (planet_data == NULL) {
return;
}
if (planet_data->planet_info) {
gswe_planet_info_unref(planet_data->planet_info);
}
planet_data->planet_info = gswe_planet_info_ref(planet_info);
}
/**
* gswe_planet_data_get_planet_info:
* @planet_data: (in): a #GswePlanetData
*
* Gets the planet info related to this #GswePlanetData.
*
* Returns: (transfer none): the #GswePlanetInfo associated with this planet
*/
GswePlanetInfo *
gswe_planet_data_get_planet_info(GswePlanetData *planet_data)
{
if (planet_data == NULL) {
return NULL;
}
return planet_data->planet_info;
}
/**
* gswe_planet_data_get_position:
* @planet_data: (in): a #GswePlanetData
*
* Gets the position of the planet on the sky.
*
* Returns: the position, in degrees
*/
gdouble
gswe_planet_data_get_position(GswePlanetData *planet_data)
{
if (planet_data == NULL) {
return 0.0;
}
return planet_data->position;
}
/**
* gswe_planet_data_get_retrograde:
* @planet_data: (in): a #GswePlanetData
*
* Returns the planet's retrograde status, e.g. if it looks like it moves
* backwards on the sky.
*
* Returns: TRUE, if the planet is in retrograde motion; FALSE otherwise
*/
gboolean
gswe_planet_data_get_retrograde(GswePlanetData *planet_data)
{
if (planet_data == NULL) {
return FALSE;
}
return planet_data->retrograde;
}
/**
* gswe_planet_data_get_house:
* @planet_data: (in): a #GswePlanetData
*
* Gets the house number which the planet is in.
*
* Returns: a house number
*/
guint
gswe_planet_data_get_house(GswePlanetData *planet_data)
{
if (planet_data == NULL) {
return 0;
}
return planet_data->house;
}
/**
* gswe_planet_data_get_sign:
* @planet_data: a #GswePlanetData
*
* Gets the zodiac sign in which the planet is currently in. If the planet's
* data is not calculated yet, this function yields GSWE_PLANET_NONE.
*
* Returns: a #GsweZodiac, which @planet_data is currently in
*/
GsweZodiac
gswe_planet_data_get_sign(GswePlanetData *planet_data)
{
if (planet_data == NULL) {
return GSWE_SIGN_NONE;
}
if (planet_data->sign_info) {
return planet_data->sign_info->sign;
} else {
return GSWE_SIGN_NONE;
}
}
/**
* gswe_planet_data_get_sign_info:
* @planet_data: (in): a #GswePlanetData
*
* Gets the sign which the planet is in.
*
* Returns: (transfer none): a #GsweSignInfo
*/
GsweSignInfo *
gswe_planet_data_get_sign_info(GswePlanetData *planet_data)
{
if (planet_data == NULL) {
return NULL;
}
return planet_data->sign_info;
}

View File

@ -1,74 +0,0 @@
/* gswe-planet-data.h: Planetary positions
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __SWE_GLIB_GSWE_PLANET_DATA_H__
#define __SWE_GLIB_GSWE_PLANET_DATA_H__
#include <glib-object.h>
#include "gswe-types.h"
#include "gswe-planet-info.h"
#include "gswe-sign-info.h"
G_BEGIN_DECLS
/**
* GswePlanetData:
*
* <structname>GswePlanetData</structname> is an opaque structure whose members
* cannot be accessed directly.
*
* Since: 1.1
*/
typedef struct _GswePlanetData GswePlanetData;
GType gswe_planet_data_get_type(void);
#define GSWE_TYPE_PLANET_DATA (gswe_planet_data_get_type())
GswePlanetData *gswe_planet_data_new(void);
GswePlanetData *gswe_planet_data_ref(GswePlanetData *planet_data);
void gswe_planet_data_unref(GswePlanetData *planet_data);
void gswe_planet_data_set_planet(
GswePlanetData *planet_data,
GswePlanet planet,
GError **err);
GswePlanet gswe_planet_data_get_planet(GswePlanetData *planet_data);
void gswe_planet_data_set_planet_info(
GswePlanetData *planet_data,
GswePlanetInfo *planet_info);
GswePlanetInfo *gswe_planet_data_get_planet_info(GswePlanetData *planet_data);
gdouble gswe_planet_data_get_position(GswePlanetData *planet_data);
gboolean gswe_planet_data_get_retrograde(GswePlanetData *planet_data);
guint gswe_planet_data_get_house(GswePlanetData *planet_data);
GsweZodiac gswe_planet_data_get_sign(GswePlanetData *planet_data);
GsweSignInfo *gswe_planet_data_get_sign_info(GswePlanetData *planet_data);
G_END_DECLS
#endif /* __SWE_GLIB_GSWE_PLANET_DATA_H__ */

View File

@ -1,55 +0,0 @@
/* gswe-planet-info-private.h: Private parts of GswePlanetInfo
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifdef __SWE_GLIB_BUILDING__
#ifndef __SWE_GLIB_GSWE_PLANET_INFO_PRIVATE_H__
#define __SWE_GLIB_GSWE_PLANET_INFO_PRIVATE_H__
#include "gswe-types.h"
#include "gswe-planet-info.h"
struct _GswePlanetInfo {
/* the planet ID */
GswePlanet planet;
/* the planet ID according to the Swiss Ephemeris libarary (or -1, if the
* planet has no such ID) */
gint32 sweph_id;
/* TRUE if the planet is a "real" celestial body on the sky. Please note
* that this will be true for Dark Moon (Lilith). Everything that has a
* planet ID in Swiss Ephemeris is treated as a real celestial body. */
gboolean real_body;
/* the planet's “personal” orb */
gdouble orb;
/* the planet's name */
gchar *name;
/* the value this planet counts in the element/quality points table */
gint points;
/* reference counter */
guint refcount;
};
#endif /* __SWE_GLIB_GSWE_PLANET_INFO_PRIVATE_H__ */
#else /* not defined __SWE_GLIB_BUILDING__ */
#error __FILE__ "Can not be included, unless building SWE-GLib"
#endif /* __SWE_GLIB_BUILDING__ */

View File

@ -1,268 +0,0 @@
/* gswe-planet-info.c: Planet related information
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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 "gswe-types.h"
#include "gswe-planet-info.h"
#include "gswe-planet-info-private.h"
/**
* SECTION:gswe-planet-info
* @short_description: a structure storing information about a planet
* @title: GswePlanetInfo
* @stability: Stable
* @include: swe-glib.h
*
* The #GswePlanetInfo structure stores information about a planet.
*/
G_DEFINE_BOXED_TYPE(
GswePlanetInfo,
gswe_planet_info,
(GBoxedCopyFunc)gswe_planet_info_ref,
(GBoxedFreeFunc)gswe_planet_info_unref);
/**
* gswe_planet_info_new:
*
* Creates a new #GswePlanetInfo object with reference count set to 1.
*
* Returns: a new #GswePlanetInfo
*/
GswePlanetInfo *
gswe_planet_info_new(void)
{
GswePlanetInfo *ret;
ret = g_new0(GswePlanetInfo, 1);
ret->refcount = 1;
return ret;
}
/**
* gswe_planet_info_ref:
* @planet_info: (in): a #GswePlanetInfo
*
* Increases reference count on @planet_info.
*
* Returns: (transfer none): the same #GswePlanetData
*/
GswePlanetInfo *
gswe_planet_info_ref(GswePlanetInfo *planet_info)
{
planet_info->refcount++;
return planet_info;
}
static void
gswe_planet_info_free(GswePlanetInfo *planet_info)
{
if (planet_info->name) {
g_free(planet_info->name);
}
g_free(planet_info);
}
/**
* gswe_planet_info_unref:
* @planet_info: a #GswePlanetInfo
*
* Decreases reference count on @planet_info. If reference count reaches zero,
* @planet_info is freed.
*/
void
gswe_planet_info_unref(GswePlanetInfo *planet_info)
{
if (--planet_info->refcount == 0) {
gswe_planet_info_free(planet_info);
}
}
/**
* gswe_planet_info_set_planet:
* @planet_info: a #GswePlanetInfo
* @planet: the new planet ID
*
* Sets the planet ID that will be represented by @planet_info.
*/
void
gswe_planet_info_set_planet(GswePlanetInfo *planet_info, GswePlanet planet)
{
planet_info->planet = planet;
}
/**
* gswe_planet_info_get_planet:
* @planet_info: (in): A #GswePlanetInfo
*
* Gets the planet ID represented by this #GswePlanetInfo.
*
* Returns: the planet ID
*/
GswePlanet
gswe_planet_info_get_planet(GswePlanetInfo *planet_info)
{
return planet_info->planet;
}
/**
* gswe_planet_info_set_sweph_id:
* @planet_info: a #GswePlanetInfo
* @sweph_id: the new Swiss Ephemeris planet ID
*
* Sets the Swiss Ephemeris planet_id associated with this planet.
*/
void
gswe_planet_info_set_sweph_id(GswePlanetInfo *planet_info, gint32 sweph_id)
{
planet_info->sweph_id = sweph_id;
}
/**
* gswe_planet_info_get_sweph_id:
* @planet_info: (in): A #GswePlanetInfo
*
* Gets the Swiss Ephemeris planet ID associated with this planet.
*
* Returns: the Swiss Ephemeris planet ID
*/
gint32
gswe_planet_info_get_sweph_id(GswePlanetInfo *planet_info)
{
return planet_info->sweph_id;
}
/**
* gswe_planet_info_set_real_body:
* @planet_info: a #GswePlanetInfo
* @real_body: a boolean that indicates if this planet is an object recognized
* by Swiss Ephemeris
*
* Sets whether this planet is an object recognized by the Swiss Ephemeris
* library.
*/
void
gswe_planet_info_set_real_body(GswePlanetInfo *planet_info, gboolean real_body)
{
planet_info->real_body = real_body;
}
/**
* gswe_planet_info_get_real_body:
* @planet_info: (in): A #GswePlanetInfo
*
* Checks weather this planet is a real celestial body (e.g. it has a Swiss
* Ephemeris planet ID) or not.
*
* Returns: TRUE if the planet has a Swiss Ephemeris planet ID; FALSE otherwise
*/
gboolean
gswe_planet_info_get_real_body(GswePlanetInfo *planet_info)
{
return planet_info->real_body;
}
/**
* gswe_planet_info_set_orb:
* @planet_info: a #GswePlanetInfo
* @orb: the planet's own orb
*
* Sets the orb of @planet_info. This value is used in aspect and antiscion
* calculations.
*/
void
gswe_planet_info_set_orb(GswePlanetInfo *planet_info, gdouble orb)
{
planet_info->orb = orb;
}
/**
* gswe_planet_info_get_orb:
* @planet_info: (in): A #GswePlanetInfo
*
* Gets the orb of the planet.
*
* Returns: the orb, in degrees
*/
gdouble
gswe_planet_info_get_orb(GswePlanetInfo *planet_info)
{
return planet_info->orb;
}
/**
* gswe_planet_info_set_name:
* @planet_info: (in): a #GswePlanetInfo
* @name: (in): the new name of the planet
*
* Sets the name of @planet_info.
*/
void
gswe_planet_info_set_name(GswePlanetInfo *planet_info, const gchar *name)
{
if (planet_info->name) {
g_free(planet_info->name);
}
planet_info->name = g_strdup(name);
}
/**
* gswe_planet_info_get_name:
* @planet_info: (in): A #GswePlanetInfo
*
* Gets the name of the planet.
*
* Returns: (transfer none): the planet's name
*/
const gchar *
gswe_planet_info_get_name(GswePlanetInfo *planet_info)
{
return planet_info->name;
}
/**
* gswe_planet_info_set_points:
* @planet_info: a #GswePlanetInfo
* @points: the new point value
*
* Sets the point value of @planet_info. This value is used in points
* calculations.
*/
void
gswe_planet_info_set_points(GswePlanetInfo *planet_info, gint points)
{
planet_info->points = points;
}
/**
* gswe_planet_info_get_points:
* @planet_info: (in): A #GswePlanetInfo
*
* Gets the value this planet counts in point calculations.
*
* Returns: the point value
*/
gint
gswe_planet_info_get_points(GswePlanetInfo *planet_info)
{
return planet_info->points;
}

View File

@ -1,79 +0,0 @@
/* gswe-planet-info.h: Planet related information
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __SWE_GLIB_GSWE_PLANET_INFO_H__
#define __SWE_GLIB_GSWE_PLANET_INFO_H__
#include <glib-object.h>
#include "gswe-types.h"
G_BEGIN_DECLS
/**
* GswePlanetInfo:
*
* <structname>GswePlanetInfo</structname> is an opaque structure whose members
* cannot be accessed directly.
*
* Since: 1.1
*/
typedef struct _GswePlanetInfo GswePlanetInfo;
GType gswe_planet_info_get_type(void);
#define GSWE_TYPE_PLANET_INFO (gswe_planet_info_get_type())
GswePlanetInfo *gswe_planet_info_new(void);
GswePlanetInfo *gswe_planet_info_ref(GswePlanetInfo *planet_info);
void gswe_planet_info_unref(GswePlanetInfo *planet_info);
void gswe_planet_info_set_planet(
GswePlanetInfo *planet_info,
GswePlanet planet);
GswePlanet gswe_planet_info_get_planet(GswePlanetInfo *planet_info);
void gswe_planet_info_set_sweph_id(
GswePlanetInfo *planet_info,
gint32 sweph_id);
gint32 gswe_planet_info_get_sweph_id(GswePlanetInfo *planet_info);
void gswe_planet_info_set_real_body(
GswePlanetInfo *planet_info,
gboolean real_body);
gboolean gswe_planet_info_get_real_body(GswePlanetInfo *planet_info);
void gswe_planet_info_set_orb(GswePlanetInfo *planet_info, gdouble orb);
gdouble gswe_planet_info_get_orb(GswePlanetInfo *planet_info);
void gswe_planet_info_set_name(GswePlanetInfo *planet_info, const gchar *name);
const gchar *gswe_planet_info_get_name(GswePlanetInfo *planet_info);
void gswe_planet_info_set_points(GswePlanetInfo *planet_info, gint points);
gint gswe_planet_info_get_points(GswePlanetInfo *planet_info);
G_END_DECLS
#endif /* __SWE_GLIB_GSWE_PLANET_INFO_PRIVATE_H__ */

View File

@ -1,47 +0,0 @@
/* gswe-sign-info-private.h: Private parts of GsweSignInfo
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifdef __SWE_GLIB_BUILDING__
#ifndef __SWE_GLIB_GSWE_SIGN_INFO_PRIVATE_H__
#define __SWE_GLIB_GSWE_SIGN_INFO_PRIVATE_H__
#include "gswe-types.h"
#include "gswe-sign-info.h"
struct _GsweSignInfo {
/* the identifier for this sign */
GsweZodiac sign;
/* the name of this sign */
gchar *name;
/* the element of the sign */
GsweElement element;
/* the quality of the sign */
GsweQuality quality;
/* Reference counter */
guint refcount;
};
#endif /* __SWE_GLIB_GSWE_SIGN_INFO_PRIVATE_H__ */
#else /* not defined __SWE_GLIB_BUILDING__ */
#error __FILE__ "Can not be included, unless building SWE-GLib"
#endif /* __SWE_GLIB_BUILDING__ */

View File

@ -1,208 +0,0 @@
/* gswe-sign-info.c: Zodiac sign related information
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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 "gswe-types.h"
#include "gswe-sign-info.h"
#include "gswe-sign-info-private.h"
/**
* SECTION:gswe-sign-info
* @short_description: a structure storing information about a zodiac sign
* @title: GsweSignInfo
* @stability: Stable
* @include: swe-glib.h
*
* The #GsweSignInfo stores information about a zodiac sign.
*/
G_DEFINE_BOXED_TYPE(GsweSignInfo,
gswe_sign_info,
(GBoxedCopyFunc)gswe_sign_info_ref,
(GBoxedFreeFunc)gswe_sign_info_unref);
static void
gswe_sign_info_free(GsweSignInfo *sign_info)
{
if (sign_info->name) {
g_free(sign_info->name);
}
g_free(sign_info);
}
/**
* gswe_sign_info_new:
*
* Creates a new GsweSignInfo object with reference count set to 1.
*
* Returns: (transfer full): a new #GsweSignInfo
*/
GsweSignInfo *
gswe_sign_info_new(void)
{
GsweSignInfo *ret;
ret = g_new0(GsweSignInfo, 1);
ret->refcount = 1;
return ret;
}
/**
* gswe_sign_info_ref:
* @sign_info: (in): a #GsweSignInfo
*
* Increases reference count on @sign_info.
*
* Returns: (transfer none): the same #GsweSignInfo
*/
GsweSignInfo *
gswe_sign_info_ref(GsweSignInfo *sign_info)
{
sign_info->refcount++;
return sign_info;
}
/**
* gswe_sign_info_unref:
* @sign_info: a #GsweSignInfo
*
* Decreases reference count or @sign_info. If reference count reaches zero,
* @sign_info is freed.
*/
void
gswe_sign_info_unref(GsweSignInfo *sign_info)
{
if (--sign_info->refcount == 0) {
gswe_sign_info_free(sign_info);
}
}
/**
* gswe_sign_info_set_sign:
* @sign_info: (in): a #GsweSignInfo
* @sign: the sign to set in @sign_info
*
* Sets the sign ID that is represented by this #GsweSignInfo.
*/
void
gswe_sign_info_set_sign(GsweSignInfo *sign_info, GsweZodiac sign)
{
sign_info->sign = sign;
}
/**
* gswe_sign_info_get_sign:
* @sign_info: (in): a #GsweSignInfo
*
* Gets the sign ID that is represented by this #GsweSignInfo.
*
* Returns: the sign ID
*/
GsweZodiac
gswe_sign_info_get_sign(GsweSignInfo *sign_info)
{
return sign_info->sign;
}
/**
* gswe_sign_info_set_name:
* @sign_info: (in): a #GsweSignInfo
* @name: (in): the name of the sign
*
* Sets the name of the sign.
*/
void
gswe_sign_info_set_name(GsweSignInfo *sign_info, const gchar *name)
{
if (sign_info->name) {
g_free(sign_info->name);
}
sign_info->name = g_strdup(name);
}
/**
* gswe_sign_info_get_name:
* @sign_info: (in): a #GsweSignInfo
*
* Gets the name associated with this sign.
*
* Returns: (transfer none): the name of the zodiac sign
*/
const gchar *
gswe_sign_info_get_name(GsweSignInfo *sign_info)
{
return sign_info->name;
}
/**
* gswe_sign_info_set_element:
* @sign_info: (in): a #GsweSignInfo
* @element: a #GsweElement
*
* Sets the element @sign_info should belong to.
*/
void
gswe_sign_info_set_element(GsweSignInfo *sign_info, GsweElement element)
{
sign_info->element = element;
}
/**
* gswe_sign_info_get_element:
* @sign_info: (in): a #GsweSignInfo
*
* Gets the element this sign belongs to.
*
* Returns: the element
*/
GsweElement
gswe_sign_info_get_element(GsweSignInfo *sign_info)
{
return sign_info->element;
}
/**
* gswe_sign_info_set_quality:
* @sign_info: (in): a #GsweSignInfo
* @quality: a #GsweQuality
*
* Sets the quality @sign should belong to
*/
void
gswe_sign_info_set_quality(GsweSignInfo *sign_info, GsweQuality quality)
{
sign_info->quality = quality;
}
/**
* gswe_sign_info_get_quality:
* @sign_info: (in): a #GsweSignInfo
*
* Gets the quality this sign belongs to.
*
* Returns: the quality
*/
GsweQuality
gswe_sign_info_get_quality(GsweSignInfo *sign_info)
{
return sign_info->quality;
}

View File

@ -1,60 +0,0 @@
/* gswe-sign-info.h: Zodiac sign related information
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __SWE_GLIB_GSWE_SIGN_INFO_H__
#define __SWE_GLIB_GSWE_SIGN_INFO_H__
#include <glib-object.h>
#include "gswe-types.h"
G_BEGIN_DECLS
/**
* GsweSignInfo:
*
* <structname>GsweSignInfo</structname> is an opaque structure whose members
* cannot be accessed directly.
*
* Since: 1.1
*/
typedef struct _GsweSignInfo GsweSignInfo;
GType gswe_sign_info_get_type(void);
#define GSWE_TYPE_SIGN_INFO (gswe_sign_info_get_type())
GsweSignInfo *gswe_sign_info_new(void);
GsweSignInfo *gswe_sign_info_ref(GsweSignInfo *sign_info);
void gswe_sign_info_unref(GsweSignInfo *sign_info);
void gswe_sign_info_set_sign(GsweSignInfo *sign_info, GsweZodiac sign);
GsweZodiac gswe_sign_info_get_sign(GsweSignInfo *sign_info);
void gswe_sign_info_set_name(GsweSignInfo *sign_info, const gchar *name);
const gchar *gswe_sign_info_get_name(GsweSignInfo *sign_info);
void gswe_sign_info_set_element(GsweSignInfo *sign_info, GsweElement element);
GsweElement gswe_sign_info_get_element(GsweSignInfo *sign_info);
void gswe_sign_info_set_quality(GsweSignInfo *sign_info, GsweQuality quality);
GsweQuality gswe_sign_info_get_quality(GsweSignInfo *sign_info);
G_END_DECLS
#endif /* __SWE_GLIB_GSWE_SIGN_INFO_H__ */

File diff suppressed because it is too large Load Diff

View File

@ -1,213 +0,0 @@
/* gswe-timestamp.h - Converter GObject between Gregorian calendar date and
* Julian day
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __SWE_GLIB_GSWE_TIMESTAMP_H__
#define __SWE_GLIB_GSWE_TIMESTAMP_H__
#include <glib-object.h>
#define GSWE_TYPE_TIMESTAMP (gswe_timestamp_get_type())
#define GSWE_TIMESTAMP(obj) (G_TYPE_CHECK_INSTANCE_CAST( \
(obj), \
GSWE_TYPE_TIMESTAMP, \
GsweTimestamp))
#define GSWE_IS_TIMESTAMP(obj) (G_TYPE_CHECK_INSTANCE_TYPE( \
(obj), \
GSWE_TYPE_TIMESTAMP))
#define GSWE_TIMESTAMP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST( \
(klass), \
GSWE_TYPE_TIMESTAMP, \
GsweTimestampClass))
#define GSWE_IS_TIMESTAMP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE( \
(klass), \
GSWE_TYPE_TIMESTAMP))
#define GSWE_TIMESTAMP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), \
GSWE_TYPE_TIMESTAMP, \
GsweTimestampClass))
typedef struct _GsweTimestamp GsweTimestamp;
typedef struct _GsweTimestampClass GsweTimestampClass;
typedef struct _GsweTimestampPrivate GsweTimestampPrivate;
/**
* GsweTimestamp:
*
* The GsweTimestamp object's instance definition.
*/
struct _GsweTimestamp {
/* Parent instance structure */
GObject parent_instance;
/* Instance members */
/*< private >*/
GsweTimestampPrivate *priv;
};
/**
* GsweTimestampClass:
* @parent_class: the parent class structure (#GObjectClass)
*
* The GsweTimestamp object's class definition.
*/
struct _GsweTimestampClass {
/* Parent class */
GObjectClass parent_class;
/*< private >*/
/* Padding for future expansion */
void (*_swe_glib_reserved1)(void);
void (*_swe_glib_reserved2)(void);
void (*_swe_glib_reserved3)(void);
void (*_swe_glib_reserved4)(void);
void (*_swe_glib_reserved5)(void);
void (*_swe_glib_reserved6)(void);
void (*_swe_glib_reserved7)(void);
void (*_swe_glib_reserved8)(void);
void (*_swe_glib_reserved9)(void);
void (*_swe_glib_reserved10)(void);
void (*_swe_glib_reserved11)(void);
void (*_swe_glib_reserved12)(void);
void (*_swe_glib_reserved13)(void);
void (*_swe_glib_reserved14)(void);
void (*_swe_glib_reserved15)(void);
void (*_swe_glib_reserved16)(void);
void (*_swe_glib_reserved17)(void);
void (*_swe_glib_reserved18)(void);
void (*_swe_glib_reserved19)(void);
void (*_swe_glib_reserved20)(void);
};
GType gswe_timestamp_get_type(void);
/* Method definitions */
GsweTimestamp *gswe_timestamp_new(void);
GsweTimestamp *gswe_timestamp_new_from_julian_day(gdouble julian_day);
GsweTimestamp * gswe_timestamp_new_from_gregorian_full(gint year,
gint month,
gint day,
gint hour,
gint minute,
gint second,
gint microsecond,
gdouble time_zone_offset);
void gswe_timestamp_set_gregorian_full(GsweTimestamp *timestamp,
gint year,
gint month,
gint day,
gint hour,
gint minute,
gint second,
gint microsecond,
gdouble time_zone_offset,
GError **err);
void gswe_timestamp_set_instant_recalc(GsweTimestamp *timestamp,
gboolean instant_recalc,
GError **err);
gboolean gswe_timestamp_get_instant_recalc(GsweTimestamp *timestamp);
void gswe_timestamp_set_gregorian_year(GsweTimestamp *timestamp,
gint gregorian_year,
GError **err);
gint gswe_timestamp_get_gregorian_year(GsweTimestamp *timestamp, GError **err);
void gswe_timestamp_set_gregorian_month(GsweTimestamp *timestamp,
gint gregorian_month,
GError **err);
gint gswe_timestamp_get_gregorian_month(GsweTimestamp *timestamp, GError **err);
void gswe_timestamp_set_gregorian_day(GsweTimestamp *timestamp,
gint gregorian_day,
GError **err);
gint gswe_timestamp_get_gregorian_day(GsweTimestamp *timestamp, GError **err);
void gswe_timestamp_set_gregorian_hour(GsweTimestamp *timestamp,
gint gregorian_hour,
GError **err);
gint gswe_timestamp_get_gregorian_hour(GsweTimestamp *timestamp, GError **err);
void gswe_timestamp_set_gregorian_minute(GsweTimestamp *timestamp,
gint gregorian_minute,
GError **err);
gint gswe_timestamp_get_gregorian_minute(GsweTimestamp *timestamp,
GError **err);
void gswe_timestamp_set_gregorian_second(GsweTimestamp *timestamp,
gint gregorian_second,
GError **err);
gint gswe_timestamp_get_gregorian_second(GsweTimestamp *timestamp,
GError **err);
void gswe_timestamp_set_gregorian_microsecond(GsweTimestamp *timestamp,
gint gregorian_microsecond,
GError **err);
gint gswe_timestamp_get_gregorian_microsecond(GsweTimestamp *timestamp,
GError **err);
void gswe_timestamp_set_gregorian_timezone(GsweTimestamp *timestamp,
gdouble gregorian_timezone_offset,
GError **err);
gdouble gswe_timestamp_get_gregorian_timezone(GsweTimestamp *timestamp);
#ifndef GSWE_DISABLE_DEPRECATED
G_DEPRECATED_FOR(gswe_timestamp_set_julian_day_et)
void gswe_timestamp_set_julian_day(GsweTimestamp *timestamp,
gdouble julian_day);
G_DEPRECATED_FOR(gswe_timestamp_get_julian_day_et)
gdouble gswe_timestamp_get_julian_day(GsweTimestamp *timestamp,
GError **err);
#endif
void gswe_timestamp_set_julian_day_et(GsweTimestamp *timestamp,
gdouble julian_day,
GError **err);
gdouble gswe_timestamp_get_julian_day_et(GsweTimestamp *timestamp,
GError **err);
void gswe_timestamp_set_julian_day_ut(GsweTimestamp *timestamp,
gdouble julian_day,
GError **err);
gdouble gswe_timestamp_get_julian_day_ut(GsweTimestamp *timestamp,
GError **err);
gdouble gswe_timestamp_get_sidereal_time(GsweTimestamp *timestamp,
GError **err);
void gswe_timestamp_set_now_local(GsweTimestamp *timestamp,
GError **err);
GsweTimestamp *gswe_timestamp_new_from_now_local(void);
#endif /* __SWE_GLIB_GSWE_TIMESTAMP_H__ */

View File

@ -1,45 +0,0 @@
/* gswe-types.h - Basic types of SWE-GLib
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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 "gswe-types.h"
/**
* GSWE_PLANET_LILITH:
*
* The Moon apogee is often called Lilith, or Dark Moon among astrologers.
* There is also an asteroid with the same name (1181 Lilith), which is
* currently not included in SWE-GLib.
*/
GsweCoordinates *
gswe_coordinates_copy(GsweCoordinates *coordinates)
{
GsweCoordinates *ret = g_new0(GsweCoordinates, 1);
ret->longitude = coordinates->longitude;
ret->latitude = coordinates->latitude;
ret->altitude = coordinates->altitude;
return ret;
}
G_DEFINE_BOXED_TYPE(
GsweCoordinates,
gswe_coordinates,
(GBoxedCopyFunc)gswe_coordinates_copy,
(GBoxedFreeFunc)g_free);

View File

@ -1,349 +0,0 @@
/* gswe-types.h - Basic types of SWE-GLib
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __SWE_GLIB_GSWE_TYPES_H__
#define __SWE_GLIB_GSWE_TYPES_H__
#include <glib.h>
#include <glib-object.h>
/**
* SECTION:gswe-types
* @short_description: Base types of SWE-GLib
* @title: Base types
* @stability: Stable
* @include: swe-glib/swe-glib.h
*
* These are the base types used throughout SWE-GLib.
*/
/**
* 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,
* or Lilith)
* @GSWE_PLANET_SUN: the Sun
* @GSWE_PLANET_MOON: the Moon
* @GSWE_PLANET_MERCURY: planet Mercury
* @GSWE_PLANET_VENUS: planet Venus
* @GSWE_PLANET_EARTH: planet Earth
* @GSWE_PLANET_MARS: planet Mars
* @GSWE_PLANET_JUPITER: planet Jupiter
* @GSWE_PLANET_SATURN: planet Saturn
* @GSWE_PLANET_URANUS: planet Uranus
* @GSWE_PLANET_NEPTUNE: planet Neptune
* @GSWE_PLANET_PLUTO: planet Pluto
* @GSWE_PLANET_CHIRON: dwarf planet Chiron
* @GSWE_PLANET_CERES: dwarf planet Ceres
* @GSWE_PLANET_PALLAS: dwarf planet Pallas
* @GSWE_PLANET_JUNO: dwarf planet Juno
* @GSWE_PLANET_VESTA: dwarf planet Vesta
* @GSWE_PLANET_PHOLUS: asteroid Pholus
* @GSWE_PLANET_NESSUS: asteroid Nessus
* @GSWE_PLANET_CHARIKLO: asteroid Chariklo
* @GSWE_PLANET_SEDNA: dwarf planet Sedna
* @GSWE_PLANET_ERIS: dwarf planet Eris
* @GSWE_PLANET_DEJANIRA: dwarf planet Dejanira
* @GSWE_PLANET_CIRCE: asteroid Circe
* @GSWE_PLANET_ORCUS: asteroid Orcus
* @GSWE_PLANET_ASBOLUS: asteroid Asbolus
* @GSWE_PLANET_HYGIEA: asteroid Hygiea
*
* This enum holds the planet identifiers known by SWE-GLib.
*/
typedef enum {
/* Theoretical/non-existing points */
GSWE_PLANET_NONE = 0,
GSWE_PLANET_ASCENDANT,
GSWE_PLANET_MC,
GSWE_PLANET_VERTEX,
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,
GSWE_PLANET_MOON,
GSWE_PLANET_MERCURY,
GSWE_PLANET_VENUS,
GSWE_PLANET_EARTH,
GSWE_PLANET_MARS,
GSWE_PLANET_JUPITER,
GSWE_PLANET_SATURN,
GSWE_PLANET_URANUS,
GSWE_PLANET_NEPTUNE,
GSWE_PLANET_PLUTO,
/* Dwarves and asteroids */
GSWE_PLANET_CHIRON = 101, /* Included in ephemerides files */
GSWE_PLANET_CERES, /* Included in ephemerides files */
GSWE_PLANET_PALLAS, /* Included in ephemerides files */
GSWE_PLANET_JUNO, /* Included in ephemerides files */
GSWE_PLANET_VESTA, /* Included in ephemerides files */
GSWE_PLANET_PHOLUS, /* Included in ephemerides files */
GSWE_PLANET_NESSUS, /* 7066 */
GSWE_PLANET_CHARIKLO, /* 10199 */
GSWE_PLANET_SEDNA, /* 90377 */
GSWE_PLANET_ERIS, /* 136199 */
GSWE_PLANET_DEJANIRA, /* 157 */
GSWE_PLANET_CIRCE, /* 34 */
GSWE_PLANET_ORCUS, /* 90482 */
GSWE_PLANET_ASBOLUS, /* 8405 */
GSWE_PLANET_HYGIEA /* 10 */
} GswePlanet;
/* Moon Apogee in astrology is often referred to as the Dark Moon, or Lilith */
#define GSWE_PLANET_LILITH GSWE_PLANET_MOON_APOGEE
/**
* GSWE_PLANET_OFFSET_VIRTUAL_NODES:
*
* The offset in #GswePlanet for virtual nodes like the ascendant or vertex.
* This is for consistency only, I dont think anyone would need it.
*/
#define GSWE_PLANET_OFFSET_VIRTUAL_NODES 0
/**
* GSWE_PLANET_OFFSET_PLANETS:
*
* The offset in #GswePlanet for real planets in the Solar System. These are
* the objects classified as planets (including Pluto).
*/
#define GSWE_PLANET_OFFSET_PLANETS 10
/**
* GSWE_PLANET_OFFSET_ASTEROIDS:
*
* The offset in #GswePlanet for asteroids and dwarf planets.
*/
#define GSWE_PLANET_OFFSET_ASTEROIDS 100
/**
* GSWE_PLANET_OFFSET_CUSTOM:
*
* The offset in #GswePlanet for custom planets. This will be used to register
* custom planets later.
*/
#define GSWE_PLANET_OFFSET_CUSTOM 10000
/**
* GsweZodiac:
* @GSWE_SIGN_NONE: no sign
* @GSWE_SIGN_ARIES: the Aries sign (Ram)
* @GSWE_SIGN_TAURUS: the Taurus sign (Bull)
* @GSWE_SIGN_GEMINI: the Gemini sign (Twins)
* @GSWE_SIGN_CANCER: the Cancer sign (Crab)
* @GSWE_SIGN_LEO: the Leo sign (Lion)
* @GSWE_SIGN_VIRGO: the Virgo sign (Maid)
* @GSWE_SIGN_LIBRA: the Libra sign (Scales)
* @GSWE_SIGN_SCORPIO: the Scorpio sign (Scorpion)
* @GSWE_SIGN_SAGITTARIUS: the Sagittarius sign (Archer)
* @GSWE_SIGN_CAPRICORN: the Capricorn sign (Goat)
* @GSWE_SIGN_AQUARIUS: the Aquarius sign (Water Bearer)
* @GSWE_SIGN_PISCES: the Pisces sign (Fish)
*
* The zodiac signs known by SWE-GLib by default.
*/
typedef enum {
GSWE_SIGN_NONE,
GSWE_SIGN_ARIES,
GSWE_SIGN_TAURUS,
GSWE_SIGN_GEMINI,
GSWE_SIGN_CANCER,
GSWE_SIGN_LEO,
GSWE_SIGN_VIRGO,
GSWE_SIGN_LIBRA,
GSWE_SIGN_SCORPIO,
GSWE_SIGN_SAGITTARIUS,
GSWE_SIGN_CAPRICORN,
GSWE_SIGN_AQUARIUS,
GSWE_SIGN_PISCES
} GsweZodiac;
/**
* GsweAspect:
* @GSWE_ASPECT_NONE: no aspect
* @GSWE_ASPECT_CONJUCTION: conjuction (0°)
* @GSWE_ASPECT_SEXTILE: sextile (60°)
* @GSWE_ASPECT_SQUARE: square (or quadrat; 90°)
* @GSWE_ASPECT_TRINE: trine (or trigon; 120°)
* @GSWE_ASPECT_OPPOSITION: opposition (180°)
* @GSWE_ASPECT_SEMISEXTILE: semi-sextile (30°)
* @GSWE_ASPECT_SEMISQUARE: semi-square (45°)
* @GSWE_ASPECT_QUINTILE: quintile (72°)
* @GSWE_ASPECT_SESQUISQUARE: sesqui-square (135°)
* @GSWE_ASPECT_BIQUINTILE: bi-quintile (144°)
* @GSWE_ASPECT_QUINCUNX: quincunx (150°)
*
* The aspects known by SWE-GLib by default.
*/
typedef enum {
GSWE_ASPECT_NONE,
GSWE_ASPECT_CONJUCTION,
GSWE_ASPECT_SEXTILE,
GSWE_ASPECT_SQUARE,
GSWE_ASPECT_TRINE,
GSWE_ASPECT_OPPOSITION,
GSWE_ASPECT_SEMISEXTILE,
GSWE_ASPECT_SEMISQUARE,
GSWE_ASPECT_QUINTILE,
GSWE_ASPECT_SESQUISQUARE,
GSWE_ASPECT_BIQUINTILE,
GSWE_ASPECT_QUINCUNX
} GsweAspect;
/**
* GsweAntiscionAxis:
* @GSWE_ANTISCION_AXIS_NONE: no mirror
* @GSWE_ANTISCION_AXIS_ARIES: mirror on the Aries/Libra (0°-180°) axis
* @GSWE_ANTISCION_AXIS_MID_TAURUS: mirror on the middle of Taurus/Scorpio
* (45°-225°) axis
* @GSWE_ANTISCION_AXIS_CANCER: mirror on the Cancer/Capricorn (90°-270°) axis
* @GSWE_ANTISCION_AXIS_MID_LEO: mirror on the middle of Leo/Aquarius
* (135°-315°) axis
*
* The antiscion axes known by SWE-GLib by default.
*/
typedef enum {
GSWE_ANTISCION_AXIS_NONE,
GSWE_ANTISCION_AXIS_ARIES,
GSWE_ANTISCION_AXIS_MID_TAURUS,
GSWE_ANTISCION_AXIS_CANCER,
GSWE_ANTISCION_AXIS_MID_LEO
} GsweAntiscionAxis;
/**
* GsweElement:
* @GSWE_ELEMENT_NONE: no element
* @GSWE_ELEMENT_FIRE: the Fire element
* @GSWE_ELEMENT_EARTH: the Earth element
* @GSWE_ELEMENT_AIR: the Air element
* @GSWE_ELEMENT_WATER: the Water element
*
* The elements as known by the SWE-GLib library.
*/
typedef enum {
GSWE_ELEMENT_NONE,
GSWE_ELEMENT_FIRE,
GSWE_ELEMENT_EARTH,
GSWE_ELEMENT_AIR,
GSWE_ELEMENT_WATER
} GsweElement;
/**
* GsweQuality:
* @GSWE_QUALITY_NONE: no quality
* @GSWE_QUALITY_CARDINAL: Cardinal quality
* @GSWE_QUALITY_FIX: Fix quality
* @GSWE_QUALITY_MUTABLE: Mutable quality
*
* The qualities as known by the SWE-GLib library.
*/
typedef enum {
GSWE_QUALITY_NONE,
GSWE_QUALITY_CARDINAL,
GSWE_QUALITY_FIX,
GSWE_QUALITY_MUTABLE
} GsweQuality;
/**
* GsweHouseSystem:
* @GSWE_HOUSE_SYSTEM_NONE: no house system
* @GSWE_HOUSE_SYSTEM_PLACIDUS: Placidus house system
* @GSWE_HOUSE_SYSTEM_KOCH: Koch house system
* @GSWE_HOUSE_SYSTEM_EQUAL: Equal house system
*
* The house systems currently known by SWE-GLib.
*/
typedef enum {
GSWE_HOUSE_SYSTEM_NONE,
GSWE_HOUSE_SYSTEM_PLACIDUS,
GSWE_HOUSE_SYSTEM_KOCH,
GSWE_HOUSE_SYSTEM_EQUAL
} GsweHouseSystem;
/**
* GsweMoonPhase:
* @GSWE_MOON_PHASE_NONE: Moon phase is not defined
* @GSWE_MOON_PHASE_NEW: New Moon
* @GSWE_MOON_PHASE_WAXING_CRESCENT: Waxing crescent Moon
* @GSWE_MOON_PHASE_WAXING_HALF: First half
* @GSWE_MOON_PHASE_WAXING_GIBBOUS: Waxing gibbous Moon
* @GSWE_MOON_PHASE_FULL: Full Moon
* @GSWE_MOON_PHASE_WANING_GIBBOUS: Waning gibbous Moon
* @GSWE_MOON_PHASE_WANING_HALF: Second Half
* @GSWE_MOON_PHASE_WANING_CRESCENT: Waning crescent Moon
* @GSWE_MOON_PHASE_DARK: Dark Moon
*
* The phases of the Moon.
*/
typedef enum {
GSWE_MOON_PHASE_NONE,
GSWE_MOON_PHASE_NEW,
GSWE_MOON_PHASE_WAXING_CRESCENT,
GSWE_MOON_PHASE_WAXING_HALF,
GSWE_MOON_PHASE_WAXING_GIBBOUS,
GSWE_MOON_PHASE_FULL,
GSWE_MOON_PHASE_WANING_GIBBOUS,
GSWE_MOON_PHASE_WANING_HALF,
GSWE_MOON_PHASE_WANING_CRESCENT,
GSWE_MOON_PHASE_DARK
} GsweMoonPhase;
/**
* GsweTimestampValidityFlags:
* @GSWE_VALID_NONE: No valid timestamp
* @GSWE_VALID_GREGORIAN: Gregorian timestamp is valid
* @GSWE_VALID_JULIAN_DAY: Julian Day is valid
*
* Flags to show the valid values in a #GsweTimestamp
*/
typedef enum {
GSWE_VALID_NONE = 0,
GSWE_VALID_GREGORIAN = (1 << 0),
GSWE_VALID_JULIAN_DAY = (1 << 1)
} GsweTimestampValidityFlags;
/**
* GsweCoordinates:
* @longitude: longitude part of the coordinates
* @latitude: latitude part of the coordinates
* @altitude: altitude relative to sea level
*
* GsweCoordinates specifies an exact point on Earth's surface
*/
typedef struct _GsweCoordinates {
gdouble longitude;
gdouble latitude;
gdouble altitude;
} GsweCoordinates;
GType gswe_coordinates_get_type(void);
#define GSWE_TYPE_COORDINATES (gswe_coordinates_get_type())
#endif /* __SWE_GLIB_GSWE_TYPES_H__ */

View File

@ -1,91 +0,0 @@
/* gswe-version.c: SWE-GLib version information
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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 <glib.h>
#include "gswe-version.h"
/**
* SECTION:gswe-version
* @short_description: SWE-GLib version information
* @title: Version information
* @stability: Stable
* @include: swe-glib/swe-glib.h
*
* Version information of the SWE-GLib library.
*/
/**
* GSWE_MAJOR_VERSION:
*
* The major version number of the SWE-GLib library.
*
* Since: 2.1
*/
/**
* GSWE_MINOR_VERSION:
*
* The minor version number of the SWE-GLib library.
*
* Since: 2.1
*/
/**
* GSWE_MICRO_VERSION:
*
* The micro version number of the SWE-GLib library.
*
* Since: 2.1
*/
/**
* GSWE_CHECK_VERSION:
* @major: the major version to check for
* @minor: the minor version to check for
* @micro: the micro version to check for
*
* Checks the version number of the SWE-GLib library that is being comipled
* against.
*
* Returns: TRUE if the required version is satisfied; FALSE otherwise.
*
* Since: 2.1
*/
/**
* gswe_check_version:
* @required_major: the required major version
* @required_minor: the required minor version
* @required_micro: the required micro version
*
* Checks that the SWE-GLib library in use is compatible with the given
* version.
*
* Returns: TRUE if the required version is satisfied; FALSE otherwise.
*
* Since: 2.1
*/
gboolean
gswe_check_version(
guint required_major,
guint required_minor,
guint required_micro)
{
return (GSWE_CHECK_VERSION(required_major, required_minor, required_micro));
}

View File

@ -1,37 +0,0 @@
/* gswe-version.h: SWE-GLib version information
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GSWE_VERSION_H__
#define __GSWE_VERSION_H__
#define GSWE_MAJOR_VERSION @SWE_GLIB_MAJOR_VERSION@
#define GSWE_MINOR_VERSION @SWE_GLIB_MINOR_VERSION@
#define GSWE_MICRO_VERSION @SWE_GLIB_MICRO_VERSION@
gboolean gswe_check_version(
guint required_major,
guint required_minor,
guint required_micro);
#define GSWE_CHECK_VERSION(major,minor,micro) \
(GSWE_MAJOR_VERSION > (major) || \
(GSWE_MAJOR_VERSION == (major) && GSWE_MINOR_VERSION > (minor)) || \
(GSWE_MAJOR_VERSION == (major) && GSWE_MINOR_VERSION == (minor) && \
GSWE_MICRO_VERSION >= (micro)))
#endif /* __GSWE_VERSION_H__ */

View File

@ -1,48 +0,0 @@
/*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifdef __SWE_GLIB_BUILDING__
#ifndef __SWE_GLIB_PRIVATE_H__
#include "gswe-timestamp.h"
#include "gswe-types.h"
#include "gswe-moon-phase-data-private.h"
#include "gswe-sign-info-private.h"
#include "gswe-planet-info-private.h"
#include "gswe-planet-data-private.h"
#include "gswe-aspect-info-private.h"
#include "gswe-aspect-data-private.h"
#include "gswe-antiscion-axis-info-private.h"
#include "gswe-antiscion-data-private.h"
#include "gswe-house-system-info-private.h"
#include "gswe-house-data-private.h"
extern gboolean gswe_initialized;
extern gchar *gswe_ephe_path;
extern GsweTimestamp *gswe_full_moon_base_date;
extern GHashTable *gswe_planet_info_table;
extern GHashTable *gswe_sign_info_table;
extern GHashTable *gswe_house_system_info_table;
extern GHashTable *gswe_aspect_info_table;
extern GHashTable *gswe_antiscion_axis_info_table;
GsweCoordinates *gswe_coordinates_copy(GsweCoordinates *coordinates);
#endif /* __SWE_GLIB_PRIVATE_H__ */
#else /* not defined __SWE_GLIB_BUILDING__ */
#error __FILE__ "Can not be included, unless building SWE-GLib"
#endif /* __SWE_GLIB_BUILDING__ */

View File

@ -1,927 +0,0 @@
/* SWE-GLib - GLib style wrapper library around Astrodienst's Swiss Ephemeris
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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 <glib.h>
#define GETTEXT_PACKAGE "swe-glib"
#include <glib/gi18n-lib.h>
#include <swephexp.h>
#include "swe-glib.h"
#include "swe-glib-private.h"
/**
* SECTION:swe-glib
* @short_description: Utility and initialization functions
* @title: Utility functions
* @stability: Stable
* @include: swe-glib/swe-glib.h
*
* Basic utility and initialization functions. They don't operate on SWE-GLib's
* objects, but on the library as a whole, including global tables.
*/
/**
* GsweError:
* @GSWE_ERROR_SUCCESS: No error
* @GSWE_ERROR_SWE_NONFATAL: Non-fatal Swiss Ephemeris library error
* @GSWE_ERROR_SWE_FATAL: Fatal Swiss Ephemeris library error
* @GSWE_ERROR_INVALID_DATE: The specified Gregorian date is invalid
* @GSWE_ERROR_INVALID_TIME: The specified time is invalid
* @GSWE_ERROR_NO_VALID_VALUE: the #GsweTimestamp object holds no valid values
* @GSWE_ERROR_UNKNOWN_HSYS: the requested house system is unknown
* @GSWE_ERROR_UNKNOWN_SIGN: an invalid zodiac sign would have been returned
* @GSWE_ERROR_UNKNOWN_PLANET: the referenced planet was not added with
* gswe_moment_add_planet()
* @GSWE_ERROR_UNKNOWN_ANTISCION_AXIS: the given axis is unknown to SWE-GLib
* @GSWE_ERROR_UNKNOWN_ASPECT: the given aspect is unknown to SWE-GLib
*
* Error codes returned by the SWE-GLib functions.
*/
/**
* GSWE_ERROR:
*
* Error domain for SWE-GLib in general. Since 2.0, all errors generated by
* SWE-GLib functions are from this domain. See #GError for more information on
* error domains.
*/
gboolean gswe_initialized = FALSE;
gchar *gswe_ephe_path = NULL;
GHashTable *gswe_planet_info_table;
GHashTable *gswe_sign_info_table;
GHashTable *gswe_house_system_info_table;
GHashTable *gswe_aspect_info_table;
GHashTable *gswe_antiscion_axis_info_table;
GsweTimestamp *gswe_full_moon_base_date;
static gboolean gswe_initializing = FALSE;
#define ADD_PLANET(ht, v, i, s, r, n, o, h) \
(v) = gswe_planet_info_new(); \
(v)->planet = (i); \
(v)->sweph_id = (s); \
(v)->real_body = (r); \
(v)->orb = (o); \
(v)->name = g_strdup(n); \
(v)->points = (h); \
g_hash_table_replace((ht), GINT_TO_POINTER(i), (v)); \
#define ADD_SIGN(ht, v, s, n, e, q) \
(v) = gswe_sign_info_new(); \
(v)->sign = (s); \
(v)->name = g_strdup(n); \
(v)->element = (e); \
(v)->quality = (q); \
g_hash_table_replace((ht), GINT_TO_POINTER(s), (v)); \
#define ADD_HOUSE_SYSTEM(ht, v, i, s, n) \
(v) = gswe_house_system_info_new(); \
(v)->house_system = i; \
(v)->sweph_id = s; \
(v)->name = g_strdup(n); \
g_hash_table_replace((ht), GINT_TO_POINTER(i), (v)); \
#define ADD_ASPECT(ht, v, i, n, s, o, h, m) \
(v) = gswe_aspect_info_new(); \
(v)->aspect = (i); \
(v)->name = g_strdup(n); \
(v)->size = (s); \
(v)->orb_modifier = (o); \
(v)->harmonic = (h); \
(v)->major = (m); \
g_hash_table_replace((ht), GINT_TO_POINTER(i), (v)); \
#define ADD_ANTISCION(ht, v, hts, vs, i, n, s, m) \
(v) = gswe_antiscion_axis_info_new(); \
(vs) = g_hash_table_lookup((hts), GINT_TO_POINTER(i)); \
(v)->axis = (i); \
(v)->start_sign = (vs); \
(v)->name = g_strdup(n); \
(v)->sign_offset = m; \
g_hash_table_replace((ht), GINT_TO_POINTER(i), (v)); \
/**
* gswe_error_quark:
*
* Gets the SWE-GLib Error Quark.
*
* Return value: a #GQuark
*/
#if GLIB_CHECK_VERSION(2, 34, 0)
G_DEFINE_QUARK(gswe-error-quark, gswe_error);
#else
GQuark
gswe_error_quark(void)
{
return g_quark_from_static_string("gswe-error-quark");
}
#endif
/**
* gswe_init_with_dir:
* @directory: the path that contains the Swiss Ephemeris data files
*
* Initializes the SWE-GLib library with @directory as the Swiss Ephemeris
* data files' location. This, or gswe_init() must be called before any
* calculations are made.
*/
void gswe_init_with_dir(gchar *directory)
{
GswePlanetInfo *planet_info;
GsweSignInfo *sign_info;
GsweHouseSystemInfo *house_system_info;
GsweAspectInfo *aspect_info;
GsweAntiscionAxisInfo *antiscion_axis_info;
if (gswe_initialized) {
return;
}
if (gswe_initializing) {
return;
}
gswe_initializing = TRUE;
/* Before 2.36, g_type_init() must have been called. Let's do it! */
#if !GLIB_CHECK_VERSION(2, 36, 0)
g_type_init();
#endif
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
gswe_planet_info_table = g_hash_table_new_full(
g_direct_hash, g_direct_equal,
NULL, (GDestroyNotify)gswe_planet_info_unref
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_ASCENDANT,
-1,
FALSE,
_("Ascendant"),
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,
FALSE,
_("Midheaven"),
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,
FALSE,
_("Vertex"),
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,
TRUE,
_("Ascending Moon Node"),
2.0,
1
);
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"),
2.0,
0);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_MOON_APOGEE,
SE_MEAN_APOG,
TRUE,
_("Dark Moon"),
2.0,
0
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_SUN,
SE_SUN,
TRUE,
_("Sun"),
13.0,
2
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_MOON,
SE_MOON,
TRUE,
_("Moon"),
9.0,
2
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_MERCURY,
SE_MERCURY,
TRUE,
_("Mercury"),
7.0,
2
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_VENUS,
SE_VENUS,
TRUE,
_("Venus"),
7.0,
1
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_MARS,
SE_MARS,
TRUE,
_("Mars"),
7.0,
1
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_JUPITER,
SE_JUPITER,
TRUE,
_("Jupiter"),
9.0,
1
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_SATURN,
SE_SATURN,
TRUE,
_("Saturn"),
7.0,
1
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_URANUS,
SE_URANUS,
TRUE,
_("Uranus"),
5.0,
1
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_NEPTUNE,
SE_NEPTUNE,
TRUE,
_("Neptune"),
5.0,
1
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_PLUTO,
SE_PLUTO,
TRUE,
_("Pluto"),
3.0,
1
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_CHIRON,
SE_CHIRON,
TRUE,
_("Chiron"),
2.0,
0
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_CERES,
SE_CERES,
TRUE,
_("Ceres"),
2.0,
0
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_PALLAS,
SE_PALLAS,
TRUE,
_("Pallas"),
2.0,
0
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_JUNO,
SE_JUNO,
TRUE,
_("Juno"),
2.0,
0
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_VESTA,
SE_VESTA,
TRUE,
_("Vesta"),
2.0,
0
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_PHOLUS,
SE_PHOLUS,
TRUE,
_("Pholus"),
2.0,
0
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_NESSUS,
SE_AST_OFFSET + 7066,
TRUE,
_("Nessus"),
2.0,
0
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_CHARIKLO,
SE_AST_OFFSET + 10199,
TRUE,
_("Chariklo"),
2.0,
0
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_SEDNA,
SE_AST_OFFSET + 90377,
TRUE,
_("Sedna"),
2.0,
0
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_ERIS,
SE_AST_OFFSET + 136199,
TRUE,
_("Eris"),
2.0,
0
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_DEJANIRA,
SE_AST_OFFSET + 157,
TRUE,
_("Dejanira"),
2.0,
0
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_CIRCE,
SE_AST_OFFSET + 34,
TRUE,
_("Circe"),
2.0,
0
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_ORCUS,
SE_AST_OFFSET + 90482,
TRUE,
_("Orcus"),
2.0,
0
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_ASBOLUS,
SE_AST_OFFSET + 8405,
TRUE,
_("Asbolus"),
2.0,
0
);
ADD_PLANET(gswe_planet_info_table, planet_info,
GSWE_PLANET_HYGIEA,
SE_AST_OFFSET + 10,
TRUE,
_("Hygiea"),
2.0,
0
);
gswe_sign_info_table = g_hash_table_new_full(
g_direct_hash, g_direct_equal,
NULL, (GDestroyNotify)gswe_sign_info_unref
);
ADD_SIGN(gswe_sign_info_table, sign_info,
GSWE_SIGN_ARIES,
_("Aries"),
GSWE_ELEMENT_FIRE,
GSWE_QUALITY_CARDINAL
);
ADD_SIGN(gswe_sign_info_table, sign_info,
GSWE_SIGN_TAURUS,
_("Taurus"),
GSWE_ELEMENT_EARTH,
GSWE_QUALITY_FIX
);
ADD_SIGN(gswe_sign_info_table, sign_info,
GSWE_SIGN_GEMINI,
_("Gemini"),
GSWE_ELEMENT_AIR,
GSWE_QUALITY_MUTABLE
);
ADD_SIGN(gswe_sign_info_table, sign_info,
GSWE_SIGN_CANCER,
_("Cancer"),
GSWE_ELEMENT_WATER,
GSWE_QUALITY_CARDINAL
);
ADD_SIGN(gswe_sign_info_table, sign_info,
GSWE_SIGN_LEO,
_("Leo"),
GSWE_ELEMENT_FIRE,
GSWE_QUALITY_FIX
);
ADD_SIGN(gswe_sign_info_table, sign_info,
GSWE_SIGN_VIRGO,
_("Virgo"),
GSWE_ELEMENT_EARTH,
GSWE_QUALITY_MUTABLE
);
ADD_SIGN(gswe_sign_info_table, sign_info,
GSWE_SIGN_LIBRA,
_("Libra"),
GSWE_ELEMENT_AIR,
GSWE_QUALITY_CARDINAL
);
ADD_SIGN(gswe_sign_info_table, sign_info,
GSWE_SIGN_SCORPIO,
_("Scorpio"),
GSWE_ELEMENT_WATER,
GSWE_QUALITY_FIX
);
ADD_SIGN(gswe_sign_info_table, sign_info,
GSWE_SIGN_SAGITTARIUS,
_("Sagittarius"),
GSWE_ELEMENT_FIRE,
GSWE_QUALITY_MUTABLE
);
ADD_SIGN(gswe_sign_info_table, sign_info,
GSWE_SIGN_CAPRICORN,
_("Capricorn"),
GSWE_ELEMENT_EARTH,
GSWE_QUALITY_CARDINAL
);
ADD_SIGN(gswe_sign_info_table, sign_info,
GSWE_SIGN_AQUARIUS,
_("Aquarius"),
GSWE_ELEMENT_AIR,
GSWE_QUALITY_FIX
);
ADD_SIGN(gswe_sign_info_table, sign_info,
GSWE_SIGN_PISCES,
_("Pisces"),
GSWE_ELEMENT_WATER,
GSWE_QUALITY_MUTABLE
);
gswe_house_system_info_table = g_hash_table_new_full(
g_direct_hash, g_direct_equal,
NULL, (GDestroyNotify)gswe_house_system_info_unref
);
ADD_HOUSE_SYSTEM(gswe_house_system_info_table, house_system_info,
GSWE_HOUSE_SYSTEM_NONE,
0,
_("None")
);
ADD_HOUSE_SYSTEM(gswe_house_system_info_table, house_system_info,
GSWE_HOUSE_SYSTEM_PLACIDUS,
'P',
_("Placidus")
);
ADD_HOUSE_SYSTEM(gswe_house_system_info_table, house_system_info,
GSWE_HOUSE_SYSTEM_KOCH,
'K',
_("Koch")
);
ADD_HOUSE_SYSTEM(gswe_house_system_info_table, house_system_info,
GSWE_HOUSE_SYSTEM_EQUAL,
'E',
_("Equal")
);
gswe_aspect_info_table = g_hash_table_new_full(
g_direct_hash, g_direct_equal,
NULL, (GDestroyNotify)gswe_aspect_info_unref
);
// Note that because all aspects must be <= 180°, GSWE_ASPECT_NONE can
// never really exist. It is provided for name fetching purposes only.
ADD_ASPECT(gswe_aspect_info_table, aspect_info,
GSWE_ASPECT_NONE,
_("None"),
360,
4,
FALSE,
FALSE
);
ADD_ASPECT(gswe_aspect_info_table, aspect_info,
GSWE_ASPECT_CONJUCTION,
_("Conjuction"),
0,
0,
TRUE,
TRUE
);
ADD_ASPECT(gswe_aspect_info_table, aspect_info,
GSWE_ASPECT_OPPOSITION,
_("Opposition"),
180,
0,
TRUE,
TRUE
);
ADD_ASPECT(gswe_aspect_info_table, aspect_info,
GSWE_ASPECT_TRINE,
_("Trine"),
120,
0,
TRUE,
TRUE
);
ADD_ASPECT(gswe_aspect_info_table, aspect_info,
GSWE_ASPECT_SQUARE,
_("Square"),
90,
0,
FALSE,
TRUE
);
ADD_ASPECT(gswe_aspect_info_table, aspect_info,
GSWE_ASPECT_SEXTILE,
_("Sextile"),
60,
1,
TRUE,
TRUE
);
ADD_ASPECT(gswe_aspect_info_table, aspect_info,
GSWE_ASPECT_QUINCUNX,
_("Quincunx"),
150,
2,
FALSE,
FALSE
);
ADD_ASPECT(gswe_aspect_info_table, aspect_info,
GSWE_ASPECT_SEMISEXTILE,
_("Semi-sextile"),
30,
2,
TRUE,
FALSE
);
ADD_ASPECT(gswe_aspect_info_table, aspect_info,
GSWE_ASPECT_SEMISQUARE,
_("Semi-square"),
45,
2,
FALSE,
FALSE
);
ADD_ASPECT(gswe_aspect_info_table, aspect_info,
GSWE_ASPECT_SESQUISQUARE,
_("Sesqui-square"),
135,
2,
FALSE,
FALSE
);
ADD_ASPECT(gswe_aspect_info_table, aspect_info,
GSWE_ASPECT_QUINTILE,
_("Quintile"),
72,
3,
TRUE,
FALSE
);
ADD_ASPECT(gswe_aspect_info_table, aspect_info,
GSWE_ASPECT_BIQUINTILE,
_("Bi-quintile"),
144,
3,
TRUE,
FALSE
);
gswe_antiscion_axis_info_table = g_hash_table_new_full(
g_direct_hash, g_direct_equal,
NULL, (GDestroyNotify)gswe_antiscion_axis_info_unref
);
ADD_ANTISCION(gswe_antiscion_axis_info_table, antiscion_axis_info,
gswe_sign_info_table, sign_info,
GSWE_ANTISCION_AXIS_NONE,
_("None"),
GSWE_SIGN_NONE,
0.0
);
ADD_ANTISCION(gswe_antiscion_axis_info_table, antiscion_axis_info,
gswe_sign_info_table, sign_info,
GSWE_ANTISCION_AXIS_ARIES,
_("Aries/Libra"),
GSWE_SIGN_ARIES,
0.0
);
ADD_ANTISCION(gswe_antiscion_axis_info_table, antiscion_axis_info,
gswe_sign_info_table, sign_info,
GSWE_ANTISCION_AXIS_MID_TAURUS,
_("mid Taurus/Scorpio"),
GSWE_SIGN_TAURUS,
15.0
);
ADD_ANTISCION(gswe_antiscion_axis_info_table, antiscion_axis_info,
gswe_sign_info_table, sign_info,
GSWE_ANTISCION_AXIS_CANCER,
_("Cancer/Capricorn"),
GSWE_SIGN_CANCER,
0.0
);
ADD_ANTISCION(gswe_antiscion_axis_info_table, antiscion_axis_info,
gswe_sign_info_table, sign_info,
GSWE_ANTISCION_AXIS_MID_LEO,
_("mid Leo/Aquarius"),
GSWE_SIGN_LEO,
15.0
);
gswe_full_moon_base_date = gswe_timestamp_new_from_gregorian_full(
2005, 5, 8,
3, 48, 0, 0,
0.0
);
gswe_ephe_path = g_strdup(directory);
swe_set_ephe_path(directory);
gswe_initialized = TRUE;
}
/**
* gswe_init:
*
* Initializes the SWE-GLib library. It must be called before any calculations
* are made.
*/
void
gswe_init(void)
{
gswe_init_with_dir(PKGDATADIR);
}
/**
* gswe_find_planet_info_by_id:
* @planet: a planet ID registered with SWE-GLib
* @err: a GError
*
* Find the #GswePlanetInfo record registered with the id @planet.
*
* Since: 2.1
*/
GswePlanetInfo *
gswe_find_planet_info_by_id(GswePlanet planet, GError **err)
{
GswePlanetInfo *ret = g_hash_table_lookup(
gswe_planet_info_table,
GINT_TO_POINTER(planet)
);
if (ret == NULL) {
g_set_error(
err,
GSWE_ERROR, GSWE_ERROR_UNKNOWN_PLANET,
"Planet %d is not registered", planet
);
}
return ret;
}
/**
* gswe_find_sign_info_by_id:
* @sign: a sign ID registered with SWE-GLib
* @err: a GError
*
* Find the #GsweSignInfo record registered with the id @sign.
*
* Since: 2.1
*/
GsweSignInfo *
gswe_find_sign_info_by_id(GsweZodiac sign, GError **err)
{
GsweSignInfo *ret = g_hash_table_lookup(
gswe_sign_info_table,
GINT_TO_POINTER(sign)
);
if (ret == NULL) {
g_set_error(
err,
GSWE_ERROR, GSWE_ERROR_UNKNOWN_SIGN,
"Sign %d is not registered", sign
);
}
return ret;
}
/**
* gswe_find_house_system_info_by_id:
* @house_system: a house system ID registered with SWE-GLib
* @err: a GError
*
* Find the #GsweHouseSystemInfo record registered with the id @house_system.
*
* Since: 2.1
*/
GsweHouseSystemInfo *
gswe_find_house_system_info_by_id(GsweHouseSystem house_system, GError **err)
{
GsweHouseSystemInfo *ret = g_hash_table_lookup(
gswe_house_system_info_table,
GINT_TO_POINTER(house_system)
);
if (ret == NULL) {
g_set_error(
err,
GSWE_ERROR, GSWE_ERROR_UNKNOWN_HSYS,
"House system %d is not registered", house_system
);
}
return ret;
}
/**
* gswe_find_aspect_info_by_id:
* @aspect: an aspect ID registered with SWE-GLib
* @err: a GError
*
* Find the #GsweAspectInfo record registered with the id @aspect.
*
* Since: 2.1
*/
GsweAspectInfo *
gswe_find_aspect_info_by_id(GsweAspect aspect, GError **err)
{
GsweAspectInfo *ret = g_hash_table_lookup(
gswe_aspect_info_table,
GINT_TO_POINTER(aspect)
);
if (ret == NULL) {
g_set_error(
err,
GSWE_ERROR, GSWE_ERROR_UNKNOWN_ASPECT,
"Aspect system %d is not registered", aspect
);
}
return ret;
}
/**
* gswe_find_antiscion_axis_info_by_id:
* @antiscion_axis: an antiscion axis ID registered with SWE-GLib
* @err: a GError
*
* Find the #GsweAntiscionAxisInfo record registered with the id
* @antiscion_axis.
*
* Since: 2.1
*/
GsweAntiscionAxisInfo *
gswe_find_antiscion_axis_info_by_id(
GsweAntiscionAxis antiscion_axis,
GError **err)
{
GsweAntiscionAxisInfo *ret = g_hash_table_lookup(
gswe_antiscion_axis_info_table,
GINT_TO_POINTER(antiscion_axis)
);
if (ret == NULL) {
g_set_error(
err,
GSWE_ERROR, GSWE_ERROR_UNKNOWN_ANTISCION_AXIS,
"Antiscion axis system %d is not registered", antiscion_axis
);
}
return ret;
}
/**
* gswe_all_house_systems:
*
* Returns: (element-type GsweHouseSystemInfo) (transfer container):
* All #GsweHouseSystemInfo registered with SWE-GLib. The elements of
* this list should not be modified nor freed. The list is only valid
* until a new house system is registered.
*
* Since: 2.1.0
*/
GList *
gswe_all_house_systems(void)
{
return g_hash_table_get_values(gswe_house_system_info_table);
}
/**
* gswe_all_planets:
*
* Returns: (element-type GswePlanetInfo) (transfer container): All
* #GswePlanetInfo registered with SWE-GLib. The elements of this list
* should not be modified nor freed. The list is only valid until a
* new planet is registered.
*
* Since: 2.1.0
*/
GList *
gswe_all_planets(void)
{
return g_hash_table_get_values(gswe_planet_info_table);
}
/**
* gswe_all_aspects:
*
* Returns: (element-type GsweAspectInfo) (transfer container): All
* #GsweAspectInfo registered with SWE-GLib. The elements of this list
* should not be modified nor freed. The list is only valid until a
* new aspect is registered.
*
* Since: 2.1.0
*/
GList *
gswe_all_aspects(void)
{
return g_hash_table_get_values(gswe_aspect_info_table);
}
/**
* gswe_all_antiscion_axes:
*
* Returns: (element-type GsweAntiscionAxisInfo) (transfer container):
* All #GsweAntiscionAxisInfo registered with SWE-GLib. The elements
* of this list should not be modified nor freed. The list is only
* valid until a new antiscion axis is registered.
*
* Since: 2.1.0
*/
GList *
gswe_all_antiscion_axes(void)
{
return g_hash_table_get_values(gswe_antiscion_axis_info_table);
}

View File

@ -1,78 +0,0 @@
/* SWE-GLib - GLib style wrapper library around Astrodienst's Swiss Ephemeris
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __SWE_GLIB_H__
#define __SWE_GLIB_H__
#include <glib.h>
#include "gswe-types.h"
#include "gswe-moon-phase-data.h"
#include "gswe-sign-info.h"
#include "gswe-planet-info.h"
#include "gswe-planet-data.h"
#include "gswe-aspect-info.h"
#include "gswe-aspect-data.h"
#include "gswe-antiscion-axis-info.h"
#include "gswe-antiscion-data.h"
#include "gswe-house-system-info.h"
#include "gswe-house-data.h"
#include "gswe-timestamp.h"
#include "gswe-moment.h"
#include "gswe-enumtypes.h"
typedef enum {
GSWE_ERROR_SUCCESS,
GSWE_ERROR_SWE_NONFATAL,
GSWE_ERROR_SWE_FATAL,
GSWE_ERROR_INVALID_DATE,
GSWE_ERROR_INVALID_TIME,
GSWE_ERROR_NO_VALID_VALUE,
GSWE_ERROR_UNKNOWN_HSYS,
GSWE_ERROR_UNKNOWN_SIGN,
GSWE_ERROR_UNKNOWN_PLANET,
GSWE_ERROR_UNKNOWN_ANTISCION_AXIS,
GSWE_ERROR_UNKNOWN_ASPECT,
} GsweError;
#define GSWE_ERROR gswe_error_quark()
GQuark gswe_error_quark(void);
void gswe_init();
GswePlanetInfo *gswe_find_planet_info_by_id(GswePlanet planet, GError **err);
GsweSignInfo *gswe_find_sign_info_by_id(GsweZodiac sign, GError **err);
GsweHouseSystemInfo *gswe_find_house_system_info_by_id(
GsweHouseSystem house_system,
GError **err);
GsweAspectInfo *gswe_find_aspect_info_by_id(GsweAspect aspect, GError **err);
GsweAntiscionAxisInfo *gswe_find_antiscion_axis_info_by_id(
GsweAntiscionAxis antiscion_axis,
GError **err);
GList *gswe_all_house_systems(void);
GList *gswe_all_planets(void);
GList *gswe_all_aspects(void);
GList *gswe_all_antiscion_axes(void);
#endif /* __SWE_GLIB_H__ */

View File

@ -0,0 +1,69 @@
.highlight { background: #ffffff; }
.highlight .c { color: #999988; font-style: italic } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { font-weight: bold } /* Keyword */
.highlight .o { font-weight: bold } /* Operator */
.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */
.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .gd .x { color: #000000; background-color: #ffaaaa } /* Generic.Deleted.Specific */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #999999 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .gi .x { color: #000000; background-color: #aaffaa } /* Generic.Inserted.Specific */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #800080; font-weight: bold; } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { font-weight: bold } /* Keyword.Constant */
.highlight .kd { font-weight: bold } /* Keyword.Declaration */
.highlight .kn { font-weight: bold } /* Keyword.Namespace */
.highlight .kp { font-weight: bold } /* Keyword.Pseudo */
.highlight .kr { font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #009999 } /* Literal.Number */
.highlight .s { color: #d14 } /* Literal.String */
.highlight .na { color: #008080 } /* Name.Attribute */
.highlight .nb { color: #0086B3 } /* Name.Builtin */
.highlight .nc { color: #445588; font-weight: bold } /* Name.Class */
.highlight .no { color: #008080 } /* Name.Constant */
.highlight .ni { color: #800080 } /* Name.Entity */
.highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #990000; font-weight: bold } /* Name.Function */
.highlight .nn { color: #555555 } /* Name.Namespace */
.highlight .nt { color: #000080 } /* Name.Tag */
.highlight .nv { color: #008080 } /* Name.Variable */
.highlight .ow { font-weight: bold } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mf { color: #009999 } /* Literal.Number.Float */
.highlight .mh { color: #009999 } /* Literal.Number.Hex */
.highlight .mi { color: #009999 } /* Literal.Number.Integer */
.highlight .mo { color: #009999 } /* Literal.Number.Oct */
.highlight .sb { color: #d14 } /* Literal.String.Backtick */
.highlight .sc { color: #d14 } /* Literal.String.Char */
.highlight .sd { color: #d14 } /* Literal.String.Doc */
.highlight .s2 { color: #d14 } /* Literal.String.Double */
.highlight .se { color: #d14 } /* Literal.String.Escape */
.highlight .sh { color: #d14 } /* Literal.String.Heredoc */
.highlight .si { color: #d14 } /* Literal.String.Interpol */
.highlight .sx { color: #d14 } /* Literal.String.Other */
.highlight .sr { color: #009926 } /* Literal.String.Regex */
.highlight .s1 { color: #d14 } /* Literal.String.Single */
.highlight .ss { color: #990073 } /* Literal.String.Symbol */
.highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */
.highlight .vc { color: #008080 } /* Name.Variable.Class */
.highlight .vg { color: #008080 } /* Name.Variable.Global */
.highlight .vi { color: #008080 } /* Name.Variable.Instance */
.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */
.type-csharp .highlight .k { color: #0000FF }
.type-csharp .highlight .kt { color: #0000FF }
.type-csharp .highlight .nf { color: #000000; font-weight: normal }
.type-csharp .highlight .nc { color: #2B91AF }
.type-csharp .highlight .nn { color: #000000 }
.type-csharp .highlight .s { color: #A31515 }
.type-csharp .highlight .sc { color: #A31515 }

581
stylesheets/stylesheet.css Normal file
View File

@ -0,0 +1,581 @@
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
/* Style */
body {
font-size: 15px;
font-family: Arial, Arial, Helvetica, sans-serif;
line-height: 1.5;
background: #D1D1D1;
}
a {
color: #63a52a;
text-decoration: none;
-webkit-transition: color ease-in-out 0.3s;
}
a:hover {
text-decoration: underline;
color: #90D355;
}
h1.title {
margin: 30px 20px 10px;
font-size: 60px;
font-weight: bold;
font-style: italic;
font-family:Georgia, serif;
text-align: center;
}
.wrapper {
width: 675px;
margin: 0 auto;
}
#container {
border: 1px solid #2a2a2a;
background: #ddd url(../images/pattern.png);
box-shadow: 0 0 5px #b1b1b1;
}
p.tagline {
padding: 20px 20px 0;
color: #fff;
font-size: 17px;
}
#main {
margin-top: 20px;
padding: 0 20px 90px;
background-color: #fff;
}
.download-bar {
background: #222;
border: 5px solid #444;
padding: 10px;
margin: 0 -35px 20px;
position: relative;
}
.download-bar .inner {
overflow: hidden;
}
.download-bar .watch-fork iframe {
display: block;
float: left;
border-right: 1px solid #ddd;
padding-right: 5px;
}
.download-bar .watch-fork iframe.last {
border-right: 0 none;
padding-right: 0;
padding-left: 5px;
border-left: 1px solid #fff;
}
.download-bar .watch-fork {
overflow: hidden;
float: right;
background-color: #eee;
padding: 5px;
border-radius: 3px;
}
.download-bar .blc {
border: 10px solid black;
border-color: transparent transparent black;
width: 0;
height: 0;
display: block;
position: absolute;
bottom: -15px;
left: 0;
-moz-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
}
.download-bar .trc {
border: 10px solid black;
border-color: black transparent transparent;
width: 0;
height: 0;
display: block;
position: absolute;
top: -15px;
right: 0;
-moz-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
}
.download-bar .avatar {
border: 1px solid black;
display: block;
padding: 4px;
float: left;
}
.download-bar .avatar img {
display: block;
}
.download-bar a.code {
background: transparent url(../images/code.png) no-repeat 0 2px;
padding-left: 35px;
margin-top: 8px;
display: block;
float: left;
text-indent: 0;
width: auto;
height: auto;
opacity: 1;
-moz-opacity: 1;
filter:alpha(opacity=1);
}
.current-section {
position: fixed;
top: 0;
left: 50%;
width: 693px;
margin-left: -352px;
background: #222;
border: 5px solid #444;
color: #fff;
opacity: 0;
visibility: hidden;
-webkit-transition: opacity ease-in-out 0.3s;
}
.current-section p {
padding: 5px 27px;
font-size: 24px;
font-weight: bold;
}
.current-section a {
float: right;
text-indent: -10000px;
background: transparent url(../images/top.png) no-repeat 0 0;
width: 20px;
height: 20px;
opacity: 0.8;
margin-right: 12px;
margin-top: 12px;
-moz-opacity: 0.8;
filter:alpha(opacity=8);
-webkit-transition: opacity ease-in-out 0.3s;
}
.current-section a:hover {
opacity: 1;
-moz-opacity: 1;
filter:alpha(opacity=1);
}
.current-section a.zip {
margin-right: 8px;
}
a.zip,
a.zip span {
background: transparent url(../images/zip.png) no-repeat 0 0;
width: 30px;
height: 21px;
opacity: 0.8;
display: inline-block;
text-indent: -10000px;
-moz-opacity: 0.8;
filter:alpha(opacity=8);
-webkit-transition: opacity ease-in-out 0.3s;
}
a.tar,
a.tar span {
background: transparent url(../images/tar.png) no-repeat 0 0;
width: 30px;
height: 21px;
opacity: 0.8;
display: inline-block;
text-indent: -10000px;
-moz-opacity: 0.8;
filter:alpha(opacity=8);
-webkit-transition: opacity ease-in-out 0.3s;
}
a.code {
background: transparent url(../images/code.png) no-repeat 0 2px;
width: 30px;
height: 21px;
display: block;
opacity: 0.8;
display: inline-block;
text-indent: -10000px;
-moz-opacity: 0.8;
filter:alpha(opacity=8);
-webkit-transition: opacity ease-in-out 0.3s;
}
a.zip:hover,
a.tar:hover,
a.code:hover {
opacity: 1;
-moz-opacity: 1;
filter:alpha(opacity=1);
}
a.download-button {
border: 1px solid black;
border-radius: 3px;
display: inline-block;
text-indent: 0!important;
width: auto;
float: right;
background: #999; /* for non-css3 browsers */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#37ADD4', endColorstr='#1B657E'); /* for IE */
background: -webkit-gradient(linear, left top, left bottom, from(#37ADD4), to(#1B657E)); /* for webkit browsers */
background: -moz-linear-gradient(top, #37ADD4, #1B657E); /* for firefox 3.6+ */
height: auto;
margin-left: 10px;
}
a.download-button span {
background-position: 10px 5px;
width: auto;
height: auto;
padding: 5px 10px;
padding-left: 45px;
display: inline-block;
text-indent: 0!important;
color: #fff;
}
footer {
margin-bottom: 60px;
padding-bottom: 60px;
}
footer .owner {
background: #222;
border: 5px solid #444;
padding: 5px 15px;
margin: -67px -10px 35px;
color: #d6d6d6;
}
footer .creds small {
float: right;
font-size: 10px;
text-align: right;
margin-left: 15px;
}
footer .owner .avatar {
background-color: #666;
display: block;
margin: -19px 10px 0 0;
width: 60px;
float: left;
}
footer .owner img {
display: block;
border: 1px solid #2a2a2a;
margin: 5px;
}
footer .owner p {
font-family:Georgia, serif;
}
footer .owner p a {
font-size: 16px;
font-style: italic;
}
/* Markdown */
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6,
.markdown-body p,
.markdown-body pre,
.markdown-body ul,
.markdown-body ol,
.markdown-body dl,
.markdown-body table,
.markdown-body blockquote {
margin-bottom: 20px;
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
font-weight: bold;
}
.markdown-body h1 {
font-size: 28px;
}
.markdown-body h2 {
font-size: 24px;
color: #557398;
}
.markdown-body h3 {
font-size: 20px;
}
.markdown-body h4 {
font-size: 18px;
}
.markdown-body h5 {
font-size: 16px;
}
.markdown-body pre {
padding: 10px 70px 10px 0;
margin-left: -20px;
margin-right: -20px;
font-family: 'Monaco', 'Lucida Console', monospace;
font-size: 13px;
line-height: 20px;
box-shadow: inset 0 0 5px #000;
word-wrap: break-word;
background-color:#3b3b3b;
color: #d6d6d6;
}
.markdown-body pre.lines {
font-size: 12px;
margin:0 10px 0 -20px;
padding: 10px;
float: left;
display: block;
text-align: right;
box-shadow: none;
background-color:#2a2a2a;
color: #d6d6d6;
}
.markdown-body ul,
.markdown-body ol {
padding-left: 30px;
}
.markdown-body ul {
list-style-type: disc;
}
.markdown-body li,
.markdown-body li p,
.markdown-body dd,
.markdown-body dd p {
margin-bottom: 10px;
}
.markdown-body li pre,
.markdown-body li pre.lines,
.markdown-body dd pre,
.markdown-body dd pre.lines {
margin-left: -35px;
}
.markdown-body dt {
font-weight: bold;
font-style: italic;
}
.markdown-body dd {
margin-left: 15px;
}
.markdown-body table {
width: 673px;
margin-left: -20px;
margin-right: -20px;
}
.markdown-body tbody {
border-top: 2px solid #557398;
border-bottom: 2px solid #557398;
background-color: #EBEFF4;
}
.markdown-body table td * {
margin: 0;
}
.markdown-body td {
border-right: 1px solid #557398;
border-bottom: 1px solid #557398;
padding: 5px;
}
.markdown-body td:first-child,
.markdown-body th:first-child {
width: 30%;
padding-left: 20px;
}
.markdown-body td:last-child {
border-right: 0 none;
}
.markdown-body th {
font-size: 18px;
font-weight: bold;
text-align: left;
padding: 5px;
}
.markdown-body tt {
background-color:#3b3b3b;
color: #d6d6d6;
padding: 2px 3px;
}
.markdown-body blockquote {
font-style: italic;
font-family:Georgia, serif;
font-size: 17px;
border-top: 3px solid #333;
border-bottom: 3px solid #333;
padding: 10px 20px;
padding-left: 50px;
}
.markdown-body blockquote:before {
font-style: italic;
font-family: Georgia, serif;
font-size: 90px;
height: 90px;
margin-left: -60px;
margin-top: -25px;
content: "‟";
display: block;
float: left;
}
.markdown-body img {
max-width: 100%;
@include box-sizing(border-box);
}
.highlight { background: #ffffff; }
.highlight .c { color: #999988; font-style: italic } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { font-weight: bold } /* Keyword */
.highlight .o { font-weight: bold } /* Operator */
.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */
.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .gd .x { color: #000000; background-color: #ffaaaa } /* Generic.Deleted.Specific */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #999999 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .gi .x { color: #000000; background-color: #aaffaa } /* Generic.Inserted.Specific */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #800080; font-weight: bold; } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { font-weight: bold } /* Keyword.Constant */
.highlight .kd { font-weight: bold } /* Keyword.Declaration */
.highlight .kn { font-weight: bold } /* Keyword.Namespace */
.highlight .kp { font-weight: bold } /* Keyword.Pseudo */
.highlight .kr { font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #009999 } /* Literal.Number */
.highlight .s { color: #d14 } /* Literal.String */
.highlight .na { color: #008080 } /* Name.Attribute */
.highlight .nb { color: #0086B3 } /* Name.Builtin */
.highlight .nc { color: #445588; font-weight: bold } /* Name.Class */
.highlight .no { color: #008080 } /* Name.Constant */
.highlight .ni { color: #800080 } /* Name.Entity */
.highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #990000; font-weight: bold } /* Name.Function */
.highlight .nn { color: #555555 } /* Name.Namespace */
.highlight .nt { color: #000080 } /* Name.Tag */
.highlight .nv { color: #008080 } /* Name.Variable */
.highlight .ow { font-weight: bold } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mf { color: #009999 } /* Literal.Number.Float */
.highlight .mh { color: #009999 } /* Literal.Number.Hex */
.highlight .mi { color: #009999 } /* Literal.Number.Integer */
.highlight .mo { color: #009999 } /* Literal.Number.Oct */
.highlight .sb { color: #d14 } /* Literal.String.Backtick */
.highlight .sc { color: #d14 } /* Literal.String.Char */
.highlight .sd { color: #d14 } /* Literal.String.Doc */
.highlight .s2 { color: #d14 } /* Literal.String.Double */
.highlight .se { color: #d14 } /* Literal.String.Escape */
.highlight .sh { color: #d14 } /* Literal.String.Heredoc */
.highlight .si { color: #d14 } /* Literal.String.Interpol */
.highlight .sx { color: #d14 } /* Literal.String.Other */
.highlight .sr { color: #009926 } /* Literal.String.Regex */
.highlight .s1 { color: #d14 } /* Literal.String.Single */
.highlight .ss { color: #990073 } /* Literal.String.Symbol */
.highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */
.highlight .vc { color: #008080 } /* Name.Variable.Class */
.highlight .vg { color: #008080 } /* Name.Variable.Global */
.highlight .vi { color: #008080 } /* Name.Variable.Instance */
.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */

View File

@ -1,132 +0,0 @@
# SWE-GLib - GLib wrapper around the Swiss Ephemeris library
GTESTER = gtester
GTESTER_REPORT = gtester-report
NULL =
# initialize variables for unconditional += appending
BUILT_SOURCES =
BUILT_EXTRA_DIST =
CLEANFILES = *.log *.trs
DISTCLEANFILES =
MAINTAINERCLEANFILES =
EXTRA_DIST =
TEST_PROGS =
noinst_LTLIBRARIES =
noinst_PROGRAMS =
noinst_SCRIPTS =
noinst_DATA =
check_LTLIBRARIES =
check_PROGRAMS =
check_SCRIPTS =
check_DATA =
TESTS =
# test-nonrecursive: run tests only in cwd
if OS_UNIX
test-nonrecursive: ${TEST_PROGS}
@test -z "${TEST_PROGS}" || G_TEST_SRCDIR="$(abs_srcdir)" G_TEST_BUILDDIR="$(abs_builddir)" G_DEBUG=gc-friendly MALLOC_CHECK_=2 MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256)) ${GTESTER} --verbose ${TEST_PROGS}
else
test-nonrecursive:
endif
.PHONY: test-nonrecursive
.PHONY: lcov genlcov lcov-clean
# use recursive makes in order to ignore errors during check
lcov:
-$(MAKE) $(AM_MAKEFLAGS) -k check
$(MAKE) $(AM_MAKEFLAGS) genlcov
# we have to massage the lcov.info file slightly to hide the effect of libtool
# 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/\* ; \
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"
lcov-clean:
if test -n "$(LTP)"; then \
$(LTP) --quiet --directory $(top_builddir) -z; \
fi
# 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))
if OS_WIN32
TESTS += $(test_programs) $(test_scripts) $(uninstalled_test_programs) $(uninstalled_test_scripts) \
$(dist_test_scripts) $(dist_uninstalled_test_scripts)
endif
# Note: build even the installed-only targets during 'make check' to ensure that they still work.
# We need to do a bit of trickery here and manage disting via EXTRA_DIST instead of using dist_ prefixes to
# prevent automake from mistreating gmake functions like $(wildcard ...) and $(addprefix ...) as if they were
# filenames, including removing duplicate instances of the opening part before the space, eg. '$(addprefix'.
all_test_programs = $(test_programs) $(uninstalled_test_programs) $(installed_test_programs) \
$(test_extra_programs) $(uninstalled_test_extra_programs) $(installed_test_extra_programs)
all_test_scripts = $(test_scripts) $(uninstalled_test_scripts) $(installed_test_scripts) \
$(test_extra_scripts) $(uninstalled_test_extra_scripts) $(installed_test_extra_scripts)
all_dist_test_scripts = $(dist_test_scripts) $(dist_uninstalled_test_scripts) $(dist_installed_test_scripts) \
$(dist_test_extra_scripts) $(dist_uninstalled_test_extra_scripts) $(dist_installed_test_extra_scripts)
all_test_scripts += $(all_dist_test_scripts)
EXTRA_DIST += $(all_dist_test_scripts)
all_test_data = $(test_data) $(uninstalled_test_data) $(installed_test_data)
all_dist_test_data = $(dist_test_data) $(dist_uninstalled_test_data) $(dist_installed_test_data)
all_test_data += $(all_dist_test_data)
EXTRA_DIST += $(all_dist_test_data)
all_test_ltlibs = $(test_ltlibraries) $(uninstalled_test_ltlibraries) $(installed_test_ltlibraries)
check_LTLIBRARIES += $(all_test_ltlibs)
check_PROGRAMS += $(all_test_programs)
check_SCRIPTS += $(all_test_scripts)
check_DATA += $(all_test_data)

View File

@ -1,10 +0,0 @@
include $(top_srcdir)/swe-glib.mk
LDADD = $(top_builddir)/src/libswe-glib-2.0.la
DEFS = -DG_LOG_DOMAIN=\"SWE-GLib\"
AM_CPPFLAGS = $(GLIB_CFLAGS) $(GOBJECT_CFLAGS) $(LIBSWE_CFLAGS) -I$(top_srcdir)/src
AM_CFLAGS = -g
AM_LDFLAGS = $(GOBJECT_LIBS)
test_programs = gswe-timestamp-test
TESTS += $(test_programs)

View File

@ -1,327 +0,0 @@
#undef G_DISABLE_ASSERT
#include <glib.h>
#include <glib-object.h>
#include <swe-glib.h>
#include "test-asserts.h"
struct testdata_t {
gint year;
guint month;
guint day;
guint hour;
guint minute;
guint second;
guint ms;
gdouble tz;
gdouble jdet;
gdouble jdut;
gdouble jdsr;
};
static struct testdata_t td[] = {
{ 1983, 3, 7, 11, 54, 45, 948, 1.0, 2445400.954699264, 3, 4 },
{ 2013, 9, 1, 13, 52, 18, 419, 2.0, 2456536.994646754, 3, 4 },
{ 0 }
};
static void
test_timestamp_gregorian(void)
{
GsweTimestamp *timestamp;
GError *err = NULL;
gint year;
guint month, day, hour, minute, second, ms;
gdouble tz;
/* Create timestamp from testdata */
timestamp = gswe_timestamp_new_from_gregorian_full(
td[0].year, td[0].month, td[0].day,
td[0].hour, td[0].minute, td[0].second, td[0].ms,
td[0].tz
);
g_assert_nonnull(timestamp);
/* Check for Gregorian validity */
/* Set year, get year */
gswe_timestamp_set_gregorian_year(timestamp, td[1].year, &err);
g_assert_null(err);
year = gswe_timestamp_get_gregorian_year(timestamp, &err);
g_assert_null(err);
g_assert_cmpint(year, ==, td[1].year);
/* Set month, get month */
gswe_timestamp_set_gregorian_month(timestamp, td[1].month, &err);
g_assert_null(err);
month = gswe_timestamp_get_gregorian_month(timestamp, &err);
g_assert_null(err);
g_assert_cmpuint(month, ==, td[1].month);
/* Set day, get day */
gswe_timestamp_set_gregorian_day(timestamp, td[1].day, &err);
g_assert_null(err);
day = gswe_timestamp_get_gregorian_day(timestamp, &err);
g_assert_null(err);
g_assert_cmpuint(day, ==, td[1].day);
/* Set hour, get hour */
gswe_timestamp_set_gregorian_hour(timestamp, td[1].hour, &err);
g_assert_null(err);
hour = gswe_timestamp_get_gregorian_hour(timestamp, &err);
g_assert_null(err);
g_assert_cmpuint(hour, ==, td[1].hour);
/* Set minute, get minute */
gswe_timestamp_set_gregorian_minute(timestamp, td[1].minute, &err);
g_assert_null(err);
minute = gswe_timestamp_get_gregorian_minute(timestamp, &err);
g_assert_null(err);
g_assert_cmpuint(minute, ==, td[1].minute);
/* Set second, get second */
gswe_timestamp_set_gregorian_second(timestamp, td[1].second, &err);
g_assert_null(err);
second = gswe_timestamp_get_gregorian_second(timestamp, &err);
g_assert_null(err);
g_assert_cmpuint(second, ==, td[1].second);
/* Set ms, get ms */
gswe_timestamp_set_gregorian_microsecond(timestamp, td[1].ms, &err);
g_assert_null(err);
ms = gswe_timestamp_get_gregorian_microsecond(timestamp, &err);
g_assert_null(err);
g_assert_cmpuint(ms, ==, td[1].ms);
/* Set tz, get tz */
gswe_timestamp_set_gregorian_timezone(timestamp, td[1].tz, &err);
g_assert_null(err);
tz = gswe_timestamp_get_gregorian_timezone(timestamp);
g_assert_cmpfloat(tz, ==, td[1].tz);
/* Set full, check all */
gswe_timestamp_set_gregorian_full(
timestamp,
td[0].year, td[0].month, td[0].day,
td[0].hour, td[0].minute, td[0].second, td[0].ms,
td[0].tz,
&err
);
g_assert_null(err);
g_object_get(
timestamp,
"gregorian-year", &year,
"gregorian-month", &month,
"gregorian-day", &day,
"gregorian-hour", &hour,
"gregorian-minute", &minute,
"gregorian-second", &second,
"gregorian-microsecond", &ms,
"gregorian-timezone-offset", &tz,
NULL
);
g_assert_cmpint(year, ==, td[0].year);
g_assert_cmpuint(month, ==, td[0].month);
g_assert_cmpuint(day, ==, td[0].day);
g_assert_cmpuint(hour, ==, td[0].hour);
g_assert_cmpuint(minute, ==, td[0].minute);
g_assert_cmpuint(second, ==, td[0].second);
g_assert_cmpuint(ms, ==, td[0].ms);
g_assert_cmpfloat(tz, ==, td[0].tz);
g_clear_object(&timestamp);
}
static void
test_timestamp_timezone(void)
{
GsweTimestamp *timestamp;
gdouble tz, val_old, val_new;
guint hour, minute, second, ms;
GError *err = NULL;
/* Create timestamp */
timestamp = gswe_timestamp_new_from_gregorian_full(
td[0].year, td[0].month, td[0].day,
td[0].hour, td[0].minute, td[0].second, td[0].ms,
td[0].tz
);
g_assert_nonnull(timestamp);
/* Change timezone */
if (td[0].tz >= 23.0) {
tz = td[0].tz - 1;
} else {
tz = td[0].tz + 1;
}
/* Check hour, minute, second and microsecond */
val_old = (td[0].hour * 3600)
+ (td[0].minute * 60)
+ td[0].second
+ (td[0].ms / 1000.0);
gswe_timestamp_set_gregorian_timezone(timestamp, tz, &err);
g_assert_null(err);
g_object_get(
timestamp,
"gregorian-hour", &hour,
"gregorian-minute", &minute,
"gregorian-second", &second,
"gregorian-microsecond", &ms,
NULL
);
val_new = (hour * 3600)
+ (minute * 60)
+ second
+ (ms / 1000.0);
g_assert_cmpfloat(val_new, !=, val_old);
g_clear_object(&timestamp);
}
static void
test_timestamp_jdet(void)
{
GsweTimestamp *timestamp;
gdouble jdet;
GError *err = NULL;
/* Create timestamp */
timestamp = gswe_timestamp_new_from_julian_day(td[0].jdet);
g_assert_nonnull(timestamp);
/* Check value */
jdet = gswe_timestamp_get_julian_day_et(timestamp, &err);
g_assert_null(err);
gswe_assert_fuzzy_equals(jdet, td[0].jdet, 0.000001);
/* Set new value */
gswe_timestamp_set_julian_day_et(timestamp, td[1].jdet, &err);
g_assert_null(err);
/* Check value */
jdet = gswe_timestamp_get_julian_day_et(timestamp, &err);
g_assert_null(err);
gswe_assert_fuzzy_equals(jdet, td[1].jdet, 0.000001);
g_clear_object(&timestamp);
}
static void
test_timestamp_jdut(void)
{}
static void
test_timestamp_instant(void)
{
GsweTimestamp *timestamp;
gboolean instrecalc, greg_valid, jul_valid;
GError *err = NULL;
timestamp = gswe_timestamp_new_from_now_local();
g_assert_nonnull(timestamp);
g_object_get(
timestamp,
"instant-recalc", &instrecalc,
"gregorian-valid", &greg_valid,
"julian-day-valid", &jul_valid,
NULL);
g_assert_false(instrecalc);
g_assert_true(greg_valid);
g_assert_false(jul_valid);
g_object_set(timestamp, "instant-recalc", TRUE, NULL);
g_object_get(
timestamp,
"instant-recalc", &instrecalc,
"gregorian-valid", &greg_valid,
"julian-day-valid", &jul_valid,
NULL);
g_assert_true(instrecalc);
g_assert_true(greg_valid);
g_assert_true(jul_valid);
g_object_set(timestamp, "instant-recalc", FALSE, NULL);
gswe_timestamp_set_now_local(timestamp, &err);
g_assert_null(err);
g_object_get(
timestamp,
"instant-recalc", &instrecalc,
"gregorian-valid", &greg_valid,
"julian-day-valid", &jul_valid,
NULL);
g_assert_false(instrecalc);
g_assert_true(greg_valid);
g_assert_false(jul_valid);
}
static void
test_timestamp_conv_gregjd(void)
{
GsweTimestamp *timestamp;
gdouble jdet;
GError *err = NULL;
/* Create timestamp from testdata */
timestamp = gswe_timestamp_new_from_gregorian_full(
td[1].year, td[1].month, td[1].day,
td[1].hour, td[1].minute, td[1].second, td[1].ms,
td[1].tz
);
g_assert_nonnull(timestamp);
jdet = gswe_timestamp_get_julian_day_ut(timestamp, &err);
g_assert_null(err);
/* Allow 5ms of fuzzyness here */
gswe_assert_fuzzy_equals(
jdet,
td[1].jdet,
0.0001
);
g_clear_object(&timestamp);
}
static void
test_timestamp_conv_jdgreg(void)
{}
static void
test_timestamp_sidereal(void)
{}
static void
test_timestamp_now(void)
{}
int
main(int argc, char **argv)
{
g_test_init(&argc, &argv, NULL);
g_test_add_func("/gswe/timestamp/gregorian", test_timestamp_gregorian);
g_test_add_func("/gswe/timestamp/timezone", test_timestamp_timezone);
g_test_add_func("/gswe/timestamp/jdet", test_timestamp_jdet);
g_test_add_func("/gswe/timestamp/jdut", test_timestamp_jdut);
g_test_add_func("/gswe/timestamp/instant", test_timestamp_instant);
g_test_add_func("/gswe/timestamp/conv/greg_jd", test_timestamp_conv_gregjd);
g_test_add_func("/gswe/timestamp/conv/jd_greg", test_timestamp_conv_jdgreg);
g_test_add_func("/gswe/timestamp/sidereal", test_timestamp_sidereal);
g_test_add_func("/gswe/timestamp/now", test_timestamp_now);
return g_test_run();
}

View File

@ -1,66 +0,0 @@
#ifndef __SWE_GLIB_TEST_ASSERTS_H__
#define __SWE_GLIB_TEST_ASSERTS_H__
#include <glib.h>
/* Check equality with fuzzyness. Thanks for ebassi@GNOME and graphene */
#define gswe_assert_fuzzy_equals(n1,n2,epsilon) \
G_STMT_START { \
typeof ((n1)) __n1 = (n1); \
typeof ((n2)) __n2 = (n2); \
typeof ((epsilon)) __epsilon = (epsilon); \
if (__n1 > __n2) { \
if ((__n1 - __n2) <= __epsilon) ; else { \
g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
#n1 " == " #n2 " (+/- " #epsilon ")", \
__n1, "==", __n2, 'f'); \
} \
} else { \
if ((__n2 - __n1) <= __epsilon) ; else { \
g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
#n1 " == " #n2 " (+/- " #epsilon ")", \
__n1, "==", __n2, 'f'); \
} \
} \
} G_STMT_END
/* g_assert_null() and g_assert_nonnull() were defined in 2.36 and
* 2.40. Requiring a newer GLib just because of this would be an
* overkill, so let's just backport them:
*/
#ifndef g_assert_null
#define g_assert_null(expr) do { if G_LIKELY ((expr) == NULL) ; else \
g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
"'" #expr "' should be NULL"); \
} while (0)
#endif
#ifndef g_assert_nonnull
#define g_assert_nonnull(expr) do { if G_LIKELY ((expr) != NULL) ; else \
g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
"'" #expr "' should not be NULL"); \
} while (0)
#endif
/* g_assert_true() and g_assert_false() were defined in 2.38. Requiring
* a newer GLib just because of this would be an overkill, so let's just
* backport them:
*/
#ifndef g_assert_true
#define g_assert_true(expr) G_STMT_START { \
if G_LIKELY (expr) ; else \
g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
"'" #expr "' should be TRUE"); \
} G_STMT_END
#endif
#ifndef g_assert_false
#define g_assert_false(expr) G_STMT_START { \
if G_LIKELY (!(expr)) ; else \
g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
"'" #expr "' should be FALSE"); \
} G_STMT_END
#endif
#endif /* __SWE_GLIB_TEST_ASSERTS_H__ */