116 Commits
v2.0.3 ... main

Author SHA1 Message Date
e03ed37133 Remove the bundled Swiss Ephemeris library 2021-04-27 08:42:06 +02:00
aadf4a280e Add GTK-Doc’s .actions file to .gitignore 2021-04-27 08:25:47 +02:00
827a8f3641 Allow using LTP 1.14 2021-04-27 08:24:45 +02:00
2879fa72cd Fix location of @filename@ in gswe-enumtypes.c.template 2021-04-25 06:20:54 +02:00
Gergely Polonkai
4e53c0c771 Add opposing points: DESC, MC, ANTIVERTEX
Solves #4
2016-09-29 08:42:02 +02:00
c0711d512d Add possibility to calculate Moon South Node position 2016-09-20 15:23:47 +02:00
aed102ea11 Update to Swiss Ephemeris 2.04 2016-07-25 12:42:52 +02:00
ae1ba0a5e9 Merge branch 'master' into testing 2015-11-24 12:31:34 +01:00
b3d335259c Backport g_assert_true() and g_assert_false()
These macros were defined in 2.38, but SWE-GLib depends on
2.32. Requiring a newer version solely for this would be an overkill, so
let’s just backport them.
2015-11-24 12:27:35 +01:00
eedcc3fb3a Create test for GsweTimestamp::instant-recalc 2015-11-24 12:14:22 +01:00
b3345b1cd7 Fix gswe_timestamp_set_now_local()
It calculated the timezone offset wrong (for 1.0 hour it became 1000.0).
2015-11-24 12:06:30 +01:00
230ec75043 Add codecov support 2015-11-23 19:38:06 +01:00
da90330152 Fix tests 2015-11-23 16:53:16 +01:00
92f3b7e957 Merge branch 'master' into testing
Conflicts:
	tests/Makefile.am
2015-11-23 16:51:57 +01:00
f4b6bfe37d Add build status badge 2015-09-14 11:18:42 +02:00
7b3a1ddeaf Move to container based Travis 2015-09-14 11:16:25 +02:00
e394ffa15e Upgrade to Swiss Ephemeris 2.02.01 2015-09-13 15:35:49 +02:00
dbfb734b1f Revert "Move to container based Travis"
This reverts commit a006498281.

SWE-GLib cannot use container based tests, as the gnome-common package
is disallowed.

Issue travis-ci/apt-package-whitelist#1103 has been opened to resolve
this dependency.
2015-09-03 08:42:11 +00:00
a006498281 Move to container based Travis 2015-09-03 08:31:43 +00:00
258dcc8356 Fix .travis.yml 2015-09-03 07:39:33 +00:00
9da6941f0a Fix tests Makefile.am
It couldn’t run tests due to missing CFLAGS and LDADD parameters.
2015-09-03 07:27:20 +00:00
d87f5e98f7 Restructure README file 2015-09-02 14:27:04 +00:00
e854485da3 Merge branch 'master' into testing 2015-01-12 10:17:35 +01:00
5dc7240420 Add leap second for 2015 2015-01-12 09:57:55 +01:00
93d0fd68aa Backport g_assert_null() and g_assert_nonnull()
These were added in newer GLibbversions, but upgrading requirements
just because of these would be an overkill.
2014-11-18 08:04:35 +01:00
064d39b970 Begin refactoring GsweTimestamp tests 2014-11-18 00:43:29 +01:00
0886396879 Move gswe_timestamp_new_from_julian_day() to g_object_new() call 2014-11-18 00:42:17 +01:00
27338c465f Update Travis CI config 2014-11-17 17:21:45 +01:00
1c14b451fd Remove GLib-specific names from configure.ac
Code coverage reports were migrated from GLib sources, and some names remained
2014-11-17 13:33:23 +01:00
6187d45177 Make TimestampValidity public with name GsweTimestampValidityFlags 2014-11-17 13:32:54 +01:00
b4612e1e89 Update .gitignore with more testing related files 2014-11-17 13:22:23 +01:00
a8844a3ed8 Merge branch 'master' into testing 2014-11-17 13:20:47 +01:00
2a615e44c8 Remove unnecessary notifications upon GsweTimestamp creation 2014-11-17 13:17:07 +01:00
e850018d62 Add GsweTimestamp::julian-day property
It was somehow missing from the property list
2014-11-17 11:27:26 +01:00
34ded1881f Fix instant-recalc property change handling
Despite the actual value, only the gswe_timestamp_calculate_all() was called.
2014-11-14 17:57:10 +01:00
02703b7045 Add code coverage support 2014-11-13 17:30:16 +01:00
efa7b7fab3 Remove double free for some GsweMoment internal lists 2014-11-13 01:13:39 +01:00
bf5a839511 Add more guards to aspect calculations
gswe_aspect_data_calculate() may get called if the currently set
planet is NULL
2014-11-13 01:13:11 +01:00
4d5866b405 Add missing g_free in gswe_antiscion_data_free() 2014-11-13 01:12:24 +01:00
714f3dbcb0 Add LUA example 2014-11-04 16:35:16 +01:00
68351b2177 Unify output of example scripts 2014-11-04 16:35:16 +01:00
9b47d216e3 Unify coordinates in example scripts 2014-11-04 16:35:16 +01:00
121357e863 Remove unnecessary Data::Dumper use from Perl example 2014-11-04 16:35:16 +01:00
gitolite tester
fc1a6328f1 Add full UTF-8 support to Perl example 2014-11-01 01:31:25 +01:00
gitolite tester
5b7124aca5 Protect Gswe*Data from NULL pointers 2014-11-01 01:24:06 +01:00
c461b743e4 Create GSettings schema with the available enum types 2014-10-31 23:19:26 +01:00
gitolite tester
c03f1eac6a Code beautification 2014-10-31 19:12:35 +01:00
820a41cb8f Protect gswe_house_data_unref() from NULL pointers 2014-10-31 18:47:43 +01:00
185c235b6b Remove unnecessary g_object_unref() in gswe_moment_dispose() 2014-10-31 18:43:53 +01:00
bf4fad5388 Add signal GsweMoment::planet-added 2014-10-07 23:25:24 +02:00
2dd4ea1ca7 Add a variable to save the handler of the timestamp changed signal 2014-10-07 23:24:11 +02:00
46b6b86f88 Fix type during signal registering 2014-10-07 23:23:32 +02:00
0b190d47d0 Add GObject notifications to GsweMoment 2014-10-02 01:25:37 +02:00
385458d655 Make GsweTimestamp emit the changed signal only if something really changed 2014-10-02 00:13:31 +02:00
5b61a42976 Change warning messages so the user may know if it is fatal 2014-09-24 18:54:43 +02:00
9991269c8e Remove SEGFAULT possibility from gswe_moment_calculate_planet() 2014-09-24 18:52:46 +02:00
b34fc1c8a0 Fix condition for checking double pointer 2014-09-24 11:34:27 +02:00
510e440ef4 Add gswe_all_(planets|aspects|antiscion_axes) functions 2014-09-22 00:20:05 +02:00
188a12d1ee Fix untested bugs
Data file path and enum generation failed after last commit
2014-09-02 16:10:18 +02:00
a3a1dd0bd4 Add data files for asteroids 2014-09-02 15:28:53 +02:00
f21ce84b17 Merge pull request #16 from gergelypolonkai/bug-15
Add error reporting to add_points()
2014-09-02 12:47:30 +02:00
06fce9c9d5 Add error reporting to add_points()
It is possible that planet_data->sign_info is NULL, which results in
a SEGFAULT.
2014-09-02 11:56:10 +02:00
366155b835 Apply Law of Demeter to add_points() 2014-09-02 11:51:03 +02:00
b981ed1b3b Add gswe_timestamp_new_now_local() and gswe_timestamp_set_now_local()
Fixes #14
2014-08-14 14:59:07 +02:00
68994b8cb5 Code beautification in GsweTimestamp header 2014-08-14 12:15:27 +02:00
c9e382d04b Remove ./configure from travis.yml
configure is invoket by autogen.sh already, due to jhbuild compatibility
2014-08-13 18:29:02 +02:00
fbc5a4e922 Revert "Remove make check from Travis config"
This reverts commit cb9cf3a4ce.
The make check problem has been fixed since then
2014-08-13 01:06:46 +02:00
b77aae9f5c Fix GsweTimestamp tests 2014-08-13 00:56:48 +02:00
e16c4eca70 Code beautification 2014-08-13 00:55:31 +02:00
c10881fff1 Sending "notify" signals upon property change 2014-08-13 00:55:22 +02:00
aae1f06ed7 Setting Gregorian timezone now invalidates Gregorian date
* It calculates Julian Day beforehands, so a valid date remains in
  timestamp
* gswe_timestamp_set_gregorian_timezone() doesn’t emit the "changed"
  signal any more
2014-08-13 00:54:15 +02:00
8bf5a49c4b Store property GParamSpecs in an array for notify emission 2014-08-13 00:51:26 +02:00
68b46d2aee Add configure invocation to autogen.sh
Without this, jhbuild fails to install SWE-GLib
2014-08-01 21:28:40 +02:00
e621a2eda2 Add element-type to gswe_all_house_systems documentation 2014-07-16 22:55:14 +02:00
600712c901 Add gswe_all_house_systems() function
This is required for Astrognome to configure house systems in the charts.
See gergelypolonkai/astrognome#36
2014-07-16 22:47:59 +02:00
dca2071c88 Move GsweError and GSWE_ERROR documentation to .c file
This is to hide documentation details from installed .h files
2014-07-16 22:38:47 +02:00
cb9cf3a4ce Remove make check from Travis config
The checks are not working yet, thus Travis is continuously fails.
2014-07-08 13:24:59 +02:00
1225c5c8ed Fix comment in gswe_init_with_dir() 2014-07-08 13:24:07 +02:00
0caebd4f94 Revert "Remove gswe_init() call from GsweTimestamp initializers"
This reverts commit 078ff3370d.

