Compare commits
228 Commits
v1.0.4
...
arabic-lot
Author | SHA1 | Date | |
---|---|---|---|
316e6884f4 | |||
c0711d512d | |||
aed102ea11 | |||
ae1ba0a5e9 | |||
b3d335259c | |||
eedcc3fb3a | |||
b3345b1cd7 | |||
230ec75043 | |||
da90330152 | |||
92f3b7e957 | |||
f4b6bfe37d | |||
7b3a1ddeaf | |||
e394ffa15e | |||
dbfb734b1f | |||
a006498281 | |||
258dcc8356 | |||
9da6941f0a | |||
d87f5e98f7 | |||
e854485da3 | |||
5dc7240420 | |||
93d0fd68aa | |||
064d39b970 | |||
0886396879 | |||
27338c465f | |||
1c14b451fd | |||
6187d45177 | |||
b4612e1e89 | |||
a8844a3ed8 | |||
2a615e44c8 | |||
e850018d62 | |||
34ded1881f | |||
02703b7045 | |||
efa7b7fab3 | |||
bf5a839511 | |||
4d5866b405 | |||
714f3dbcb0 | |||
68351b2177 | |||
9b47d216e3 | |||
121357e863 | |||
|
fc1a6328f1 | ||
|
5b7124aca5 | ||
c461b743e4 | |||
|
c03f1eac6a | ||
820a41cb8f | |||
185c235b6b | |||
bf4fad5388 | |||
2dd4ea1ca7 | |||
46b6b86f88 | |||
0b190d47d0 | |||
385458d655 | |||
5b61a42976 | |||
9991269c8e | |||
b34fc1c8a0 | |||
510e440ef4 | |||
188a12d1ee | |||
a3a1dd0bd4 | |||
f21ce84b17 | |||
06fce9c9d5 | |||
366155b835 | |||
b981ed1b3b | |||
68994b8cb5 | |||
c9e382d04b | |||
fbc5a4e922 | |||
b77aae9f5c | |||
e16c4eca70 | |||
c10881fff1 | |||
aae1f06ed7 | |||
8bf5a49c4b | |||
68b46d2aee | |||
e621a2eda2 | |||
600712c901 | |||
dca2071c88 | |||
cb9cf3a4ce | |||
1225c5c8ed | |||
0caebd4f94 | |||
80b5da88a3 | |||
d5bea25e4d | |||
95e89a4c25 | |||
cb1fa1f67a | |||
078ff3370d | |||
66c8c3371c | |||
d2638adf8a | |||
4b61c453fd | |||
105cf7c83b | |||
8adfd0b966 | |||
8dd6eedb88 | |||
89baa44005 | |||
a50a967ad3 | |||
75a9318629 | |||
8a5d700d93 | |||
95face8294 | |||
fbf341dcec | |||
784987a2b6 | |||
07a351c373 | |||
55621bc25d | |||
a120b22861 | |||
c9a0944504 | |||
9d7eedb371 | |||
cd36bafe9c | |||
d3e4443922 | |||
6a69271007 | |||
b6071a4e46 | |||
21298fb219 | |||
243eac9de8 | |||
97dceeb45c | |||
45833584b7 | |||
26dcd74338 | |||
3296f9dfce | |||
eec99bcb05 | |||
de5ac1b63b | |||
97df73c64f | |||
2d75226310 | |||
ae3393133a | |||
903beaf2c2 | |||
e3a6e25bda | |||
6566e5356a | |||
cef7815268 | |||
12c08c865d | |||
2116c8103a | |||
8cd8cd67e2 | |||
f2bc764f87 | |||
b394e31f0a | |||
cbf2201249 | |||
0326770d73 | |||
a320abc71e | |||
0fb888a940 | |||
b689d3153d | |||
ddf4732dc9 | |||
fd24246bae | |||
2bdd8c3c60 | |||
6009ee908e | |||
2fa75d0906 | |||
41a80ca365 | |||
e23c789ff0 | |||
2a48f402b8 | |||
332110f449 | |||
e8819f9a47 | |||
551ea4cee0 | |||
fa1b4574e4 | |||
bd8c1532e7 | |||
367b777a2d | |||
695f5b96ae | |||
dd803b09f2 | |||
74cc121221 | |||
c4c9e2eced | |||
5f8939d730 | |||
7463b0e5cd | |||
e0893de2d2 | |||
371c123f17 | |||
95f085ea0a | |||
35a8101c91 | |||
70c240b0b3 | |||
c2a0b6bada | |||
cdcf6d1bf5 | |||
f41306a7ab | |||
8bcb9a8389 | |||
7704879c04 | |||
e81df2e4b0 | |||
8ae0c4de71 | |||
acedf464f4 | |||
f3c72120a7 | |||
d261e5ab4f | |||
c5a82b2aae | |||
5dcd5cdd17 | |||
20a350eacc | |||
bd54b5d37a | |||
a224f5ab99 | |||
54698df423 | |||
c78108ce84 | |||
4506e31946 | |||
981c91d702 | |||
2ec9bacf91 | |||
aa9e6db10c | |||
d96671508b | |||
0b15005e3a | |||
6d88993fa3 | |||
dc8146925d | |||
f92caa4e1a | |||
3a06d4bcee | |||
bc9ff2fc09 | |||
27ee3747ad | |||
6b712794c0 | |||
dbee248a6e | |||
7564183aa2 | |||
dcd58b5dd1 | |||
c5d8ee49eb | |||
2dbbd428c1 | |||
8cdcda19f8 | |||
6d84d650b5 | |||
84195964ab | |||
b73ac78f17 | |||
16003cebe9 | |||
8f52abadf0 | |||
a1f8d1f7da | |||
347dae00d3 | |||
5365133de2 | |||
60b51c2ed2 | |||
9ee5569bb1 | |||
20c3aafe85 | |||
39ddb2ee0e | |||
ebeaf1eb4d | |||
886ff03353 | |||
1b0f831333 | |||
e06c73c23d | |||
6ee6650d84 | |||
eb5b3fff5d | |||
d4015cae75 | |||
3fd8c200e0 | |||
9a788f8164 | |||
8044519535 | |||
0e17962278 | |||
14bef9eb06 | |||
4767e7eb98 | |||
54cbcd9bc9 | |||
444c545776 | |||
c395c7f7ea | |||
197f6922c7 | |||
6e96142160 | |||
e7bd73fdc1 | |||
a5a29c7c33 | |||
fc6f7ea159 | |||
835dfddccd | |||
20aacb8c6d | |||
a918338bdf | |||
67979d9890 | |||
4f61aea449 | |||
cac67e57e3 | |||
ac012aada2 |
22
.gitignore
vendored
22
.gitignore
vendored
@@ -14,6 +14,7 @@
|
||||
/.dirstamp
|
||||
*.gir
|
||||
*.typelib
|
||||
*.gschema.valid
|
||||
ChangeLog
|
||||
|
||||
# Files created by the build tools
|
||||
@@ -51,6 +52,17 @@ Makefile.in
|
||||
/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
|
||||
@@ -76,11 +88,14 @@ Makefile.in
|
||||
/intltool-update.in
|
||||
|
||||
# SWE-GLib related files
|
||||
src/gswe-enumtypes.c
|
||||
src/gswe-enumtypes.h
|
||||
src/gswetest
|
||||
/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/*/*.args
|
||||
@@ -95,7 +110,6 @@ src/gswetest
|
||||
/docs/reference/*/*-overrides.txt
|
||||
/docs/reference/*/*-undeclared.txt
|
||||
/docs/reference/*/version.xml
|
||||
/docs/reference/*/*-sections.txt
|
||||
/docs/reference/*/*-undocumented.txt
|
||||
/docs/reference/*/*-unused.txt
|
||||
/docs/reference/*/xml/
|
||||
|
17
.travis.yml
Normal file
17
.travis.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
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
|
14
Makefile.am
14
Makefile.am
@@ -1,15 +1,21 @@
|
||||
include $(top_srcdir)/swe-glib.mk
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
SUBDIRS = swe swe/src swe/doc src po docs/reference/swe-glib data
|
||||
SUBDIRS = swe swe/src swe/doc 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
|
||||
EXTRA_DIST += $(intltool_extra) $(header_DATA) autogen.sh
|
||||
|
||||
DISTCLEANFILES = intltool-extract intltool-merge intltool-update
|
||||
DISTCLEANFILES += intltool-extract intltool-merge intltool-update
|
||||
|
||||
MAINTAINERCLEANFILES = ChangeLog
|
||||
MAINTAINERCLEANFILES += ChangeLog
|
||||
|
||||
distclean-local:
|
||||
if test "$(srcdir)" = "."; then :; else \
|
||||
|
92
README.md
92
README.md
@@ -1,26 +1,38 @@
|
||||
# SWE-GLib
|
||||
|
||||
SWE-GLib is a GLib style wrapper library around Astrodienst's [Swiss Ephemeris library](http://www.astro.com/swisseph/).
|
||||
[](https://travis-ci.org/gergelypolonkai/swe-glib)
|
||||
[](https://codecov.io/github/gergelypolonkai/swe-glib?branch=master)
|
||||
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
|
||||
### Initialization
|
||||
|
||||
First of all, you have to initialize the library:
|
||||
|
||||
```c
|
||||
gswe_init();
|
||||
```
|
||||
### Creating the required objects
|
||||
|
||||
Then you need to create a `GsweTimestamp` object:
|
||||
@@ -70,11 +82,13 @@ 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.
|
||||
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()`:
|
||||
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);
|
||||
@@ -82,30 +96,60 @@ 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 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.
|
||||
> 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).
|
||||
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 marked as 1.0. This means that API and ABI changes are very unlikely to happen.
|
||||
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 Earth"s surface) calculations yet.
|
||||
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.
|
||||
|
||||
### 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:
|
||||
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
|
||||
* `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.
|
||||
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).
|
||||
|
51
autogen.sh
51
autogen.sh
@@ -13,10 +13,51 @@ PKG_NAME="swe-glib"
|
||||
exit 1
|
||||
}
|
||||
|
||||
which gnome-autogen.sh || {
|
||||
echo "gnome-autogen.sh not found, you need to install gnome-common"
|
||||
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
|
||||
|
||||
REQUIRED_AUTOMAKE_VERSION=1.9 . gnome-autogen.sh
|
||||
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" "$@"
|
||||
|
||||
|
143
configure.ac
143
configure.ac
@@ -1,17 +1,33 @@
|
||||
m4_define([swe_glib_major_version], [1])
|
||||
m4_define([swe_glib_minor_version], [0])
|
||||
m4_define([swe_glib_micro_version], [3])
|
||||
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])
|
||||
AC_ARG_ENABLE(debug, [AC_HELP_STRING([--enable-debug], [compile with debugging support])], , enable_debug=no)
|
||||
|
||||
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])
|
||||
@@ -20,6 +36,7 @@ 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
|
||||
@@ -33,15 +50,117 @@ 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])
|
||||
PKG_CHECK_MODULES([GLIB], [glib-2.0])
|
||||
PKG_CHECK_MODULES([GOBJECT], [gobject-2.0])
|
||||
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"
|
||||
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_LIBS='$(top_builddir)/swe/src/libswe-1.75.la'
|
||||
LIBSWE_LIBS='$(top_builddir)/swe/src/libswe-$(SWE_VERSION).la'
|
||||
AC_SUBST(LIBSWE_LIBS)
|
||||
|
||||
LIBSWE_GLIB_LIBS='$(top_builddir)/src/libswe-glib-$(SWE_GLIB_API_VERSION).la'
|
||||
@@ -55,9 +174,15 @@ AC_CONFIG_FILES([
|
||||
src/Makefile
|
||||
data/Makefile
|
||||
po/Makefile.in
|
||||
docs/reference/swe-glib/version.xml
|
||||
docs/reference/swe-glib/Makefile
|
||||
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
|
||||
|
@@ -1,6 +1,14 @@
|
||||
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@
|
||||
|
||||
swephdir = $(pkgdatadir)
|
||||
sweph_DATA = \
|
||||
sweph-data/seas_00.se1 \
|
||||
@@ -57,9 +65,24 @@ sweph_DATA = \
|
||||
sweph-data/seplm42.se1 \
|
||||
sweph-data/seplm48.se1 \
|
||||
sweph-data/seplm54.se1 \
|
||||
sweph-data/seleapsec.txt \
|
||||
sweph-data/s136199.se1 \
|
||||
sweph-data/s136199s.se1 \
|
||||
sweph-data/se00010s.se1 \
|
||||
sweph-data/se00034s.se1 \
|
||||
sweph-data/se00157s.se1 \
|
||||
sweph-data/se07066s.se1 \
|
||||
sweph-data/se08405s.se1 \
|
||||
sweph-data/se10199s.se1 \
|
||||
sweph-data/se90377.se1 \
|
||||
sweph-data/se90377s.se1 \
|
||||
sweph-data/se90482.se1 \
|
||||
sweph-data/se90482s.se1 \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(sweph_DATA) \
|
||||
swe-glib.spec
|
||||
swe-glib.spec \
|
||||
gschema.template
|
||||
|
||||
DISTCLEANFILES = $(gsettings_SCHEMAS)
|
||||
|
22
data/gschema.template
Normal file
22
data/gschema.template
Normal file
@@ -0,0 +1,22 @@
|
||||
/*** 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 ***/
|
312
data/lots.py
Normal file
312
data/lots.py
Normal file
@@ -0,0 +1,312 @@
|
||||
# -*- coding: utf8
|
||||
|
||||
import re
|
||||
import logging
|
||||
from collections import OrderedDict
|
||||
|
||||
|
||||
def get_planet_name(planet):
|
||||
if planet == 'ASC':
|
||||
return 'ASCENDANT'
|
||||
|
||||
if planet == 'S. Node':
|
||||
return 'MOON_SOUTH_NODE'
|
||||
|
||||
if planet.upper() in known_planets:
|
||||
return planet.upper()
|
||||
|
||||
return None
|
||||
|
||||
|
||||
def get_planet_def(planet):
|
||||
PLANET_NAME = 0
|
||||
CUSP = 1
|
||||
RULER = 2
|
||||
SIGN = 3
|
||||
SIGN_DEGREE = 4
|
||||
SIGN_MINUTE = 5
|
||||
HOUSE_RULER = 6
|
||||
ARABIC_LOT = 7
|
||||
PLANET_HOUSE_RULER = 8
|
||||
|
||||
planet_def = [
|
||||
get_planet_name(planet), # 0, PLANET_NAME
|
||||
0, # 1, CUSP
|
||||
None, # 2, RULER
|
||||
None, # 3, SIGN
|
||||
0, # 4, SIGN_DEGREE
|
||||
0, # 5, SIGN_MINUTE
|
||||
0, # 6, HOUSE_RULER
|
||||
None, # 7, ARABIC_LOT
|
||||
None, # 8, PLANET_HOUSE_RULER
|
||||
]
|
||||
|
||||
sign_match = re.match(r'^(\d{2})([A-Z]{2})(\d{2})$', planet)
|
||||
|
||||
if planet_def[PLANET_NAME] is None:
|
||||
if planet.startswith('Ruler of ') and \
|
||||
get_planet_name(planet[9:]) is not None:
|
||||
planet_def[RULER] = get_planet_name(planet[9:])
|
||||
elif planet.startswith('Ruler '):
|
||||
m1 = re.match(r'Ruler (\d+)(st|nd|rd|th)', planet)
|
||||
m2 = re.match(r"Ruler (\w+)'s house", planet)
|
||||
|
||||
if m1 is not None:
|
||||
planet_def[HOUSE_RULER] = int(m1.groups()[0])
|
||||
|
||||
elif m2 is not None:
|
||||
planet_def[PLANET_HOUSE_RULER] = get_planet_name(
|
||||
m2.groups()[0])
|
||||
|
||||
if planet_def[PLANET_HOUSE_RULER] is None:
|
||||
logging.error(
|
||||
"Error: planet house ruler definition error: {}"
|
||||
.format(planet))
|
||||
|
||||
return None
|
||||
else:
|
||||
logging.error(
|
||||
"Error: House ruler definition problem: {}"
|
||||
.format(planet))
|
||||
|
||||
return None
|
||||
elif planet.startswith('Cusp '):
|
||||
m = re.match(r'^Cusp (\d+)(st|nd|rd|th)', planet)
|
||||
|
||||
if m is None:
|
||||
logging.error("Cusp definition problem: {}"
|
||||
.format(planet))
|
||||
|
||||
return None
|
||||
|
||||
planet_def[CUSP] = int(m.groups()[0])
|
||||
elif sign_match is not None:
|
||||
degree, sign, minute = sign_match.groups()
|
||||
|
||||
planet_def[SIGN] = next(s for s in signs if s.startswith(sign))
|
||||
planet_def[SIGN_DEGREE] = int(degree)
|
||||
planet_def[SIGN_MINUTE] = int(minute)
|
||||
elif planet.startswith('PO '):
|
||||
p_lot = planet[3:]
|
||||
|
||||
if not any(x['c_name'] for y, x in lots.items()
|
||||
if p_lot.upper() == x['c_name']):
|
||||
logging.error("Error: Unknown lot: {}".format(planet))
|
||||
|
||||
return None
|
||||
|
||||
planet_def[ARABIC_LOT] = p_lot.upper()
|
||||
else:
|
||||
logging.error("Unknown planet definition: {}".format(planet))
|
||||
|
||||
return None
|
||||
|
||||
planet_def = map(lambda x: 'NONE' if x is None else x, planet_def)
|
||||
|
||||
return """
|
||||
{{
|
||||
GSWE_PLANET_{name},
|
||||
{cusp},
|
||||
GSWE_PLANET_{ruler},
|
||||
GSWE_SIGN_{sign}, {sign_degree}, {sign_minute},
|
||||
{house_ruler},
|
||||
GSWE_ARABIC_LOT_{arabic_lot},
|
||||
GSWE_PLANET_{planet_house_ruler}
|
||||
}}""".format(
|
||||
name=planet_def[PLANET_NAME],
|
||||
cusp=planet_def[CUSP],
|
||||
ruler=planet_def[RULER],
|
||||
sign=planet_def[SIGN],
|
||||
sign_degree=planet_def[SIGN_DEGREE],
|
||||
sign_minute=planet_def[SIGN_MINUTE],
|
||||
house_ruler=planet_def[HOUSE_RULER],
|
||||
arabic_lot=planet_def[ARABIC_LOT],
|
||||
planet_house_ruler=planet_def[PLANET_HOUSE_RULER],
|
||||
)
|
||||
|
||||
with open('lots.txt', 'r') as f:
|
||||
content = map(lambda line: line.strip(), f.readlines())
|
||||
|
||||
lots = OrderedDict()
|
||||
c_names = set()
|
||||
known_planets = [
|
||||
'MC',
|
||||
'VERTEX',
|
||||
'MOON_NODE',
|
||||
'MOON_APOGEE',
|
||||
'SUN',
|
||||
'MOON',
|
||||
'MERCURY',
|
||||
'VENUS',
|
||||
'EARTH',
|
||||
'MARS',
|
||||
'JUPITER',
|
||||
'SATURN',
|
||||
'URANUS',
|
||||
'NEPTUNE',
|
||||
'PLUTO',
|
||||
'CHIRON',
|
||||
'CERES',
|
||||
'PALLAS',
|
||||
'JUNO',
|
||||
'VESTA',
|
||||
'PHOLUS',
|
||||
'NESSUS',
|
||||
'CHARIKLO',
|
||||
'SEDNA',
|
||||
'ERIS',
|
||||
'DEJANIRA',
|
||||
'CIRCE',
|
||||
'ORCUS',
|
||||
'ASBOLUS',
|
||||
'HYGIEA',
|
||||
]
|
||||
signs = [
|
||||
'ARIES',
|
||||
'TAURUS',
|
||||
'GEMINI',
|
||||
'CANCER',
|
||||
'LEO',
|
||||
'VIRGO',
|
||||
'LIBRA',
|
||||
'SCORPIO',
|
||||
'SAGITTARIUS',
|
||||
'CAPRICORN',
|
||||
'AQUARIUS',
|
||||
'PISCES',
|
||||
]
|
||||
|
||||
while content:
|
||||
line = content.pop(0)
|
||||
|
||||
m = re.match('^([^=]+) = (.*)$', line)
|
||||
|
||||
if not m:
|
||||
print("Error in line (no lot name): {}".format(line))
|
||||
|
||||
continue
|
||||
|
||||
lot_name, line = m.groups()
|
||||
|
||||
line = line.strip()
|
||||
am_pm_rule = False
|
||||
|
||||
if re.search('AM.*::.*PM', line):
|
||||
am_pm_rule = True
|
||||
line = line.split(' :: ')[0]
|
||||
s = re.search(' \([AP]M\)$', line)
|
||||
if s is None:
|
||||
print("Error in AM/PM line: {}".format(line))
|
||||
|
||||
continue
|
||||
|
||||
line = line[:-5]
|
||||
|
||||
m = re.match('^([^-+]+) ([+-]) ([^-+]+) ([+-]) ([^-+]+)$', line)
|
||||
|
||||
if not m:
|
||||
print("Error in line (doesn't match): {}".format(line))
|
||||
continue
|
||||
|
||||
m = m.groups()
|
||||
|
||||
if m[1] != '+' and m[3] != '-':
|
||||
print("Error in line: {}".format(line))
|
||||
|
||||
continue
|
||||
|
||||
if lot_name in lots and not am_pm_rule:
|
||||
print("Lot {} already exists!".format(lot_name))
|
||||
|
||||
continue
|
||||
|
||||
lot_name_def = re.sub(r'[^A-Z0-9_]', '',
|
||||
re.sub(r'[ ,]+', '_', lot_name.upper()))
|
||||
|
||||
if lot_name_def in c_names:
|
||||
print("Lot {} already exists in enum!".format(lot_name_def))
|
||||
|
||||
lots[lot_name] = {
|
||||
"c_name": lot_name_def,
|
||||
"planets": (m[0], m[2], m[4]),
|
||||
"am_pm": am_pm_rule,
|
||||
}
|
||||
|
||||
enum = '''typedef enum _GsweArabicLot {
|
||||
GSWE_ARABIC_LOT_NONE,\n'''
|
||||
|
||||
defs = '''typedef struct _GsweArabicLotPart {
|
||||
GswePlanet planet;
|
||||
guint8 cusp;
|
||||
GswePlanet ruler;
|
||||
GsweZodiac fixed_sign;
|
||||
guint8 fixed_degree;
|
||||
guint8 fixed_minute;
|
||||
guint8 house_ruler;
|
||||
GsweArabicLot arabic_lot;
|
||||
GswePlanet planet_house_ruler;
|
||||
} GsweArabicLotPart;
|
||||
|
||||
typedef struct _GsweArabicLotRecord {
|
||||
gchar *name;
|
||||
gboolean am_pm_rule;
|
||||
|
||||
GsweArabicLotPart parts[3];
|
||||
} GsweArabicLotRecord;
|
||||
|
||||
static const GsweArabicLotRecord known_lots[] = {
|
||||
'''
|
||||
|
||||
for idx, (lot_name, lot) in enumerate(lots.items()):
|
||||
if idx != 0:
|
||||
enum += ',\n'
|
||||
defs += '\n'
|
||||
|
||||
enum += ' GSWE_ARABIC_LOT_' + lot['c_name']
|
||||
|
||||
defs += ' // Record for enum value ' + lot['c_name'] + '''
|
||||
{
|
||||
"''' + lot_name + '''",
|
||||
''' + ("TRUE" if lot['am_pm'] else "FALSE") + ''',
|
||||
{'''
|
||||
|
||||
for pidx, planet in enumerate(lot['planets']):
|
||||
defs += get_planet_def(planet)
|
||||
|
||||
if pidx != 2:
|
||||
defs += ','
|
||||
|
||||
defs += '''\n }
|
||||
},\n'''
|
||||
|
||||
defs += ''' {NULL}
|
||||
};'''
|
||||
|
||||
enum += '\n} GsweArabicLot;'
|
||||
|
||||
print("""/* gswe-lots.h - Arabic lot definitions 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_LOTS_H__
|
||||
#define __GSWE_LOTS_H__
|
||||
|
||||
#include "gswe-types.h"
|
||||
""" + enum + """
|
||||
|
||||
""" + defs + """
|
||||
|
||||
#endif /* __GSWE_LOTS_H__ */""")
|
109
data/lots.txt
Normal file
109
data/lots.txt
Normal file
@@ -0,0 +1,109 @@
|
||||
Fortune = ASC + Moon - Sun (AM) :: ASC + Sun - Moon (PM)
|
||||
Ability = ASC + Mars - Ruler of ASC
|
||||
Abundance = ASC + Sun - Moon
|
||||
Accident = ASC + Saturn - Mars
|
||||
Accomplishment = ASC + Sun - Jupiter
|
||||
Action/Reasoning = ASC + Mars - Mercury
|
||||
Addiction = ASC + S. Node - Neptune
|
||||
Administrators = ASC + Mars - Mercury
|
||||
Agriculture = ASC + Saturn - Venus
|
||||
Allegiance = ASC + Saturn - Sun
|
||||
Ancestors/Relations = ASC + Mars - Saturn (AM) :: ASC + Saturn - Mars (PM)
|
||||
Ancestral Heritage = ASC + Moon - Cusp 8th
|
||||
Armies = ASC + Saturn - Mars
|
||||
Art = ASC + Venus - Mercury
|
||||
Assassination (1) = ASC + Ruler 12th - Neptune
|
||||
Assassination (2) = Mars + Neptune - Uranus
|
||||
Assurance = ASC + Jupiter - Mercury
|
||||
Astrology = ASC + Uranus - Mercury
|
||||
Bad Luck = ASC + PO Fortune - PO Spirit
|
||||
Bankruptcy (1) = Jupiter + Neptune - Uranus
|
||||
Bankruptcy (2) = Jupiter + Jupiter - Uranus
|
||||
Beauty = ASC + Venus - Sun
|
||||
Benific Change = ASC + Pluto - Jupiter
|
||||
Benevolence = ASC + Jupiter - Pluto
|
||||
Business Partnerships = ASC + Cusp 7th - Ruler 10th
|
||||
Cancer = ASC + Neptune - Jupiter
|
||||
Catastrophe (1) = ASC + Uranus - Sun
|
||||
Catastrophe (2) = ASC + Uranus - Saturn
|
||||
Caution = ASC + Neptune - Saturn
|
||||
Children = ASC + Saturn - Jupiter (AM) :: ASC + Jupiter - Saturn (PM)
|
||||
Commerce (1) = ASC + Mercury - Sun
|
||||
Commerce (2) = ASC + Mars - Sun
|
||||
Controversy = ASC + Jupiter - Mars
|
||||
Corruptness = ASC + Neptune - Venus
|
||||
Curiosity = ASC + Moon - Mercury
|
||||
Damage = ASC + Neptune - Venus
|
||||
Danger, Violence, Debt = ASC + Mercury - Saturn (AM) :: ASC + Saturn - Mercury (PM)
|
||||
Daughters = ASC + Venus - Moon
|
||||
Death = ASC + Cusp 8th - Moon
|
||||
Death (Parents) = ASC + Jupiter - Saturn (AM) :: ASC + Saturn - Jupiter (PM)
|
||||
Debt = ASC + Mercury - Saturn (AM) :: ASC + Saturn - Mercury (PM)
|
||||
Desire, Sexual Attraction = ASC + Cusp 5th + Ruler 5th
|
||||
Destiny = MC + Sun - Moon (AM) :: MC + Mooon - Sun (PM)
|
||||
Destruction = ASC + Mars - Sun
|
||||
Disease = ASC + Mars - Mercury
|
||||
Divorce (1) = ASC + Venus - Cusp 7th
|
||||
Divorce (2) = ASC + Cusp 7th - Saturn
|
||||
Eccentricity = ASC + Mercury - Uranus
|
||||
Energy, Sex Drive = ASC + Pluto - Venus
|
||||
Expected Birth (1) = ASC + Ruler Moon's house - Moon
|
||||
Expected Birth (2) = ASC + Venus - Moon
|
||||
Fame = ASC + Jupiter - Sun (AM) :: ASC + Sun - Jupiter (PM)
|
||||
Famous Friends = ASC + PO Fortune - Sun
|
||||
Fascination = ASC + Venus - Uranus
|
||||
Fate (Karma) = ASC + Saturn - Sun
|
||||
Father = ASC + Sun - Saturn (AM) :: ASC + Saturn - Sun (PM)
|
||||
Fraud = ASC + Neptune - Sun
|
||||
Friends (1) = ASC + Moon - Venus
|
||||
Friends (2) = ASC + Mercury - Moon
|
||||
Friends (3) = ASC + Moon - Uranus
|
||||
Genius = ASC + Sun - Neptune
|
||||
Grandparents (1) = ASC + Jupiter - Cusp 2nd (AM) :: ASC + Cusp 2nd - Jupiter (PM)
|
||||
Grandparents (2) = ASC + Saturn - Cusp 2nd (AM) :: ASC + Cusp 2nd - Saturn (PM)
|
||||
Guidance = ASC + Neptune - Uranus
|
||||
Happiness = ASC + Uranus - Jupiter
|
||||
Homosexuality = ASC + Mars - Uranus
|
||||
Horsemanship = ASC + Moon - Saturn
|
||||
Identity = ASC + Saturn - Moon
|
||||
Imprisonment = ASC + Sun - Neptune
|
||||
Increase = ASC + Jupiter - Sun
|
||||
Inheritance (1) = ASC + Moon - Saturn
|
||||
Inheritance (2) = ASC + Jupiter - Venus
|
||||
Journeys (Air) = ASC + Uranus - Cusp 9th
|
||||
Journeys (Land) = ASC + Cusp 9th - Ruler 9th
|
||||
Journeys (Water) = ASC + 15CA00 + Saturn (AM) :: ASC + Saturn - 15CA00 (PM)
|
||||
Kings, Rulers = ASC + Moon - Mercury
|
||||
Knowledge = ASC + Moon - Mercury (AM) :: ASC + Mercury - Moon (PM)
|
||||
Life, Reincarnation = ASC + Saturn - Jupiter (AM) :: ASC + Jupiter - Saturn (PM)
|
||||
Love = ASC + Venus - Sun
|
||||
Lovers = Mars + Venus - Cusp 5th
|
||||
Luck = ASC + Moon - Jupiter
|
||||
Marriage = ASC + Cusp 7th - Venus
|
||||
Marriage of Woman (1) = ASC + Saturn - Venus
|
||||
Marriage of Woman (2) = ASC + Mars - Moon
|
||||
Marriage of Man (1) = ASC + Venus - Saturn
|
||||
Marriage of Man (2) = ASC + Venus - Sun
|
||||
Mother = ASC + Moon - Saturn
|
||||
Partners = ASC + Cusp 7th - Venus
|
||||
Peril = ASC + Cusp 8th - Saturn (AM) :: ASC + Saturn - Cusp 8th (PM)
|
||||
Possessions = ASC + Cusp 2nd - Ruler 2nd
|
||||
Real Estate (Land) = ASC + Moon - Saturn (AM) :: ASC + Saturn - Moon (PM)
|
||||
Real Estate (Investment) = ASC + Jupiter - Mercury (AM) :: ASC + Mercury - Jupiter (PM)
|
||||
Secret Enemies = ASC + Moon - Saturn
|
||||
Short Journeys = ASC + Cusp 3rd - Ruler 3rd
|
||||
Siblings = ASC + Saturn - Jupiter
|
||||
Sickness = ASC + Mars - Saturn
|
||||
Son-in-Laws = ASC + Venus - Saturn (AM) :: ASC + Saturn - Venus (PM)
|
||||
Sons = Cusp 4th + Moon - Sun
|
||||
Spirit = ASC + Sun - Moon (AM) :: ASC + Moon - Sun (PM)
|
||||
Success = ASC + Jupiter - PO Fortune (AM) :: ASC + PO Fortune - Jupiter (PM)
|
||||
Success (Investment) = ASC + Venus - Saturn
|
||||
Suicide (1) = ASC + Cusp 8th - Neptune
|
||||
Suicide (2) = ASC + Jupiter - Neptune
|
||||
Surgery = ASC + Saturn - Mars (AM) :: ASC + Mars - Saturn (PM)
|
||||
Tragedy = ASC + Saturn - Sun
|
||||
Unusual Events = ASC + Uranus - Moon
|
||||
Victory = ASC + Jupiter - PO Spirit (AM) :: ASC + PO Spirit - Jupiter (PM)
|
||||
Weddings, Legal Contracts = Cusp 9th + Cusp 3rd - Venus
|
||||
Widowhood = ASC + 08LI50 - Neptune
|
@@ -6,7 +6,7 @@ Summary: A GLib style wrapper library around the Swiss Ephemeris library, create
|
||||
Group: Development/Libraries
|
||||
License: LGPLv3+
|
||||
URL: http://gergely.polonkai.eu/swe-glib/
|
||||
Source: https://github.com/gergelypolonkai/%{name}/archive/v%{version}.tar.gz
|
||||
Source: http://gergely.polonkai.eu/download/%{name}-%{version}.tar.gz
|
||||
|
||||
BuildRequires: pkgconfig
|
||||
BuildRequires: glib2-devel
|
||||
@@ -70,12 +70,13 @@ rm -f $RPM_BUILD_ROOT%{_datadir}/locale/hu/LC_MESSAGES/swe-glib.mo
|
||||
|
||||
%files
|
||||
%doc ChangeLog
|
||||
%{_libdir}/libswe-1.75.so.*
|
||||
%{_libdir}/libswe-glib-1.0.so.*
|
||||
%{_libdir}/girepository-1.0/SweGlib-1.0.typelib
|
||||
%{_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/*
|
||||
@@ -83,9 +84,10 @@ rm -f $RPM_BUILD_ROOT%{_datadir}/locale/hu/LC_MESSAGES/swe-glib.mo
|
||||
%files devel
|
||||
%{_includedir}/*
|
||||
%{_libdir}/pkgconfig/*
|
||||
%{_datadir}/gir-1.0/SweGlib-1.0.gir
|
||||
%{_libdir}/libswe-1.75.so
|
||||
%{_libdir}/libswe-glib-1.0.so
|
||||
%{_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
|
||||
|
||||
|
BIN
data/sweph-data/s136199.se1
Normal file
BIN
data/sweph-data/s136199.se1
Normal file
Binary file not shown.
BIN
data/sweph-data/s136199s.se1
Normal file
BIN
data/sweph-data/s136199s.se1
Normal file
Binary file not shown.
BIN
data/sweph-data/se00010s.se1
Normal file
BIN
data/sweph-data/se00010s.se1
Normal file
Binary file not shown.
BIN
data/sweph-data/se00034s.se1
Normal file
BIN
data/sweph-data/se00034s.se1
Normal file
Binary file not shown.
BIN
data/sweph-data/se00157s.se1
Normal file
BIN
data/sweph-data/se00157s.se1
Normal file
Binary file not shown.
BIN
data/sweph-data/se07066s.se1
Normal file
BIN
data/sweph-data/se07066s.se1
Normal file
Binary file not shown.
BIN
data/sweph-data/se08405s.se1
Normal file
BIN
data/sweph-data/se08405s.se1
Normal file
Binary file not shown.
BIN
data/sweph-data/se10199s.se1
Normal file
BIN
data/sweph-data/se10199s.se1
Normal file
Binary file not shown.
BIN
data/sweph-data/se90377.se1
Normal file
BIN
data/sweph-data/se90377.se1
Normal file
Binary file not shown.
BIN
data/sweph-data/se90377s.se1
Normal file
BIN
data/sweph-data/se90377s.se1
Normal file
Binary file not shown.
BIN
data/sweph-data/se90482.se1
Normal file
BIN
data/sweph-data/se90482.se1
Normal file
Binary file not shown.
BIN
data/sweph-data/se90482s.se1
Normal file
BIN
data/sweph-data/se90482s.se1
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
393347
data/sweph-data/seasnam.txt
Normal file
393347
data/sweph-data/seasnam.txt
Normal file
File diff suppressed because it is too large
Load Diff
31
data/sweph-data/seleapsec.txt
Normal file
31
data/sweph-data/seleapsec.txt
Normal file
@@ -0,0 +1,31 @@
|
||||
# This file contains the dates of leap seconds to be taken into account
|
||||
# by the Swiss Ephemeris.
|
||||
# For each new leap second add the date of its insertion in the format
|
||||
# yyyymmdd, e.g. "20081231" for 21 december 2008
|
||||
19720630
|
||||
19721231
|
||||
19731231
|
||||
19741231
|
||||
19751231
|
||||
19761231
|
||||
19771231
|
||||
19781231
|
||||
19791231
|
||||
19810630
|
||||
19820630
|
||||
19830630
|
||||
19850630
|
||||
19871231
|
||||
19891231
|
||||
19901231
|
||||
19920630
|
||||
19930630
|
||||
19949630
|
||||
19951231
|
||||
19970630
|
||||
19981231
|
||||
20051231
|
||||
20081231
|
||||
20120630
|
||||
20150630
|
||||
20161231
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
76
data/sweph-data/seorbel.txt
Normal file
76
data/sweph-data/seorbel.txt
Normal file
@@ -0,0 +1,76 @@
|
||||
# Orbital elements of ficticious planets
|
||||
# 27 Jan. 2000
|
||||
#
|
||||
# This file is part of the Swiss Ephemeris, from Version 1.52 on.
|
||||
#
|
||||
# Warning! These planets do not exist!
|
||||
#
|
||||
# The user can add his or her own elements.
|
||||
# 960 is the maximum number of ficticious planets.
|
||||
#
|
||||
# The elements order is as follows:
|
||||
# 1. epoch of elements (Julian day)
|
||||
# 2. equinox (Julian day or "J1900" or "B1950" or "J2000")
|
||||
# 3. mean anomaly at epoch
|
||||
# 4. semi-axis
|
||||
# 5. eccentricity
|
||||
# 6. argument of perihelion (ang. distance of perihelion from node)
|
||||
# 7. ascending node
|
||||
# 8. inclination
|
||||
# 9. name of planet
|
||||
#
|
||||
# use '#' for comments
|
||||
# to compute a body with swe_calc(), use planet number
|
||||
# ipl = SE_FICT_OFFSET_1 + number_of_elements_set,
|
||||
# e.g. number of Kronos is ipl = 39 + 4 = 43
|
||||
#
|
||||
# Witte/Sieggruen planets, refined by James Neely
|
||||
J1900, J1900, 163.7409, 40.99837, 0.00460, 171.4333, 129.8325, 1.0833, Cupido # 1
|
||||
J1900, J1900, 27.6496, 50.66744, 0.00245, 148.1796, 161.3339, 1.0500, Hades # 2
|
||||
J1900, J1900, 165.1232, 59.21436, 0.00120, 299.0440, 0.0000, 0.0000, Zeus # 3
|
||||
J1900, J1900, 169.0193, 64.81690, 0.00305, 208.8801, 0.0000, 0.0000, Kronos # 4
|
||||
J1900, J1900, 138.0533, 70.29949, 0.00000, 0.0000, 0.0000, 0.0000, Apollon # 5
|
||||
J1900, J1900, 351.3350, 73.62765, 0.00000, 0.0000, 0.0000, 0.0000, Admetos # 6
|
||||
J1900, J1900, 55.8983, 77.25568, 0.00000, 0.0000, 0.0000, 0.0000, Vulcanus # 7
|
||||
J1900, J1900, 165.5163, 83.66907, 0.00000, 0.0000, 0.0000, 0.0000, Poseidon # 8
|
||||
#
|
||||
# Isis-Transpluto; elements from "Die Sterne" 3/1952, p. 70ff.
|
||||
# Strubell does not give an equinox. 1945 is taken in order to
|
||||
# reproduce the as best as ASTRON ephemeris. (This is a strange
|
||||
# choice, though.)
|
||||
# The epoch according to Strubell is 1772.76.
|
||||
# 1772 is a leap year!
|
||||
# The fraction is counted from 1 Jan. 1772
|
||||
2368547.66, 2431456.5, 0.0, 77.775, 0.3, 0.7, 0, 0, Isis-Transpluto # 9
|
||||
# Nibiru, elements from Christian Woeltge, Hannover
|
||||
1856113.380954, 1856113.380954, 0.0, 234.8921, 0.981092, 103.966, -44.567, 158.708, Nibiru # 10
|
||||
# Harrington, elements from Astronomical Journal 96(4), Oct. 1988
|
||||
2374696.5, J2000, 0.0, 101.2, 0.411, 208.5, 275.4, 32.4, Harrington # 11
|
||||
# according to W.G. Hoyt, "Planets X and Pluto", Tucson 1980, p. 63
|
||||
2395662.5, 2395662.5, 34.05, 36.15, 0.10761, 284.75, 0, 0, Leverrier (Neptune) # 12
|
||||
2395662.5, 2395662.5, 24.28, 37.25, 0.12062, 299.11, 0, 0, Adams (Neptune) # 13
|
||||
2425977.5, 2425977.5, 281, 43.0, 0.202, 204.9, 0, 0, Lowell (Pluto) # 14
|
||||
2425977.5, 2425977.5, 48.95, 55.1, 0.31, 280.1, 100, 15, Pickering (Pluto) # 15
|
||||
# intramercurian hypothetical Vulcan acc. to L.H. Weston
|
||||
J1900,JDATE, 252.8987988 + 707550.7341 * T, 0.13744, 0.019, 322.212069+1670.056*T, 47.787931-1670.056*T, 7.5, Vulcan # 16
|
||||
# Selena/White Moon
|
||||
J2000,JDATE, 242.2205555 + 5143.5418158 * T, 0.05280098949, 0.0, 0.0, 0.0, 0.0, Selena/White Moon, geo # 17
|
||||
# Hypothetical planet Proserpina, according to http://www.geocities.com/Hollywood/Academy/7519/proserpina.html
|
||||
# J1900, 170.73 + 51.05 * T
|
||||
J1900,JDATE, 170.73, 79.225630, 0, 0, 0, 0, Proserpina #18
|
||||
# Waldemath's Second Earth Moon
|
||||
# Elements were derived by D.Koch from Waldemaths original elements as given in
|
||||
# David Walters' book on Vulcan. They differ from Solar Fire (Graham Dawsons)
|
||||
# elements, which are based on the assumption that the "mean longitude" given
|
||||
# by Waldemath is an observation (a true longitude)
|
||||
# Neither Swisseph nor Solar fire elements agree with Delphine Jay's ephemeris,
|
||||
# which is obviously wrong.
|
||||
2414290.95827875,2414290.95827875, 70.3407215 + 109023.2634989 * T, 0.0068400705250028, 0.1587, 8.14049594 + 2393.47417444 * T, 136.24878256 - 1131.71719709 * T, 2.5, Waldemath, geo # 19
|
||||
#
|
||||
# The following elements are for test only
|
||||
# (Selena without T)
|
||||
J2000,JDATE, 242.2205555, 0.05279142865925, 0.0, 0.0, 0.0, 0.0, Selena/White Moon, geo # 17
|
||||
# (Selena with T, gives exactly the same position)
|
||||
J2000,JDATE, 242.2205555 + 5143.5418158 * T, 0.05279142865925, 0.0, 0.0, 0.0, 0.0, Selena/White Moon with T Terms, geo # 17
|
||||
J2000, JDATE, 174.794787 + 149472.5157715 * T, 0.38709831, 0.20563175 + 0.000020406 * T, 29.125226 + 0.3702885 * T, 48.330893 + 1.186189 * T, 7.004986 + 0.0018215 * T, Mercury elem. for equ. of date # 18
|
||||
J2000, J2000, 174.794787 + 149472.5157715 * T, 0.38709831, 0.20563175 + 0.000020406 * T, 29.125226 + 0.2842872 * T, 48.330893 - 0.1254229 * T, 7.004986 - 0.0059516 * T, Mercury Test J2000 Elements# 18
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -29,7 +29,7 @@ SCANGOBJ_OPTIONS=
|
||||
|
||||
# Extra options to supply to gtkdoc-scan.
|
||||
# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED"
|
||||
SCAN_OPTIONS=--rebuild-sections --rebuild-types
|
||||
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
|
||||
@@ -58,7 +58,20 @@ 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
|
||||
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
|
||||
@@ -86,12 +99,12 @@ include $(top_srcdir)/gtk-doc.make
|
||||
|
||||
# Other files to distribute
|
||||
# e.g. EXTRA_DIST += version.xml.in
|
||||
EXTRA_DIST +=
|
||||
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 +=
|
||||
DISTCLEANFILES = $(DOC_MODULE).types
|
||||
|
||||
# Comment this out if you want 'make check' to test you doc status
|
||||
# and run some sanity checks
|
||||
|
@@ -19,9 +19,20 @@
|
||||
<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">
|
||||
|
331
docs/reference/swe-glib/swe-glib-sections.txt
Normal file
331
docs/reference/swe-glib/swe-glib-sections.txt
Normal file
@@ -0,0 +1,331 @@
|
||||
<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>
|
52
examples/basic.js
Normal file
52
examples/basic.js
Normal file
@@ -0,0 +1,52 @@
|
||||
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)));
|
||||
}
|
||||
}
|
44
examples/basic.lua
Normal file
44
examples/basic.lua
Normal file
@@ -0,0 +1,44 @@
|
||||
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
|
55
examples/basic.pl
Normal file
55
examples/basic.pl
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/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());
|
||||
}
|
||||
}
|
44
examples/basic.py
Normal file
44
examples/basic.py
Normal file
@@ -0,0 +1,44 @@
|
||||
# -*- 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())
|
2
po/hu.po
2
po/hu.po
@@ -86,7 +86,7 @@ msgid "Dark Moon"
|
||||
msgstr "Sötét Hold"
|
||||
|
||||
#: ../src/swe-glib.c:133
|
||||
msgid "Ascendent"
|
||||
msgid "Ascendant"
|
||||
msgstr "Aszcendens"
|
||||
|
||||
#: ../src/swe-glib.c:134
|
||||
|
@@ -1,49 +1,98 @@
|
||||
## 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-1.0.la
|
||||
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
|
||||
gswe-timestamp.h \
|
||||
$(NULL)
|
||||
|
||||
INST_H_BUILT_FILES = \
|
||||
gswe-enumtypes.h
|
||||
gswe-enumtypes.h \
|
||||
gswe-lots.h \
|
||||
gswe-version.h \
|
||||
$(NULL)
|
||||
|
||||
gswe_headers = gswe-timestamp.h gswe-types.h
|
||||
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)
|
||||
|
||||
libswe_glib_1_0_la_SOURCES = \
|
||||
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 \
|
||||
gswe-lots.c \
|
||||
$(NULL)
|
||||
|
||||
libswe_glib_2_0_la_CFLAGS = $(GLIB_CFLAGS) $(GOBJECT_CFLAGS) -Wall
|
||||
libswe_glib_2_0_la_LIBADD = $(GLIB_LIBS) $(GOBJECT_LIBS) $(LIBSWE_LIBS)
|
||||
libswe_glib_2_0_la_DEPENDENCIES = \
|
||||
$(NULL)
|
||||
libswe_glib_1_0_la_CFLAGS = $(GLIB_CFLAGS) $(GOBJECT_CFLAGS) -Wall
|
||||
libswe_glib_1_0_la_LIBADD = $(GLIB_LIBS) $(GOBJECT_LIBS) $(LIBSWE_LIBS)
|
||||
|
||||
BUILT_SOURCES = gswe-enumtypes.c gswe-enumtypes.h
|
||||
|
||||
CLEANFILES = $(BUILT_SOURCES)
|
||||
|
||||
EXTRA_DIST = gswe-enumtypes.h.template gswe-enumtypes.c.template swe-glib-private.h $(INST_H_SRC_FILES)
|
||||
EXTRA_DIST = gswe-enumtypes.h.template gswe-enumtypes.c.template $(PRIV_H_SRC_FILES) $(INST_H_SRC_FILES)
|
||||
|
||||
gswe-enumtypes.h: $(gswe_headers) gswe-enumtypes.h.template
|
||||
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_headers) gswe-enumtypes.h gswe-enumtypes.c.template
|
||||
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-1.0.la
|
||||
SweGlib_@SWE_GLIB_API_VERSION_U@_gir_FILES = $(INST_H_SRC_FILES) $(INST_H_BUILT_FILES) $(filter %.c,$(libswe_glib_1_0_la_SOURCES))
|
||||
SweGlib_@SWE_GLIB_API_VERSION_U@_gir_LIBS = libswe-glib-1.0.la
|
||||
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)
|
||||
@@ -58,14 +107,15 @@ typelibs_DATA = SweGlib-$(SWE_GLIB_API_VERSION).typelib
|
||||
|
||||
headerdir = $(includedir)/swe-glib
|
||||
header_DATA = \
|
||||
swe-glib.h \
|
||||
gswe-types.h \
|
||||
gswe-enumtypes.h \
|
||||
gswe-moment.h \
|
||||
gswe-timestamp.h \
|
||||
$(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
|
||||
|
46
src/gswe-antiscion-axis-info-private.h
Normal file
46
src/gswe-antiscion-axis-info-private.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/* 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__ */
|
||||
|
290
src/gswe-antiscion-axis-info.c
Normal file
290
src/gswe-antiscion-axis-info.c
Normal file
@@ -0,0 +1,290 @@
|
||||
/* 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;
|
||||
}
|
||||
|
88
src/gswe-antiscion-axis-info.h
Normal file
88
src/gswe-antiscion-axis-info.h
Normal file
@@ -0,0 +1,88 @@
|
||||
/* 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__ */
|
||||
|
48
src/gswe-antiscion-data-private.h
Normal file
48
src/gswe-antiscion-data-private.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/* 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__ */
|
||||
|
425
src/gswe-antiscion-data.c
Normal file
425
src/gswe-antiscion-data.c
Normal file
@@ -0,0 +1,425 @@
|
||||
/* 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;
|
||||
}
|
||||
|
78
src/gswe-antiscion-data.h
Normal file
78
src/gswe-antiscion-data.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/* 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__ */
|
||||
|
51
src/gswe-aspect-data-private.h
Normal file
51
src/gswe-aspect-data-private.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* 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__ */
|
350
src/gswe-aspect-data.c
Normal file
350
src/gswe-aspect-data.c
Normal file
@@ -0,0 +1,350 @@
|
||||
/* 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;
|
||||
}
|
||||
|
76
src/gswe-aspect-data.h
Normal file
76
src/gswe-aspect-data.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/* 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__ */
|
||||
|
53
src/gswe-aspect-info-private.h
Normal file
53
src/gswe-aspect-info-private.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/* 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__ */
|
||||
|
282
src/gswe-aspect-info.c
Normal file
282
src/gswe-aspect-info.c
Normal file
@@ -0,0 +1,282 @@
|
||||
/* 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_info’s 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;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user