It turns out that we actually need to call gswe_init() (or at least
g_type_init()) for GObjects to work.
2014-07-08 13:16:59 +02:00
80b5da88a3 Version bump to 2.1.0 2014-07-08 11:25:55 +02:00
d5bea25e4d Add version information to some new functions 2014-07-08 11:02:25 +02:00
95e89a4c25 Code beautification 2014-07-08 10:43:54 +02:00
cb1fa1f67a Move gswe-version.h generating to the right place 2014-07-06 10:23:59 +02:00
078ff3370d Remove gswe_init() call from GsweTimestamp initializers
That call is unnecessary for time related functions.
2014-07-06 00:48:20 +02:00
66c8c3371c Code beautifying in gswe-timestamp.c
Wrap really long lines
2014-07-06 00:47:37 +02:00
d2638adf8a Fix time zone value to be a float in GsweTimestamp test case 2014-07-06 00:46:34 +02:00
4b61c453fd Add time zone check to GsweTimestamp test case 2014-07-06 00:45:47 +02:00
105cf7c83b Fix GsweTimestamp test not to use deprecated functions 2014-07-06 00:45:22 +02:00
8adfd0b966 Fix error that makes class init fail on machines with UTC as time zone
For a more universal solution, the default values for a GsweTimestamp
are set according to the current UTC time, with time zone also set
to UTC.
2014-07-06 00:44:43 +02:00
8dd6eedb88 Remove debugging line in gswe_init_with_dir() 2014-07-05 23:14:08 +02:00
89baa44005 Add documentation for GSWE_PLANET_LILITH 2014-07-05 23:04:43 +02:00
a50a967ad3 Add gswe_find_*_info() functions to find registered Gswe*Info objects 2014-07-05 22:58:54 +02:00
75a9318629 Add version information related functions 2014-07-05 22:57:34 +02:00
8a5d700d93 Fix swe/src/Makefile.am after moving away seleapsec.txt from that directory
$ make dist failed after doing so
2014-06-24 09:52:11 +02:00
95face8294 Add function gswe_timestamp_get_sidereal_time() 2014-06-11 15:59:55 +02:00
fbf341dcec Fix GTK-Doc warnings about deprecated symbols 2014-06-11 15:41:32 +02:00
784987a2b6 Remove deprecated function calls from own code 2014-06-11 15:41:32 +02:00
07a351c373 Add Universal Time calculation functions
This is required for sidereal time calculations later. get/set Julian
day functions have been renamed to have an _et suffix. Meanwhile, the
old gswe_timestamp_get_julian_day() and gswe_timestamp_set_julian_day()
functions have been deprecated.
2014-06-11 15:41:32 +02:00
55621bc25d Add asteroid Hygiea 2014-05-29 08:14:00 +02:00
a120b22861 Add GSWE_PLANET_LILITH and offsets to the documentation sections 2014-05-29 08:11:30 +02:00
c9a0944504 Comment block fixup for GswePlanet
Add Orcus and Asbolus
Reorder comments so it lines up with the actual values
2014-05-29 08:07:45 +02:00
9d7eedb371 Add seleapsec.txt to installed file in RPM .spec 2014-05-28 16:55:12 +02:00
cd36bafe9c Remove two unreliable lines from the test code
A fix must be introduced later, though!
2014-05-28 16:41:01 +02:00
d3e4443922 Add GswePlanet planet offsets for later use 2014-05-28 16:39:43 +02:00
6a69271007 Add asteroids Orcus and Asbolus 2014-05-28 16:39:43 +02:00
b6071a4e46 Reordered planets in GswePlanet
This is to bring some consistency in the API
2014-05-28 16:39:43 +02:00
21298fb219 Add alias to GSWE_PLANET_MOON_APOGEE as GSWE_PLANET_LILITH 2014-05-24 09:57:51 +02:00
243eac9de8 Add asteroid Circe as GSWE_PLANET_CIRCE 2014-05-23 21:42:49 +02:00
97dceeb45c Add seasnam.txt and seorbel.txt datafiles 2014-05-21 18:42:03 +02:00
45833584b7 Update Swiss Ephemeris to 2.0 2014-05-21 17:28:41 +02:00
26dcd74338 Add seleapsec.txt to installed data file list 2014-05-19 10:11:03 +02:00
3296f9dfce Add leap seconds to seleapsec.txt 2014-05-19 10:09:34 +02:00
eec99bcb05 Update Swiss Ephemeris data files 2014-05-19 09:44:15 +02:00
de5ac1b63b Add dwarf planet Dejanira 2014-05-18 20:38:29 +02:00
97df73c64f Add dwarf planets Sedna and Eris 2014-05-18 17:19:25 +02:00
2d75226310 Reindent some planet table creating lines 2014-05-18 17:19:04 +02:00
148 changed files with 4136 additions and 49924 deletions

10
.gitignore vendored
View File

@@ -14,6 +14,7 @@
/.dirstamp
*.gir
*.typelib
*.gschema.valid
ChangeLog
# Files created by the build tools
@@ -56,7 +57,11 @@ Makefile.in
/tests/*-test
/tests/*-test.log
/tests/*-test.trs
/tests/test-suite.log
/swe-glib-lcov*
test-suite.log
*.gcno
*.gcda
*.gcov
# Translation related files
/ABOUT-NLS
@@ -89,8 +94,11 @@ Makefile.in
/data/swe-glib.pc
/data/swe-glib.spec
/src/*.vapi
/src/gswe-version.h
/data/*.gschema.xml
# Documentation related files
/docs/reference/*/*.actions
/docs/reference/*/*.args
/docs/reference/*/*.hierarchy
/docs/reference/*/*.interfaces

View File

@@ -1,3 +1,17 @@
sudo: false
language: c
install: sudo apt-get install libglib2.0-dev gobject-introspection gnome-common && ./autogen.sh
script: ./configure && make && make check
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

View File

@@ -1,5 +1,7 @@
include $(top_srcdir)/swe-glib.mk
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = swe swe/src swe/doc src po data tests
SUBDIRS = src po data tests
if ENABLE_GTK_DOC
SUBDIRS += docs/reference/swe-glib
@@ -9,11 +11,11 @@ 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 \

View File

@@ -1,22 +1,37 @@
# SWE-GLib
SWE-GLib is a GLib style wrapper library around Astrodienst's [Swiss Ephemeris library](http://www.astro.com/swisseph/).
[![Build Status](https://travis-ci.org/gergelypolonkai/swe-glib.svg?branch=master)](https://travis-ci.org/gergelypolonkai/swe-glib)
[![codecov.io](https://codecov.io/github/gergelypolonkai/swe-glib/coverage.svg?branch=master)](https://codecov.io/github/gergelypolonkai/swe-glib?branch=master)
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!
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.
### Creating the required objects
@@ -67,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);
@@ -79,34 +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 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).
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
Earths surface) calculations yet.
### Database size
The size of all data files provided by Astrodienst is around 40MB. Although it should not be a problem with today's home hardware, it can be a hard requirement on embedded systems. For basic calculations, keeping the following files under $(datadir)/swe-glib is usually enough:
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.
As the underlying Swiss Ephemeris is published under GPL (or a
commercial license I can not afford), SWE-GLib is also uses that. This
means that you can currently use SWE-GLib in software published under
the GNU GPL v3 (or, at your option, any later version).

View File

@@ -59,3 +59,5 @@ fi
echo "Running automake"
automake --gnu --add-missing --copy -Wno-portability || exit $?
"$srcdir/configure" "$@"

View File

@@ -1,14 +1,24 @@
m4_define([swe_glib_major_version], [2])
m4_define([swe_glib_minor_version], [0])
m4_define([swe_glib_micro_version], [3])
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])
@@ -26,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
@@ -64,27 +75,103 @@ AM_CONDITIONAL(OS_WIN32, [test "$native_win32" = "yes"])
AM_CONDITIONAL(OS_UNIX, [test "$native_win32" != "yes"])
AC_PATH_PROG([GTESTER], [gtester])
AC_PATH_PROG([GTESTER_REPORT], [gtester-report])
dnl ************************************
dnl *** Enable lcov coverage reports ***
dnl ************************************
AC_ARG_ENABLE(coverage,
AS_HELP_STRING([--enable-coverage],
[enable coverage testing with gcov]),
[use_gcov=$enableval], [use_gcov=no])
AS_IF([ test "x$use_gcov" = "xyes"], [
dnl we need gcc:
if test "$GCC" != "yes"; then
AC_MSG_ERROR([GCC is required for --enable-coverage])
fi
dnl Check if ccache is being used
AC_CHECK_PROG(SHTOOL, shtool, shtool)
case `$SHTOOL path $CC` in
*ccache*[)] gcc_ccache=yes;;
*[)] gcc_ccache=no;;
esac
if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then
AC_MSG_ERROR([ccache must be disabled when --enable-coverage option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
fi
ltp_version_list="1.6 1.7 1.8 1.9 1.10 1.14"
AC_CHECK_PROG(LTP, lcov, lcov)
AC_CHECK_PROG(LTP_GENHTML, genhtml, genhtml)
AS_IF([ test "$LTP" ], [
AC_CACHE_CHECK([for ltp version], sw_glib_cv_ltp_version, [
swe_glib_cv_ltp_version=invalid
ltp_version=`$LTP -v 2>/dev/null | $SED -e 's/^.* //'`
for ltp_check_version in $ltp_version_list; do
if test "$ltp_version" = "$ltp_check_version"; then
swe_glib_cv_ltp_version="$ltp_check_version (ok)"
fi
done
])
], [
ltp_msg="To enable code coverage reporting you must have one of the following LTP versions installed: $ltp_version_list"
AC_MSG_ERROR([$ltp_msg])
])
case $swe_glib_cv_ltp_version in
""|invalid[)]
ltp_msg="You must have one of the following versions of LTP: $ltp_version_list (found: $ltp_version)."
AC_MSG_ERROR([$ltp_msg])
LTP="exit 0;"
;;
esac
if test -z "$LTP_GENHTML"; then
AC_MSG_ERROR([Could not find genhtml from the LTP package])
fi
dnl Remove all optimization flags from CFLAGS
changequote({,})
CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'`
changequote([,])
dnl Add the special gcc flags
CFLAGS="$CFLAGS -O0 -fprofile-arcs -ftest-coverage"
LDFLAGS="$LDFLAGS -lgcov"
])
if test "x$enable_debug" = "xyes" ; then
AC_DEFINE([DEBUG], [1], [Define if debugging is enabled])
if test x$cflags_set != xset ; then
case " $CFLAGS " in
*[[\ \ ]]-g[[\ \ ]]*) ;;
*) CFLAGS="$CFLAGS -g" ;;
esac
fi
fi
PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.32.0])
PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.32.0])
AC_CONFIG_MACRO_DIR([m4])
PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26])
LIBSWE_LIBS='$(top_builddir)/swe/src/libswe-1.76.la'
AC_SUBST(LIBSWE_LIBS)
GLIB_GSETTINGS
AC_CONFIG_MACRO_DIR([m4])
LIBSWE_GLIB_LIBS='$(top_builddir)/src/libswe-glib-$(SWE_GLIB_API_VERSION).la'
AC_SUBST(LIBSWE_GLIB_LIBS)
AC_CONFIG_FILES([
Makefile
swe/Makefile
swe/src/Makefile
swe/doc/Makefile
src/Makefile
data/Makefile
po/Makefile.in
tests/Makefile
data/swe-glib.pc
data/swe-glib.spec
src/gswe-version.h
])
AM_COND_IF([ENABLE_GTK_DOC], [
AC_CONFIG_FILES([

View File

@@ -1,65 +1,16 @@
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = swe-glib.pc $(NULL)
swephdir = $(pkgdatadir)
sweph_DATA = \
sweph-data/seas_00.se1 \
sweph-data/seas_06.se1 \
sweph-data/seas_12.se1 \
sweph-data/seas_18.se1 \
sweph-data/seas_24.se1 \
sweph-data/seas_30.se1 \
sweph-data/seas_36.se1 \
sweph-data/seas_42.se1 \
sweph-data/seas_48.se1 \
sweph-data/seasm06.se1 \
sweph-data/seasm12.se1 \
sweph-data/seasm18.se1 \
sweph-data/seasm24.se1 \
sweph-data/seasm30.se1 \
sweph-data/seasm36.se1 \
sweph-data/seasm42.se1 \
sweph-data/seasm48.se1 \
sweph-data/seasm54.se1 \
sweph-data/semo_00.se1 \
sweph-data/semo_06.se1 \
sweph-data/semo_12.se1 \
sweph-data/semo_18.se1 \
sweph-data/semo_24.se1 \
sweph-data/semo_30.se1 \
sweph-data/semo_36.se1 \
sweph-data/semo_42.se1 \
sweph-data/semo_48.se1 \
sweph-data/semom06.se1 \
sweph-data/semom12.se1 \
sweph-data/semom18.se1 \
sweph-data/semom24.se1 \
sweph-data/semom30.se1 \
sweph-data/semom36.se1 \
sweph-data/semom42.se1 \
sweph-data/semom48.se1 \
sweph-data/semom54.se1 \
sweph-data/sepl_00.se1 \
sweph-data/sepl_06.se1 \
sweph-data/sepl_12.se1 \
sweph-data/sepl_18.se1 \
sweph-data/sepl_24.se1 \
sweph-data/sepl_30.se1 \
sweph-data/sepl_36.se1 \
sweph-data/sepl_42.se1 \
sweph-data/sepl_48.se1 \
sweph-data/seplm06.se1 \
sweph-data/seplm12.se1 \
sweph-data/seplm18.se1 \
sweph-data/seplm24.se1 \
sweph-data/seplm30.se1 \
sweph-data/seplm36.se1 \
sweph-data/seplm42.se1 \
sweph-data/seplm48.se1 \
sweph-data/seplm54.se1 \
$(NULL)
eu.polonkai.gergely.swe-glib.gschema.xml: gschema.template $(top_builddir)/src/gswe-types.h
$(GLIB_MKENUMS) --comments "<!-- @comment@ -->" --template $(filter %.template,$^) $(filter-out %.template,$^) > \
$@.tmp && mv $@.tmp $@
gsettings_SCHEMAS = eu.polonkai.gergely.swe-glib.gschema.xml
@GSETTINGS_RULES@
EXTRA_DIST = \
$(sweph_DATA) \
swe-glib.spec
swe-glib.spec \
gschema.template
DISTCLEANFILES = $(gsettings_SCHEMAS)

22
data/gschema.template Normal file
View 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 ***/

View File

@@ -70,12 +70,13 @@ rm -f $RPM_BUILD_ROOT%{_datadir}/locale/hu/LC_MESSAGES/swe-glib.mo
%files
%doc ChangeLog
%{_libdir}/libswe-1.76.so.*
%{_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/*
@@ -84,7 +85,7 @@ rm -f $RPM_BUILD_ROOT%{_datadir}/locale/hu/LC_MESSAGES/swe-glib.mo
%{_includedir}/*
%{_libdir}/pkgconfig/*
%{_datadir}/gir-1.0/SweGlib-@SWE_GLIB_API_VERSION@.gir
%{_libdir}/libswe-1.76.so
%{_libdir}/libswe-@SWE_VERSION@.so
%{_libdir}/libswe-glib-@SWE_GLIB_API_VERSION@.so
%{_datadir}/vala/vapi/SweGlib-@SWE_GLIB_API_VERSION@.vapi

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.

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.

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.

View File

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

View File

@@ -32,6 +32,7 @@
<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">

View File

@@ -60,6 +60,7 @@ gswe_moon_phase_data_get_type
<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
@@ -79,6 +80,8 @@ gswe_sign_info_get_type
<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
@@ -122,6 +125,8 @@ gswe_planet_data_get_type
<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
@@ -165,6 +170,8 @@ gswe_aspect_data_get_type
<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
@@ -206,6 +213,8 @@ gswe_antiscion_data_get_type
<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
@@ -240,9 +249,11 @@ gswe_house_data_get_type
<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
@@ -262,8 +273,14 @@ 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
@@ -278,6 +295,11 @@ gswe_timestamp_get_type
<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
@@ -299,3 +321,11 @@ GSWE_ERROR
gswe_init
</SECTION>
<SECTION>
<FILE>gswe-version</FILE>
GSWE_MAJOR_VERSION
GSWE_MINOR_VERSION
GSWE_MICRO_VERSION
GSWE_CHECK_VERSION
gswe_check_version
</SECTION>

View File

@@ -1,4 +1,8 @@
var Swe = imports.gi.SweGlib;
const GLib = imports.gi.GLib;
const Swe = imports.gi.SweGlib;
const Format = imports.format;
String.prototype.format = Format.format;
Swe.init();
@@ -8,7 +12,7 @@ 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.03990999, 47.49801000, 280);
moment.set_coordinates(19.03991, 47.49801, 280);
moment.set_house_system(Swe.HouseSystem.PLACIDUS);
var all_planets = moment.get_all_planets()
@@ -20,7 +24,7 @@ for (var i = 0; i < all_planets.length; i++) {
var minute = Math.floor((sign_position - degree) * 60);
var second = Math.floor(((sign_position - degree) * 60 - minute) * 60)
log(planet.get_planet_info().get_name() + ": " + position + " (" + degree + "°" + minute + "" + second + "″ " + planet.get_sign_info().get_name() + ")");
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();
@@ -31,7 +35,7 @@ for (var i = 0; i < all_aspects.length; i++) {
var planet1 = aspect.get_planet1();
var planet2 = aspect.get_planet2();
log(planet1.get_planet_info().get_name() + " in " + aspect.get_aspect_info().get_name() + " with " + planet2.get_planet_info().get_name() + "(±" + aspect.get_difference() + "%)");
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()));
}
}
@@ -43,7 +47,6 @@ for (var i = 0; i < all_antiscia.length; i++) {
var planet1 = antiscion.get_planet1();
var planet2 = antiscion.get_planet2();
log(planet1.get_planet_info().get_name() + " is antiscion of " + planet2.get_planet_info().get_name() + " on axis " + antiscion.get_antiscion_axis_info().get_name() + " (±" + antiscion.get_difference() + "%)");
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
View 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

View File

@@ -1,10 +1,12 @@
#!/bin/env perl
package SweGlib;
use utf8;
use strict;
use POSIX;
use Glib::Object::Introspection;
use Data::Dumper;
binmode STDOUT, ':encoding(UTF-8)';
Glib::Object::Introspection->setup(basename => 'SweGlib', version => '2.0', package => 'SweGlib');
@@ -17,7 +19,7 @@ $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.0390999, 47.49801000, 280);
$moment->set_coordinates(19.03991, 47.49801, 280);
$moment->set_house_system("placidus");
$moment->add_all_planets();
@@ -51,4 +53,3 @@ foreach my $antiscion (@{$all_antiscia}) {
printf("%s is antiscion of %s on axis %s (±%.2f%%)\n", $planet1->get_planet_info()->get_name(), $planet2->get_planet_info()->get_name(), $antiscion->get_antiscion_axis_info()->get_name(), $antiscion->get_difference());
}
}

View File

@@ -1,6 +1,10 @@
# -*- coding: utf-8 -*-
from gi.repository import SweGlib
import math
import codecs
import sys
sys.stdout = codecs.getwriter('utf-8')(sys.stdout)
SweGlib.init()
@@ -9,7 +13,7 @@ timestamp.set_gregorian_full(1983, 3, 7, 11, 54, 45, 0, 1)
moment = SweGlib.Moment()
moment.set_timestamp(timestamp)
moment.set_coordinates(19.03990999, 47.49801000, 280)
moment.set_coordinates(19.03991, 47.49801, 280)
moment.set_house_system(SweGlib.HouseSystem.PLACIDUS)
moment.add_all_planets()
@@ -37,5 +41,4 @@ for antiscion in all_antiscia:
planet1 = antiscion.get_planet1()
planet2 = antiscion.get_planet2()
print "%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())
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())

View File

@@ -1,4 +1,7 @@
## Process this file with automake to produce Makefile.in
include $(top_srcdir)/swe-glib.mk
AM_CPPFLAGS = -DG_LOG_DOMAIN=\"SWE-GLib\" -DLOCALEDIR=\"$(localedir)\" -D__SWE_GLIB_BUILDING__ -DPKGDATADIR=\"$(pkgdatadir)\"
lib_LTLIBRARIES = libswe-glib-2.0.la
@@ -21,7 +24,9 @@ INST_H_SRC_FILES = \
$(NULL)
INST_H_BUILT_FILES = \
gswe-enumtypes.h
gswe-enumtypes.h \
gswe-version.h \
$(NULL)
PRIV_H_SRC_FILES = \
swe-glib-private.h \
@@ -55,10 +60,11 @@ libswe_glib_2_0_la_SOURCES = \
gswe-moment.c \
gswe-timestamp.c \
gswe-enumtypes.c \
gswe-version.c \
$(NULL)
libswe_glib_2_0_la_CFLAGS = $(GLIB_CFLAGS) $(GOBJECT_CFLAGS) -Wall
libswe_glib_2_0_la_LIBADD = $(GLIB_LIBS) $(GOBJECT_LIBS) $(LIBSWE_LIBS)
libswe_glib_2_0_la_LIBADD = $(GLIB_LIBS) $(GOBJECT_LIBS) -lswe
libswe_glib_2_0_la_DEPENDENCIES = \
$(NULL)
@@ -88,6 +94,7 @@ SweGlib_@SWE_GLIB_API_VERSION_U@_gir_LIBS = libswe-glib-2.0.la
SweGlib_@SWE_GLIB_API_VERSION_U@_gir_SCANNERFLAGS = --identifier-prefix=Gswe --symbol-prefix=gswe --warn-all
SweGlib_@SWE_GLIB_API_VERSION_U@_gir_INCLUDES = GLib-2.0 GObject-2.0
SweGlib_@SWE_GLIB_API_VERSION_U@_gir_CFLAGS = -D__SWE_GLIB_BUILDING__ -I$(top_srcdir) -I$(srcdir) -I$(builddir)
SweGlib_@SWE_GLIB_API_VERSION_U@_gir_LDFLAGS = $(GLIB_LIBS) $(GOBJECT_LIBS) -lswe
SweGlib_@SWE_GLIB_API_VERSION_U@_gir_EXPORT_PACKAGES = swe-glib
INTROSPECTION_GIRS = SweGlib-$(SWE_GLIB_API_VERSION).gir

View File

@@ -30,7 +30,12 @@
* 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);
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)
@@ -84,7 +89,8 @@ gswe_antiscion_axis_info_ref(GsweAntiscionAxisInfo *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.
* 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)
@@ -102,7 +108,9 @@ gswe_antiscion_axis_info_unref(GsweAntiscionAxisInfo *antiscion_axis_info)
* Sets the axis ID.
*/
void
gswe_antiscion_axis_info_set_axis(GsweAntiscionAxisInfo *antiscion_axis_info, GsweAntiscionAxis axis)
gswe_antiscion_axis_info_set_axis(
GsweAntiscionAxisInfo *antiscion_axis_info,
GsweAntiscionAxis axis)
{
antiscion_axis_info->axis = axis;
}
@@ -124,12 +132,15 @@ gswe_antiscion_axis_info_get_axis(GsweAntiscionAxisInfo *antiscion_axis_info)
/**
* 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
* @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)
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);
@@ -144,10 +155,12 @@ gswe_antiscion_axis_info_set_start_sign_info(GsweAntiscionAxisInfo *antiscion_ax
*
* Gets the starting sign of the axis.
*
* Returns: (transfer none): the #GsweSignInfo of the sign in which this axis starts
* 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)
gswe_antiscion_axis_info_get_start_sign_info(
GsweAntiscionAxisInfo *antiscion_axis_info)
{
return antiscion_axis_info->start_sign;
}
@@ -165,13 +178,23 @@ gswe_antiscion_axis_info_get_start_sign_info(GsweAntiscionAxisInfo *antiscion_ax
* be found.
*/
void
gswe_antiscion_axis_info_set_start_sign(GsweAntiscionAxisInfo *antiscion_axis_info, GsweZodiac sign, GError **err)
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) {
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");
g_set_error(
err,
GSWE_ERROR, GSWE_ERROR_UNKNOWN_SIGN,
"The requested sign is not registered"
);
return;
}
@@ -192,7 +215,8 @@ gswe_antiscion_axis_info_set_start_sign(GsweAntiscionAxisInfo *antiscion_axis_in
* Returns: the corresponding sign ID
*/
GsweZodiac
gswe_antiscion_axis_info_get_start_sign(GsweAntiscionAxisInfo *antiscion_axis_info)
gswe_antiscion_axis_info_get_start_sign(
GsweAntiscionAxisInfo *antiscion_axis_info)
{
if (antiscion_axis_info->start_sign) {
return antiscion_axis_info->start_sign->sign;
@@ -209,7 +233,9 @@ gswe_antiscion_axis_info_get_start_sign(GsweAntiscionAxisInfo *antiscion_axis_in
* Sets the name of the axis
*/
void
gswe_antiscion_axis_info_set_name(GsweAntiscionAxisInfo *antiscion_axis_info, const gchar *name)
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);
@@ -240,7 +266,9 @@ gswe_antiscion_axis_info_get_name(GsweAntiscionAxisInfo *antiscion_axis_info)
* Sets the offset at which the axis starts.
*/
void
gswe_antiscion_axis_info_set_sign_offset(GsweAntiscionAxisInfo *antiscion_axis_info, gdouble sign_offset)
gswe_antiscion_axis_info_set_sign_offset(
GsweAntiscionAxisInfo *antiscion_axis_info,
gdouble sign_offset)
{
antiscion_axis_info->sign_offset = sign_offset;
}
@@ -254,7 +282,8 @@ gswe_antiscion_axis_info_set_sign_offset(GsweAntiscionAxisInfo *antiscion_axis_i
* Returns: the offset, in degrees
*/
gdouble
gswe_antiscion_axis_info_get_sign_offset(GsweAntiscionAxisInfo *antiscion_axis_info)
gswe_antiscion_axis_info_get_sign_offset(
GsweAntiscionAxisInfo *antiscion_axis_info)
{
return antiscion_axis_info->sign_offset;
}

View File

@@ -28,8 +28,8 @@ G_BEGIN_DECLS
/**
* GsweAntiscionAxisInfo:
*
* <structname>GsweAntiscionAxisInfo</structname> is an opaque structure whose members
* cannot be accessed directly.
* <structname>GsweAntiscionAxisInfo</structname> is an opaque structure whose
* members cannot be accessed directly.
*
* Since: 1.1
*/
@@ -40,23 +40,47 @@ GType gswe_antiscion_axis_info_get_type(void);
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);
GsweAntiscionAxisInfo *gswe_antiscion_axis_info_ref(
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_unref(
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_axis(
GsweAntiscionAxisInfo *antiscion_axis_info,
GsweAntiscionAxis axis);
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);
GsweAntiscionAxis gswe_antiscion_axis_info_get_axis(
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_start_sign_info(
GsweAntiscionAxisInfo *antiscion_axis_info,
GsweSignInfo *sign_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);
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

View File

@@ -33,7 +33,8 @@ struct _GsweAntiscionData {
/* the #GsweAntiscionAxisInfo structure associated with this antiscion */
GsweAntiscionAxisInfo *antiscion_axis_info;
/* the difference in degrees between an exact antiscion and this given antiscion */
/* the difference in degrees between an exact antiscion and this given
* antiscion */
gdouble difference;
/* reference count */

View File

@@ -35,7 +35,12 @@
* 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);
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)
@@ -51,6 +56,8 @@ gswe_antiscion_data_free(GsweAntiscionData *antiscion_data)
if (antiscion_data->antiscion_axis_info) {
gswe_antiscion_axis_info_unref(antiscion_data->antiscion_axis_info);
}
g_free(antiscion_data);
}
/**
@@ -74,15 +81,20 @@ gswe_antiscion_data_new(void)
/*
* 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
* @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)
find_antiscion(
gpointer axis_p,
GsweAntiscionAxisInfo *antiscion_axis_info,
GsweAntiscionData *antiscion_data)
{
GsweAntiscionAxis axis;
gdouble start_point,
@@ -93,7 +105,10 @@ find_antiscion(gpointer axis_p, GsweAntiscionAxisInfo *antiscion_axis_info, Gswe
return FALSE;
}
planet_orb = fmin(antiscion_data->planet1->planet_info->orb, antiscion_data->planet2->planet_info->orb);
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;
@@ -104,7 +119,9 @@ find_antiscion(gpointer axis_p, GsweAntiscionAxisInfo *antiscion_axis_info, Gswe
axis_position += 360.0;
}
if ((antiscion_data->difference = fabs(antiscion_data->planet2->position - axis_position)) <= planet_orb) {
if ((antiscion_data->difference = fabs(
antiscion_data->planet2->position - axis_position
)) <= planet_orb) {
antiscion_data->antiscion_axis_info = antiscion_axis_info;
return TRUE;
@@ -137,8 +154,17 @@ find_antiscion(gpointer axis_p, GsweAntiscionAxisInfo *antiscion_axis_info, Gswe
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)));
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);
}
@@ -155,7 +181,9 @@ gswe_antiscion_data_calculate(GsweAntiscionData *antiscion_data)
* Returns: (transfer full): a new #GsweAntiscionData
*/
GsweAntiscionData *
gswe_antiscion_data_new_with_planets(GswePlanetData *planet1, GswePlanetData *planet2)
gswe_antiscion_data_new_with_planets(
GswePlanetData *planet1,
GswePlanetData *planet2)
{
GsweAntiscionData *ret;
@@ -188,11 +216,16 @@ gswe_antiscion_data_ref(GsweAntiscionData *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.
* 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);
}
@@ -206,7 +239,9 @@ gswe_antiscion_data_unref(GsweAntiscionData *antiscion_data)
* Sets @planet1 as the first planet of the antiscion.
*/
void
gswe_antiscion_data_set_planet1(GsweAntiscionData *antiscion_data, GswePlanetData *planet1)
gswe_antiscion_data_set_planet1(
GsweAntiscionData *antiscion_data,
GswePlanetData *planet1)
{
if (antiscion_data->planet1) {
gswe_planet_data_unref(antiscion_data->planet1);
@@ -221,7 +256,8 @@ gswe_antiscion_data_set_planet1(GsweAntiscionData *antiscion_data, GswePlanetDat
*
* Gets the first in the antiscion relationship.
*
* Returns: (transfer none): The #GswePlanetData associated with the first planet.
* Returns: (transfer none): The #GswePlanetData associated with the first
* planet.
*/
GswePlanetData *
gswe_antiscion_data_get_planet1(GsweAntiscionData *antiscion_data)
@@ -237,7 +273,9 @@ gswe_antiscion_data_get_planet1(GsweAntiscionData *antiscion_data)
* Sets @planet2 as the second planet of the antiscion.
*/
void
gswe_antiscion_data_set_planet2(GsweAntiscionData *antiscion_data, GswePlanetData *planet2)
gswe_antiscion_data_set_planet2(
GsweAntiscionData *antiscion_data,
GswePlanetData *planet2)
{
if (antiscion_data->planet2) {
gswe_planet_data_unref(antiscion_data->planet2);
@@ -252,7 +290,8 @@ gswe_antiscion_data_set_planet2(GsweAntiscionData *antiscion_data, GswePlanetDat
*
* Gets the second in the antiscion relationship.
*
* Returns: (transfer none): The #GswePlanetData associated with the second planet.
* Returns: (transfer none): The #GswePlanetData associated with the second
* planet.
*/
GswePlanetData *
gswe_antiscion_data_get_planet2(GsweAntiscionData *antiscion_data)
@@ -271,12 +310,22 @@ gswe_antiscion_data_get_planet2(GsweAntiscionData *antiscion_data)
* the axis is not known.
*/
void
gswe_antiscion_data_set_axis(GsweAntiscionData *antiscion_data, GsweAntiscionAxis axis, GError **err)
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");
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;
}
@@ -285,7 +334,9 @@ gswe_antiscion_data_set_axis(GsweAntiscionData *antiscion_data, GsweAntiscionAxi
gswe_antiscion_axis_info_unref(antiscion_data->antiscion_axis_info);
}
antiscion_data->antiscion_axis_info = gswe_antiscion_axis_info_ref(antiscion_axis_info);
antiscion_data->antiscion_axis_info = gswe_antiscion_axis_info_ref(
antiscion_axis_info
);
}
/**
@@ -314,13 +365,17 @@ gswe_antiscion_data_get_axis(GsweAntiscionData *antiscion_data)
* 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)
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);
antiscion_data->antiscion_axis_info = gswe_antiscion_axis_info_ref(
antiscion_axis_info
);
}
/**
@@ -329,7 +384,8 @@ gswe_antiscion_data_set_antiscion_axis_info(GsweAntiscionData *antiscion_data, G
*
* Gets the axis information related to the antiscion relationship's axis.
*
* Returns: (transfer none): the #GsweAntiscionAxisInfo associated with this axis
* Returns: (transfer none): the #GsweAntiscionAxisInfo associated with this
* axis
*/
GsweAntiscionAxisInfo *
gswe_antiscion_data_get_antiscion_axis_info(GsweAntiscionData *antiscion_data)
@@ -345,7 +401,9 @@ gswe_antiscion_data_get_antiscion_axis_info(GsweAntiscionData *antiscion_data)
* Sets the difference of this antiscion from an exact antiscion.
*/
void
gswe_antiscion_data_set_difference(GsweAntiscionData *antiscion_data, gdouble difference)
gswe_antiscion_data_set_difference(
GsweAntiscionData *antiscion_data,
gdouble difference)
{
antiscion_data->difference = difference;
}
@@ -354,7 +412,8 @@ gswe_antiscion_data_set_difference(GsweAntiscionData *antiscion_data, gdouble di
* gswe_antiscion_data_get_difference:
* @antiscion_data: (in): a #GsweAntiscionData
*
* Gets the difference between an exact antiscion and this antiscion relationship.
* Gets the difference between an exact antiscion and this antiscion
* relationship.
*
* Returns: the difference, in degrees
*/

View File

@@ -28,8 +28,8 @@ G_BEGIN_DECLS
/**
* GsweAntiscionData:
*
* <structname>GsweAntiscionData</structname> is an opaque structure whose members
* cannot be accessed directly.
* <structname>GsweAntiscionData</structname> is an opaque structure whose
* members cannot be accessed directly.
*
* Since: 1.1
*/
@@ -39,21 +39,37 @@ 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_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_planet1(
GsweAntiscionData *antiscion_data,
GswePlanetData *planet1);
void gswe_antiscion_data_set_planet2(GsweAntiscionData *antiscion_data, GswePlanetData *planet2);
GswePlanetData *gswe_antiscion_data_get_planet2(GsweAntiscionData *antiscion_data);
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);
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

View File

@@ -35,7 +35,8 @@ struct _GsweAspectData {
/* the #GsweAspectInfo structure associated with the aspect */
GsweAspectInfo *aspect_info;
/* the difference in percent between an exact aspect and this given aspect */
/* the difference in percent between an exact aspect and this given
* aspect */
gdouble difference;
/* reference count */

View File

@@ -38,7 +38,12 @@
* #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);
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)
@@ -62,20 +67,27 @@ gswe_aspect_data_free(GsweAspectData *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
* @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)
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);
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) {
@@ -84,7 +96,8 @@ find_aspect(gpointer aspect_p, GsweAspectInfo *aspect_info, GsweAspectData *aspe
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;
aspect_data->difference = (1
- ((aspect_info->size - diff) / aspect_info->size)) * 100.0;
}
return TRUE;
@@ -96,12 +109,23 @@ find_aspect(gpointer aspect_p, GsweAspectInfo *aspect_info, GsweAspectData *aspe
void
gswe_aspect_data_calculate(GsweAspectData *aspect_data)
{
if ((aspect_data->distance = fabs(aspect_data->planet1->position - aspect_data->planet2->position)) > 180.0) {
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)));
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);
}
@@ -138,7 +162,9 @@ gswe_aspect_data_new(void)
* Returns: (transfer full): a new #GsweAspectData with all data set.
*/
GsweAspectData *
gswe_aspect_data_new_with_planets(GswePlanetData *planet1, GswePlanetData *planet2)
gswe_aspect_data_new_with_planets(
GswePlanetData *planet1,
GswePlanetData *planet2)
{
GsweAspectData *ret;
@@ -171,11 +197,16 @@ gswe_aspect_data_ref(GsweAspectData *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.
* 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);
}
@@ -189,7 +220,9 @@ gswe_aspect_data_unref(GsweAspectData *aspect_data)
* Sets @planet1 as the first planet of the aspect.
*/
void
gswe_aspect_data_set_planet1(GsweAspectData *aspect_data, GswePlanetData *planet1)
gswe_aspect_data_set_planet1(
GsweAspectData *aspect_data,
GswePlanetData *planet1)
{
if (aspect_data->planet1) {
gswe_planet_data_unref(aspect_data->planet1);
@@ -197,7 +230,7 @@ gswe_aspect_data_set_planet1(GsweAspectData *aspect_data, GswePlanetData *planet
aspect_data->planet1 = gswe_planet_data_ref(planet1);
if (aspect_data->planet2) {
if (planet1 && aspect_data->planet2) {
gswe_aspect_data_calculate(aspect_data);
}
}
@@ -208,7 +241,8 @@ gswe_aspect_data_set_planet1(GsweAspectData *aspect_data, GswePlanetData *planet
*
* Gets the first planet in the aspect.
*
* Returns: (transfer none): The #GswePlanetData associated with the first planet
* Returns: (transfer none): The #GswePlanetData associated with the first
* planet
*/
GswePlanetData *
gswe_aspect_data_get_planet1(GsweAspectData *aspect_data)
@@ -224,7 +258,9 @@ gswe_aspect_data_get_planet1(GsweAspectData *aspect_data)
* Sets @planet2 as the second planet of the aspect.
*/
void
gswe_aspect_data_set_planet2(GsweAspectData *aspect_data, GswePlanetData *planet2)
gswe_aspect_data_set_planet2(
GsweAspectData *aspect_data,
GswePlanetData *planet2)
{
if (aspect_data->planet2) {
gswe_planet_data_unref(aspect_data->planet2);
@@ -232,7 +268,7 @@ gswe_aspect_data_set_planet2(GsweAspectData *aspect_data, GswePlanetData *planet
aspect_data->planet2 = gswe_planet_data_ref(planet2);
if (aspect_data->planet1) {
if (aspect_data->planet1 && planet2) {
gswe_aspect_data_calculate(aspect_data);
}
}
@@ -243,7 +279,8 @@ gswe_aspect_data_set_planet2(GsweAspectData *aspect_data, GswePlanetData *planet
*
* Gets the second planet in the aspect.
*
* Returns: (transfer none): The #GswePlanetData associated with the second planet
* Returns: (transfer none): The #GswePlanetData associated with the second
* planet
*/
GswePlanetData *
gswe_aspect_data_get_planet2(GsweAspectData *aspect_data)

View File

@@ -37,23 +37,37 @@ G_BEGIN_DECLS
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_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);
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);
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

View File

@@ -32,7 +32,8 @@ struct _GsweAspectInfo {
/* the size of the aspect, in degrees */
guint size;
/* the modifier of the orb (the maximum allowable difference from an exact orb) */
/* the modifier of the orb (the maximum allowable difference from an exact
* orb) */
gdouble orb_modifier;
/* shows whether this aspect is harmonic or not */

View File

@@ -37,7 +37,12 @@
* 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);
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)
@@ -194,7 +199,9 @@ gswe_aspect_info_get_size(GsweAspectInfo *aspect_info)
* between two positions exceeds this limit, the aspect is not considered.
*/
void
gswe_aspect_info_set_orb_modifier(GsweAspectInfo *aspect_info, gdouble orb_modifier)
gswe_aspect_info_set_orb_modifier(
GsweAspectInfo *aspect_info,
gdouble orb_modifier)
{
aspect_info->orb_modifier = orb_modifier;
}
@@ -217,7 +224,8 @@ gswe_aspect_info_get_orb_modifier(GsweAspectInfo *aspect_info)
/**
* gswe_aspect_info_set_harmonic:
* @aspect_info: (in): a #GsweAspectInfo
* @harmonic: TRUE, if @aspect_info should be considered harmonic; FALSE otherwise
* @harmonic: TRUE, if @aspect_info should be considered harmonic; FALSE
* otherwise
*
* Sets the harmonic state of @aspect_info.
*/
@@ -244,11 +252,13 @@ gswe_aspect_info_get_harmonic(GsweAspectInfo *aspect_info)
/**
* gswe_aspect_info_set_major:
* @aspect_info: (in): a #GsweAspectInfo
* @major: TRUE, if @aspect_info should be considered major (Ptolemaic); FALSE otherwise
* @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>
* <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)

View File

@@ -40,21 +40,33 @@ GType gswe_aspect_info_get_type(void);
GsweAspectInfo *gswe_aspect_info_new(void);
GsweAspectInfo *gswe_aspect_info_ref(GsweAspectInfo *aspect_info);
void gswe_aspect_info_unref(GsweAspectInfo *aspect_info);
void gswe_aspect_info_set_aspect(GsweAspectInfo *aspect_info, GsweAspect aspect);
void gswe_aspect_info_set_aspect(
GsweAspectInfo *aspect_info,
GsweAspect aspect);
GsweAspect gswe_aspect_info_get_aspect(GsweAspectInfo *aspect_info);
void gswe_aspect_info_set_name(GsweAspectInfo *aspect_info, const gchar *name);
const gchar *gswe_aspect_info_get_name(GsweAspectInfo *aspect_info);
void gswe_aspect_info_set_size(GsweAspectInfo *aspect_info, gdouble size);
gdouble gswe_aspect_info_get_size(GsweAspectInfo *aspect_info);
void gswe_aspect_info_set_orb_modifier(GsweAspectInfo *aspect_info, gdouble orb_modifier);
void gswe_aspect_info_set_orb_modifier(
GsweAspectInfo *aspect_info,
gdouble orb_modifier);
gdouble gswe_aspect_info_get_orb_modifier(GsweAspectInfo *aspect_info);
void gswe_aspect_info_set_harmonic(GsweAspectInfo *aspect_info, gboolean harmonic);
void gswe_aspect_info_set_harmonic(
GsweAspectInfo *aspect_info,
gboolean harmonic);
gboolean gswe_aspect_info_get_harmonic(GsweAspectInfo *aspect_info);
void gswe_aspect_info_set_major(GsweAspectInfo *aspect_info, gboolean major);

View File

@@ -18,11 +18,11 @@
*/
#include "swe-glib.h"
#include "gswe-enumtypes.h"
#include "@filename@"
/*** END file-header ***/
/*** BEGIN file-production ***/
#include "@filename@"
/* enumerations from "@filename@" */
/*** END file-production ***/
@@ -39,14 +39,21 @@ GType
/*** END value-header ***/
/*** BEGIN value-production ***/
{ @VALUENAME@, "@VALUENAME@", "@valuenick@" },
{
@VALUENAME@,
"@VALUENAME@",
"@valuenick@"
},
/*** END value-production ***/
/*** BEGIN value-tail ***/
{ 0, NULL, NULL }
};
GType g_define_type_id = g_@type@_register_static(g_intern_static_string("@EnumName@"), values);
GType g_define_type_id = g_@type@_register_static(
g_intern_static_string("@EnumName@"),
values
);
g_once_init_leave(&g_define_type_id__volatile, g_define_type_id);
}

View File

@@ -22,13 +22,15 @@
#include "gswe-house-data.h"
struct _GsweHouseData {
/* the number of the house (usually in the range [1;12]. Sometimes may be [1;36]) */
/* the number of the house (usually in the range [1;12]. Sometimes may be
* [1;36]) */
guint house;
/* the position of the house's cusp on the sky */
gdouble cusp_position;
/* the #GsweSignInfo structure associated with the sign in which the house cusp is in */
/* the #GsweSignInfo structure associated with the sign in which the house
* cusp is in */
GsweSignInfo *sign_info;
/* reference count */

View File

@@ -33,7 +33,12 @@
* #GsweHouseData is a structure that represents a house's position.
*/
G_DEFINE_BOXED_TYPE(GsweHouseData, gswe_house_data, (GBoxedCopyFunc)gswe_house_data_ref, (GBoxedFreeFunc)gswe_house_data_unref);
G_DEFINE_BOXED_TYPE(
GsweHouseData,
gswe_house_data,
(GBoxedCopyFunc)gswe_house_data_ref,
(GBoxedFreeFunc)gswe_house_data_unref
);
static void
gswe_house_data_free(GsweHouseData *house_data)
@@ -83,11 +88,16 @@ gswe_house_data_ref(GsweHouseData *house_data)
* gswe_house_data_unref:
* @house_data: a #GsweHouseData
*
* Decreases reference count on @house_data by one. If reference count drops to zero, @house_data is freed.
* Decreases reference count on @house_data by one. If reference count drops to
* zero, @house_data is freed.
*/
void
gswe_house_data_unref(GsweHouseData *house_data)
{
if (house_data == NULL) {
return;
}
if (--house_data->refcount == 0) {
gswe_house_data_free(house_data);
}

View File

@@ -27,7 +27,8 @@ struct _GsweHouseSystemInfo {
/* the house system's ID */
GsweHouseSystem house_system;
/* the character value that represents this house system in the Swiss Ephemeris library */
/* the character value that represents this house system in the Swiss
* Ephemeris library */
gchar sweph_id;
/* the name of this house system */

View File

@@ -29,7 +29,12 @@
* #GsweHouseSystemInfo stores information of a house system.
*/
G_DEFINE_BOXED_TYPE(GsweHouseSystemInfo, gswe_house_system_info, (GBoxedCopyFunc)gswe_house_system_info_ref, (GBoxedFreeFunc)gswe_house_system_info_unref);
G_DEFINE_BOXED_TYPE(
GsweHouseSystemInfo,
gswe_house_system_info,
(GBoxedCopyFunc)gswe_house_system_info_ref,
(GBoxedFreeFunc)gswe_house_system_info_unref
);
static void
gswe_house_system_info_free(GsweHouseSystemInfo *house_system_info)
@@ -98,7 +103,9 @@ gswe_house_system_info_unref(GsweHouseSystemInfo *house_system_info)
* Sets up @house_system_info to represent @house_system.
*/
void
gswe_house_system_info_set_house_system(GsweHouseSystemInfo *house_system_info, GsweHouseSystem house_system)
gswe_house_system_info_set_house_system(
GsweHouseSystemInfo *house_system_info,
GsweHouseSystem house_system)
{
house_system_info->house_system = house_system;
}
@@ -126,7 +133,9 @@ gswe_house_system_info_get_house_system(GsweHouseSystemInfo *house_system_info)
* marked by @sweph_id.
*/
void
gswe_house_system_info_set_sweph_id(GsweHouseSystemInfo *house_system_info, gchar sweph_id)
gswe_house_system_info_set_sweph_id(
GsweHouseSystemInfo *house_system_info,
gchar sweph_id)
{
house_system_info->sweph_id = sweph_id;
}
@@ -153,7 +162,9 @@ gswe_house_system_info_get_sweph_id(GsweHouseSystemInfo *house_system_info)
* Sets the name of @house_system_info.
*/
void
gswe_house_system_info_set_name(GsweHouseSystemInfo *house_system_info, const gchar *name)
gswe_house_system_info_set_name(
GsweHouseSystemInfo *house_system_info,
const gchar *name)
{
if (house_system_info->name) {
g_free(house_system_info->name);

View File

@@ -27,8 +27,8 @@ G_BEGIN_DECLS
/**
* GsweHouseSystemInfo:
*
* <structname>GsweHouseSystemInfo</structname> is an opaque structure whose members
* cannot be accessed directly.
* <structname>GsweHouseSystemInfo</structname> is an opaque structure whose
* members cannot be accessed directly.
*
* Since: 1.1
*/
@@ -39,17 +39,31 @@ GType gswe_house_system_info_get_type(void);
GsweHouseSystemInfo *gswe_house_system_info_new(void);
GsweHouseSystemInfo *gswe_house_system_info_ref(GsweHouseSystemInfo *house_system_info);
GsweHouseSystemInfo *gswe_house_system_info_ref(
GsweHouseSystemInfo *house_system_info);
void gswe_house_system_info_unref(GsweHouseSystemInfo *house_system_info);
void gswe_house_system_info_set_house_system(GsweHouseSystemInfo *house_system_info, GsweHouseSystem house_system);
GsweHouseSystem gswe_house_system_info_get_house_system(GsweHouseSystemInfo *house_system_info);
void gswe_house_system_info_set_house_system(
GsweHouseSystemInfo *house_system_info,
GsweHouseSystem house_system);
void gswe_house_system_info_set_sweph_id(GsweHouseSystemInfo *house_system_info, gchar sweph_id);
gchar gswe_house_system_info_get_sweph_id(GsweHouseSystemInfo *house_system_info);
GsweHouseSystem gswe_house_system_info_get_house_system(
GsweHouseSystemInfo *house_system_info);
void gswe_house_system_info_set_name(GsweHouseSystemInfo *house_system_info, const gchar *name);
const gchar *gswe_house_system_info_get_name(GsweHouseSystemInfo *house_system_info);
void gswe_house_system_info_set_sweph_id(
GsweHouseSystemInfo *house_system_info,
gchar sweph_id);
gchar gswe_house_system_info_get_sweph_id(
GsweHouseSystemInfo *house_system_info);
void gswe_house_system_info_set_name(
GsweHouseSystemInfo *house_system_info,
const gchar *name);
const gchar *gswe_house_system_info_get_name(
GsweHouseSystemInfo *house_system_info);
G_END_DECLS

File diff suppressed because it is too large Load Diff

View File

@@ -26,11 +26,24 @@
#include "gswe-types.h"
#define GSWE_TYPE_MOMENT (gswe_moment_get_type())
#define GSWE_MOMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GSWE_TYPE_MOMENT, GsweMoment))
#define GSWE_IS_MOMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GSWE_TYPE_MOMENT))
#define GSWE_MOMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GSWE_TYPE_MOMENT, GsweMomentClass))
#define GSWE_IS_MOMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GSWE_TYPE_MOMENT))
#define GSWE_MOMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GSWE_TYPE_MOMENT, GsweMomentClass))
#define GSWE_MOMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST( \
(obj), \
GSWE_TYPE_MOMENT, \
GsweMoment))
#define GSWE_IS_MOMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE( \
(obj), \
GSWE_TYPE_MOMENT))
#define GSWE_MOMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST( \
(klass), \
GSWE_TYPE_MOMENT, \
GsweMomentClass))
#define GSWE_IS_MOMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE( \
(klass), \
GSWE_TYPE_MOMENT))
#define GSWE_MOMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS( \
(obj), \
GSWE_TYPE_MOMENT, \
GsweMomentClass))
typedef struct _GsweMoment GsweMoment;
typedef struct _GsweMomentClass GsweMomentClass;
@@ -90,42 +103,97 @@ GType gswe_moment_get_type(void);
/* Method definitions */
GsweMoment *gswe_moment_new(void);
GsweMoment *gswe_moment_new_full(GsweTimestamp *timestamp, gdouble longitude, gdouble latitude, gdouble altitude, GsweHouseSystem house_system);
GsweMoment *gswe_moment_new_full(
GsweTimestamp *timestamp,
gdouble longitude,
gdouble latitude,
gdouble altitude,
GsweHouseSystem house_system);
void gswe_moment_set_timestamp(GsweMoment *moment, GsweTimestamp *timestamp);
GsweTimestamp *gswe_moment_get_timestamp(GsweMoment *moment);
void gswe_moment_set_coordinates(GsweMoment *moment, gdouble longitude, gdouble latitude, gdouble altitude);
void gswe_moment_set_coordinates(
GsweMoment *moment,
gdouble longitude,
gdouble latitude,
gdouble altitude);
GsweCoordinates *gswe_moment_get_coordinates(GsweMoment *moment);
void gswe_moment_set_house_system(GsweMoment *moment, GsweHouseSystem house_system);
void gswe_moment_set_house_system(
GsweMoment *moment,
GsweHouseSystem house_system);
GsweHouseSystem gswe_moment_get_house_system(GsweMoment *moment);
GList *gswe_moment_get_house_cusps(GsweMoment *moment, GError **err);
gint gswe_moment_get_house(GsweMoment *moment, gdouble position, GError **err);
gboolean gswe_moment_has_planet(GsweMoment *moment, GswePlanet planet);
void gswe_moment_add_planet(GsweMoment *moment, GswePlanet planet, GError **err);
void gswe_moment_add_planet(
GsweMoment *moment,
GswePlanet planet,
GError **err);
void gswe_moment_add_all_planets(GsweMoment *moment);
GList *gswe_moment_get_all_planets(GsweMoment *moment);
GswePlanetData *gswe_moment_get_planet(GsweMoment *moment, GswePlanet planet, GError **err);
GswePlanetData *gswe_moment_get_planet(
GsweMoment *moment,
GswePlanet planet,
GError **err);
GList *gswe_moment_get_sign_planets(GsweMoment *moment, GsweZodiac sign);
GList *gswe_moment_get_house_planets(GsweMoment *moment, guint house);
guint gswe_moment_get_element_points(GsweMoment *moment, GsweElement element);
guint gswe_moment_get_quality_points(GsweMoment *moment, GsweQuality quality);
GsweMoonPhaseData *gswe_moment_get_moon_phase(GsweMoment *moment, GError **err);
GList *gswe_moment_get_all_aspects(GsweMoment *moment);
GList *gswe_moment_get_planet_aspects(GsweMoment *moment, GswePlanet planet, GError **err);
GsweAspectData *gswe_moment_get_aspect_by_planets(GsweMoment *moment, GswePlanet planet1, GswePlanet planet2, GError **err);
GList *gswe_moment_get_planet_aspects(
GsweMoment *moment,
GswePlanet planet,
GError **err);
GsweAspectData *gswe_moment_get_aspect_by_planets(
GsweMoment *moment,
GswePlanet planet1,
GswePlanet planet2,
GError **err);
GList *gswe_moment_get_all_antiscia(GsweMoment *moment);
GList *gswe_moment_get_all_planet_antiscia(GsweMoment *moment, GswePlanet planet, GError **err);
GList *gswe_moment_get_axis_all_antiscia(GsweMoment *moment, GsweAntiscionAxis axis);
GList *gswe_moment_get_axis_planet_antiscia(GsweMoment *moment, GsweAntiscionAxis axis, GswePlanet planet, GError **err);
GsweAntiscionData *gswe_moment_get_antiscion_by_planets(GsweMoment *moment, GswePlanet planet1, GswePlanet planet2, GError **err);
GList *gswe_moment_get_all_planet_antiscia(
GsweMoment *moment,
GswePlanet planet,
GError **err);
GList *gswe_moment_get_axis_all_antiscia(
GsweMoment *moment,
GsweAntiscionAxis axis);
GList *gswe_moment_get_axis_planet_antiscia(
GsweMoment *moment,
GsweAntiscionAxis axis,
GswePlanet planet,
GError **err);
GsweAntiscionData *gswe_moment_get_antiscion_by_planets(
GsweMoment *moment,
GswePlanet planet1,
GswePlanet planet2,
GError **err);
#endif /* __GSWE_MOMENT_H__ */

View File

@@ -38,7 +38,11 @@
* Moon, including its illumination percentage.
*/
G_DEFINE_BOXED_TYPE(GsweMoonPhaseData, gswe_moon_phase_data, (GBoxedCopyFunc)gswe_moon_phase_data_ref, (GBoxedFreeFunc)gswe_moon_phase_data_unref);
G_DEFINE_BOXED_TYPE(
GsweMoonPhaseData,
gswe_moon_phase_data,
(GBoxedCopyFunc)gswe_moon_phase_data_ref,
(GBoxedFreeFunc)gswe_moon_phase_data_unref);
/**
* gswe_moon_phase_data_new:
@@ -78,11 +82,16 @@ gswe_moon_phase_data_ref(GsweMoonPhaseData *moon_phase_data)
* gswe_moon_phase_data_unref:
* @moon_phase_data: (in): a #GsweMoonPhaseData
*
* Decreases reference count on @moon_phase_data by one. If reference count drops to zero, @moon_phase_data is freed.
* Decreases reference count on @moon_phase_data by one. If reference count
* drops to zero, @moon_phase_data is freed.
*/
void
gswe_moon_phase_data_unref(GsweMoonPhaseData *moon_phase_data)
{
if (moon_phase_data == NULL) {
return;
}
if (--moon_phase_data->refcount == 0) {
g_free(moon_phase_data);
}
@@ -97,12 +106,15 @@ gswe_moon_phase_data_unref(GsweMoonPhaseData *moon_phase_data)
* Calculates the moon at a given time, specified by @jd.
*/
void
gswe_moon_phase_data_calculate_by_jd(GsweMoonPhaseData *moon_phase_data, gdouble jd, GError **err)
gswe_moon_phase_data_calculate_by_jd(
GsweMoonPhaseData *moon_phase_data,
gdouble jd,
GError **err)
{
gdouble jdb,
phase_percent;
jdb = gswe_timestamp_get_julian_day(gswe_full_moon_base_date, err);
jdb = gswe_timestamp_get_julian_day_et(gswe_full_moon_base_date, err);
if ((err) && (*err)) {
return;
@@ -148,13 +160,16 @@ gswe_moon_phase_data_calculate_by_jd(GsweMoonPhaseData *moon_phase_data, gdouble
* Calculates the moon at a given time, specified by @timestamp.
*/
void
gswe_moon_phase_data_calculate_by_timestamp(GsweMoonPhaseData *moon_phase_data, GsweTimestamp *timestamp, GError **err)
gswe_moon_phase_data_calculate_by_timestamp(
GsweMoonPhaseData *moon_phase_data,
GsweTimestamp *timestamp,
GError **err)
{
gdouble jd;
jd = gswe_timestamp_get_julian_day(timestamp, err);
jd = gswe_timestamp_get_julian_day_et(timestamp, err);
if (*err) {
if (err && *err) {
return;
}

View File

@@ -28,8 +28,8 @@ G_BEGIN_DECLS
/**
* GsweMoonPhaseData:
*
* <structname>GsweMoonPhaseData</structname> is an opaque structure whose members
* cannot be accessed directly.
* <structname>GsweMoonPhaseData</structname> is an opaque structure whose
* members cannot be accessed directly.
*
* Since: 1.1
*/
@@ -38,13 +38,24 @@ typedef struct _GsweMoonPhaseData GsweMoonPhaseData;
GsweMoonPhaseData *gswe_moon_phase_data_new(void);
GsweMoonPhaseData *gswe_moon_phase_data_ref(GsweMoonPhaseData *moon_phase_data);
void gswe_moon_phase_data_unref(GsweMoonPhaseData *moon_phase_data);
void gswe_moon_phase_data_calculate_by_jd(GsweMoonPhaseData *moon_phase_data, gdouble jd, GError **err);
void gswe_moon_phase_data_calculate_by_timestamp(GsweMoonPhaseData *moon_phase_data, GsweTimestamp *timestamp, GError **err);
void gswe_moon_phase_data_calculate_by_jd(
GsweMoonPhaseData *moon_phase_data,
gdouble jd,
GError **err);
GsweMoonPhase gswe_moon_phase_data_get_phase(GsweMoonPhaseData *moon_phase_data);
gdouble gswe_moon_phase_data_get_illumination(GsweMoonPhaseData *moon_phase_data);
void gswe_moon_phase_data_calculate_by_timestamp(
GsweMoonPhaseData *moon_phase_data,
GsweTimestamp *timestamp,
GError **err);
GsweMoonPhase gswe_moon_phase_data_get_phase(
GsweMoonPhaseData *moon_phase_data);
gdouble gswe_moon_phase_data_get_illumination(
GsweMoonPhaseData *moon_phase_data);
GType gswe_moon_phase_data_get_type(void);
#define GSWE_TYPE_MOON_PHASE_DATA (gswe_moon_phase_data_get_type())

View File

@@ -35,7 +35,8 @@ struct _GswePlanetData {
/* Number of the house in which the planet is in */
gint house;
/* A GsweSignInfo structure, holding every information about the sign the planet is in */
/* A GsweSignInfo structure, holding every information about the sign the
* planet is in */
GsweSignInfo *sign_info;
/* An internal version number of the calculation */

View File

@@ -35,7 +35,11 @@
* is in.
*/
G_DEFINE_BOXED_TYPE(GswePlanetData, gswe_planet_data, (GBoxedCopyFunc)gswe_planet_data_ref, (GBoxedFreeFunc)gswe_planet_data_unref);
G_DEFINE_BOXED_TYPE(
GswePlanetData,
gswe_planet_data,
(GBoxedCopyFunc)gswe_planet_data_ref,
(GBoxedFreeFunc)gswe_planet_data_unref);
static void
gswe_planet_data_free(GswePlanetData *planet_data)
@@ -89,11 +93,16 @@ gswe_planet_data_ref(GswePlanetData *planet_data)
* gswe_planet_data_unref:
* @planet_data: a #GswePlanetData
*
* Decreases reference count on @planet_data by one. If reference count drops to zero, @planet_data is freed.
* Decreases reference count on @planet_data by one. If reference count drops
* to zero, @planet_data is freed.
*/
void
gswe_planet_data_unref(GswePlanetData *planet_data)
{
if (planet_data == NULL) {
return;
}
if (--planet_data->refcount == 0) {
gswe_planet_data_free(planet_data);
}
@@ -110,12 +119,21 @@ gswe_planet_data_unref(GswePlanetData *planet_data)
* GSWE_ERROR_UNKNOWN_PLANET, and the planet ID is not set.
*/
void
gswe_planet_data_set_planet(GswePlanetData *planet_data, GswePlanet planet, GError **err)
gswe_planet_data_set_planet(
GswePlanetData *planet_data,
GswePlanet planet,
GError **err)
{
GswePlanetInfo *planet_info;
if ((planet_info = g_hash_table_lookup(gswe_planet_info_table, GINT_TO_POINTER(planet))) == NULL) {
g_set_error(err, GSWE_ERROR, GSWE_ERROR_UNKNOWN_PLANET, "Planet is unknown");
if ((planet_info = g_hash_table_lookup(
gswe_planet_info_table,
GINT_TO_POINTER(planet)
)) == NULL) {
g_set_error(err,
GSWE_ERROR, GSWE_ERROR_UNKNOWN_PLANET,
"Planet is unknown"
);
return;
}
@@ -157,7 +175,9 @@ gswe_planet_data_get_planet(GswePlanetData *planet_data)
* Sets @planet_info as the planet information for @planet_data.
*/
void
gswe_planet_data_set_planet_info(GswePlanetData *planet_data, GswePlanetInfo *planet_info)
gswe_planet_data_set_planet_info(
GswePlanetData *planet_data,
GswePlanetInfo *planet_info)
{
if (planet_data == NULL) {
return;
@@ -247,7 +267,8 @@ gswe_planet_data_get_house(GswePlanetData *planet_data)
* gswe_planet_data_get_sign:
* @planet_data: a #GswePlanetData
*
* Gets the zodiac sign in which the planet is currently in. If the planet's data is not calculated yet, this function yields GSWE_PLANET_NONE.
* Gets the zodiac sign in which the planet is currently in. If the planet's
* data is not calculated yet, this function yields GSWE_PLANET_NONE.
*
* Returns: a #GsweZodiac, which @planet_data is currently in
*/

View File

@@ -42,18 +42,30 @@ GType gswe_planet_data_get_type(void);
GswePlanetData *gswe_planet_data_new(void);
GswePlanetData *gswe_planet_data_ref(GswePlanetData *planet_data);
void gswe_planet_data_unref(GswePlanetData *planet_data);
void gswe_planet_data_set_planet(GswePlanetData *planet_data, GswePlanet planet, GError **err);
void gswe_planet_data_set_planet(
GswePlanetData *planet_data,
GswePlanet planet,
GError **err);
GswePlanet gswe_planet_data_get_planet(GswePlanetData *planet_data);
void gswe_planet_data_set_planet_info(GswePlanetData *planet_data, GswePlanetInfo *planet_info);
void gswe_planet_data_set_planet_info(
GswePlanetData *planet_data,
GswePlanetInfo *planet_info);
GswePlanetInfo *gswe_planet_data_get_planet_info(GswePlanetData *planet_data);
gdouble gswe_planet_data_get_position(GswePlanetData *planet_data);
gboolean gswe_planet_data_get_retrograde(GswePlanetData *planet_data);
guint gswe_planet_data_get_house(GswePlanetData *planet_data);
GsweZodiac gswe_planet_data_get_sign(GswePlanetData *planet_data);
GsweSignInfo *gswe_planet_data_get_sign_info(GswePlanetData *planet_data);
G_END_DECLS

View File

@@ -26,10 +26,13 @@ struct _GswePlanetInfo {
/* the planet ID */
GswePlanet planet;
/* the planet ID according to the Swiss Ephemeris libarary (or -1, if the planet has no such ID) */
/* the planet ID according to the Swiss Ephemeris libarary (or -1, if the
* planet has no such ID) */
gint32 sweph_id;
/* TRUE if the planet is a "real" celestial body on the sky. Please note that this will be true for Dark Moon (Lilith). Everything that has a planet ID in Swiss Ephemeris is treated as a real celestial body. */
/* TRUE if the planet is a "real" celestial body on the sky. Please note
* that this will be true for Dark Moon (Lilith). Everything that has a
* planet ID in Swiss Ephemeris is treated as a real celestial body. */
gboolean real_body;
/* the planet's “personal” orb */

View File

@@ -30,7 +30,11 @@
* The #GswePlanetInfo structure stores information about a planet.
*/
G_DEFINE_BOXED_TYPE(GswePlanetInfo, gswe_planet_info, (GBoxedCopyFunc)gswe_planet_info_ref, (GBoxedFreeFunc)gswe_planet_info_unref);
G_DEFINE_BOXED_TYPE(
GswePlanetInfo,
gswe_planet_info,
(GBoxedCopyFunc)gswe_planet_info_ref,
(GBoxedFreeFunc)gswe_planet_info_unref);
/**
* gswe_planet_info_new:
@@ -80,7 +84,8 @@ gswe_planet_info_free(GswePlanetInfo *planet_info)
* gswe_planet_info_unref:
* @planet_info: a #GswePlanetInfo
*
* Decreases reference count on @planet_info. If reference count reaches zero, @planet_info is freed.
* Decreases reference count on @planet_info. If reference count reaches zero,
* @planet_info is freed.
*/
void
gswe_planet_info_unref(GswePlanetInfo *planet_info)
@@ -150,7 +155,8 @@ gswe_planet_info_get_sweph_id(GswePlanetInfo *planet_info)
* @real_body: a boolean that indicates if this planet is an object recognized
* by Swiss Ephemeris
*
* Sets whether this planet is an object recognized by the Swiss Ephemeris library.
* Sets whether this planet is an object recognized by the Swiss Ephemeris
* library.
*/
void
gswe_planet_info_set_real_body(GswePlanetInfo *planet_info, gboolean real_body)
@@ -162,7 +168,8 @@ gswe_planet_info_set_real_body(GswePlanetInfo *planet_info, gboolean real_body)
* gswe_planet_info_get_real_body:
* @planet_info: (in): A #GswePlanetInfo
*
* Checks weather this planet is a real celestial body (e.g. it has a Swiss Ephemeris planet ID) or not.
* Checks weather this planet is a real celestial body (e.g. it has a Swiss
* Ephemeris planet ID) or not.
*
* Returns: TRUE if the planet has a Swiss Ephemeris planet ID; FALSE otherwise
*/
@@ -236,7 +243,8 @@ gswe_planet_info_get_name(GswePlanetInfo *planet_info)
* @planet_info: a #GswePlanetInfo
* @points: the new point value
*
* Sets the point value of @planet_info. This value is used in points calculations.
* Sets the point value of @planet_info. This value is used in points
* calculations.
*/
void
gswe_planet_info_set_points(GswePlanetInfo *planet_info, gint points)

View File

@@ -40,24 +40,37 @@ GType gswe_planet_info_get_type(void);
GswePlanetInfo *gswe_planet_info_new(void);
GswePlanetInfo *gswe_planet_info_ref(GswePlanetInfo *planet_info);
void gswe_planet_info_unref(GswePlanetInfo *planet_info);
void gswe_planet_info_set_planet(GswePlanetInfo *planet_info, GswePlanet planet);
void gswe_planet_info_set_planet(
GswePlanetInfo *planet_info,
GswePlanet planet);
GswePlanet gswe_planet_info_get_planet(GswePlanetInfo *planet_info);
void gswe_planet_info_set_sweph_id(GswePlanetInfo *planet_info, gint32 sweph_id);
void gswe_planet_info_set_sweph_id(
GswePlanetInfo *planet_info,
gint32 sweph_id);
gint32 gswe_planet_info_get_sweph_id(GswePlanetInfo *planet_info);
void gswe_planet_info_set_real_body(GswePlanetInfo *planet_info, gboolean real_body);
void gswe_planet_info_set_real_body(
GswePlanetInfo *planet_info,
gboolean real_body);
gboolean gswe_planet_info_get_real_body(GswePlanetInfo *planet_info);
void gswe_planet_info_set_orb(GswePlanetInfo *planet_info, gdouble orb);
gdouble gswe_planet_info_get_orb(GswePlanetInfo *planet_info);
void gswe_planet_info_set_name(GswePlanetInfo *planet_info, const gchar *name);
const gchar *gswe_planet_info_get_name(GswePlanetInfo *planet_info);
void gswe_planet_info_set_points(GswePlanetInfo *planet_info, gint points);
gint gswe_planet_info_get_points(GswePlanetInfo *planet_info);
G_END_DECLS

View File

@@ -30,7 +30,10 @@
* The #GsweSignInfo stores information about a zodiac sign.
*/
G_DEFINE_BOXED_TYPE(GsweSignInfo, gswe_sign_info, (GBoxedCopyFunc)gswe_sign_info_ref, (GBoxedFreeFunc)gswe_sign_info_unref);
G_DEFINE_BOXED_TYPE(GsweSignInfo,
gswe_sign_info,
(GBoxedCopyFunc)gswe_sign_info_ref,
(GBoxedFreeFunc)gswe_sign_info_unref);
static void
gswe_sign_info_free(GsweSignInfo *sign_info)
@@ -80,7 +83,8 @@ gswe_sign_info_ref(GsweSignInfo *sign_info)
* gswe_sign_info_unref:
* @sign_info: a #GsweSignInfo
*
* Decreases reference count or @sign_info. If reference count reaches zero, @sign_info is freed.
* Decreases reference count or @sign_info. If reference count reaches zero,
* @sign_info is freed.
*/
void
gswe_sign_info_unref(GsweSignInfo *sign_info)

File diff suppressed because it is too large Load Diff

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