diff --git a/docs/reference/swe-glib/Makefile.am b/docs/reference/swe-glib/Makefile.am index 0792a53..fe5818e 100644 --- a/docs/reference/swe-glib/Makefile.am +++ b/docs/reference/swe-glib/Makefile.am @@ -62,6 +62,7 @@ IGNORE_HFILES = \ swe-glib-private.h \ gswe-enumtypes.h \ gswe-moon-phase-data-private.h \ + gswe-planet-info-private.h \ gswe-planet-data-private.h \ gswe-aspect-info-private.h \ gswe-aspect-data-private.h \ diff --git a/docs/reference/swe-glib/swe-glib-docs.xml b/docs/reference/swe-glib/swe-glib-docs.xml index b9cd0c9..673bf8f 100644 --- a/docs/reference/swe-glib/swe-glib-docs.xml +++ b/docs/reference/swe-glib/swe-glib-docs.xml @@ -19,6 +19,7 @@ SWE-GLib + diff --git a/docs/reference/swe-glib/swe-glib-sections.txt b/docs/reference/swe-glib/swe-glib-sections.txt index b399414..d737f61 100644 --- a/docs/reference/swe-glib/swe-glib-sections.txt +++ b/docs/reference/swe-glib/swe-glib-sections.txt @@ -55,6 +55,20 @@ GSWE_TYPE_MOON_PHASE_DATA gswe_moon_phase_data_get_type +
+gswe-planet-info +GswePlanetInfo +gswe_planet_info_get_name +gswe_planet_info_get_orb +gswe_planet_info_get_planet +gswe_planet_info_get_points +gswe_planet_info_get_real_body +gswe_planet_info_get_sweph_id + +GSWE_TYPE_PLANET_INFO +gswe_planet_info_get_type +
+
gswe-planet-data GswePlanetData @@ -175,7 +189,6 @@ GsweElement GsweQuality GsweHouseSystem GsweMoonPhase -GswePlanetInfo GsweSignInfo GsweHouseSystemInfo GsweCoordinates @@ -191,9 +204,7 @@ gswe_house_data_get_type swe-glib gswe_init -GSWE_TYPE_PLANET_INFO GSWE_TYPE_SIGN_INFO -gswe_planet_info_get_type gswe_sign_info_get_type
diff --git a/src/Makefile.am b/src/Makefile.am index ad5c9fa..c32c1fb 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -11,6 +11,7 @@ INST_H_SRC_FILES = \ gswe-aspect-data.h \ gswe-antiscion-axis-info.h \ gswe-antiscion-data.h \ + gswe-planet-info.h \ gswe-planet-data.h \ gswe-moment.h \ gswe-timestamp.h \ @@ -25,6 +26,7 @@ libswe_glib_1_0_la_SOURCES = \ swe-glib.c \ gswe-types.c \ gswe-moon-phase-data.c \ + gswe-planet-info.c \ gswe-planet-data.c \ gswe-aspect-info.c \ gswe-aspect-data.c \ diff --git a/src/gswe-planet-data-private.h b/src/gswe-planet-data-private.h index 782bda5..0a2a9ec 100644 --- a/src/gswe-planet-data-private.h +++ b/src/gswe-planet-data-private.h @@ -20,6 +20,7 @@ #define __SWE_GLIB_GSWE_PLANET_DATA_PRIVATE_H__ #include "gswe-planet-data.h" +#include "gswe-planet-info.h" struct _GswePlanetData { /* A GswePlanet, the identifier of the planet */ diff --git a/src/gswe-planet-data.h b/src/gswe-planet-data.h index 55fa71a..8c2137c 100644 --- a/src/gswe-planet-data.h +++ b/src/gswe-planet-data.h @@ -21,6 +21,7 @@ #include #include "gswe-types.h" +#include "gswe-planet-info.h" G_BEGIN_DECLS diff --git a/src/gswe-planet-info-private.h b/src/gswe-planet-info-private.h new file mode 100644 index 0000000..245801d --- /dev/null +++ b/src/gswe-planet-info-private.h @@ -0,0 +1,52 @@ +/* gswe-planet-info-private.h: Private parts of GswePlanetInfo + * + * Copyright © 2013 Gergely Polonkai + * + * SWE-GLib is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * SWE-GLib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this library; if not, see . + */ +#ifdef __SWE_GLIB_BUILDING__ +#ifndef __SWE_GLIB_GSWE_PLANET_INFO_PRIVATE_H__ +#define __SWE_GLIB_GSWE_PLANET_INFO_PRIVATE_H__ + +#include "gswe-types.h" +#include "gswe-planet-info.h" + +struct _GswePlanetInfo { + /* the planet ID */ + GswePlanet planet; + + /* the planet ID according to the Swiss Ephemeris libarary (or -1, if the planet has no such ID) */ + gint32 sweph_id; + + /* TRUE if the planet is a "real" celestial body on the sky. Please note that this will be true for Dark Moon (Lilith). Everything that has a planet ID in Swiss Ephemeris is treated as a real celestial body. */ + gboolean real_body; + + /* the planet's “personal” orb */ + gdouble orb; + + /* the planet's name */ + gchar *name; + + /* the value this planet counts in the element/quality points table */ + gint points; +}; + +void gswe_planet_info_free(GswePlanetInfo *planet_info); +GswePlanetInfo *gswe_planet_info_copy(GswePlanetInfo *planet_info); + +#endif /* __SWE_GLIB_GSWE_PLANET_INFO_PRIVATE_H__ */ +#else /* not defined __SWE_GLIB_BUILDING__ */ +#error __FILE__ "Can not be included, unless building SWE-GLib" +#endif /* __SWE_GLIB_BUILDING__ */ + diff --git a/src/gswe-planet-info.c b/src/gswe-planet-info.c new file mode 100644 index 0000000..5393db3 --- /dev/null +++ b/src/gswe-planet-info.c @@ -0,0 +1,164 @@ +/* gswe-planet-info.c: Planet related information + * + * Copyright © 2013 Gergely Polonkai + * + * SWE-GLib is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * SWE-GLib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this library; if not, see . + */ +#include "gswe-types.h" + +#include "gswe-planet-info.h" +#include "gswe-planet-info-private.h" + +/** + * SECTION:gswe-planet-info + * @short_description: a structure storing information about a planet + * @title: GswePlanetInfo + * @stability: Stable + * @include: swe-glib.h + * + * The #GswePlanetInfo structure stores information about a planet. + */ + +G_DEFINE_BOXED_TYPE(GswePlanetInfo, gswe_planet_info, (GBoxedCopyFunc)gswe_planet_info_copy, (GBoxedFreeFunc)gswe_planet_info_free); + +GswePlanetInfo * +gswe_planet_info_copy(GswePlanetInfo *planet_info) +{ + GswePlanetInfo *ret = g_new0(GswePlanetInfo, 1); + + ret->planet = planet_info->planet; + ret->sweph_id = planet_info->sweph_id; + ret->real_body = planet_info->real_body; + ret->orb = planet_info->orb; + ret->name = g_strdup(planet_info->name); + ret->points = planet_info->points; + + return ret; +} + +void +gswe_planet_info_free(GswePlanetInfo *planet_info) +{ + g_free(planet_info->name); + g_free(planet_info); +} + +/** + * gswe_planet_info_get_planet: + * @planet_info: (in) (allow-none): A #GswePlanetInfo + * + * Gets the planet ID represented by this #GswePlanetInfo. + * + * Returns: the planet ID + */ +GswePlanet +gswe_planet_info_get_planet(GswePlanetInfo *planet_info) +{ + if (planet_info) { + return planet_info->planet; + } else { + return GSWE_PLANET_NONE; + } +} + +/** + * gswe_planet_info_get_sweph_id: + * @planet_info: (in) (allow-none): A #GswePlanetInfo + * + * Gets the Swiss Ephemeris planet ID associated with this planet. + * + * Returns: the Swiss Ephemeris planet ID + */ +gint32 +gswe_planet_info_get_sweph_id(GswePlanetInfo *planet_info) +{ + if (planet_info) { + return planet_info->sweph_id; + } else { + return -1; + } +} + +/** + * gswe_planet_info_get_real_body: + * @planet_info: (in) (allow-none): A #GswePlanetInfo + * + * Checks weather this planet is a real celestial body (e.g. it has a Swiss Ephemeris planet ID) or not. + * + * Returns: TRUE if the planet has a Swiss Ephemeris planet ID; FALSE otherwise + */ +gboolean +gswe_planet_info_get_real_body(GswePlanetInfo *planet_info) +{ + if (planet_info) { + return planet_info->real_body; + } else { + return FALSE; + } +} + +/** + * gswe_planet_info_get_orb: + * @planet_info: (in) (allow-none): A #GswePlanetInfo + * + * Gets the orb of the planet. + * + * Returns: the orb, in degrees + */ +gdouble +gswe_planet_info_get_orb(GswePlanetInfo *planet_info) +{ + if (planet_info) { + return planet_info->orb; + } else { + return -1.0; + } +} + +/** + * gswe_planet_info_get_name: + * @planet_info: (in) (allow-none): A #GswePlanetInfo + * + * Gets the name of the planet. + * + * Returns: (transfer none): the planet's name + */ +const gchar * +gswe_planet_info_get_name(GswePlanetInfo *planet_info) +{ + if (planet_info) { + return planet_info->name; + } else { + return NULL; + } +} + +/** + * gswe_planet_info_get_points: + * @planet_info: (in) (allow-none): A #GswePlanetInfo + * + * Gets the value this planet counts in point calculations. + * + * Returns: the point value + */ +gint +gswe_planet_info_get_points(GswePlanetInfo *planet_info) +{ + if (planet_info) { + return planet_info->points; + } else { + return 0; + } +} + diff --git a/src/gswe-planet-info.h b/src/gswe-planet-info.h new file mode 100644 index 0000000..e832b90 --- /dev/null +++ b/src/gswe-planet-info.h @@ -0,0 +1,50 @@ +/* gswe-planet-info.h: Planet related information + * + * Copyright © 2013 Gergely Polonkai + * + * SWE-GLib is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * SWE-GLib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this library; if not, see . + */ +#ifndef __SWE_GLIB_GSWE_PLANET_INFO_H__ +#define __SWE_GLIB_GSWE_PLANET_INFO_H__ + +#include + +#include "gswe-types.h" + +G_BEGIN_DECLS + +/** + * GswePlanetInfo: + * + * GswePlanetInfo is an opaque structure whose members + * cannot be accessed directly. + * + * Since: 1.1 + */ +typedef struct _GswePlanetInfo GswePlanetInfo; + +GType gswe_planet_info_get_type(void); +#define GSWE_TYPE_PLANET_INFO (gswe_planet_info_get_type()) + +GswePlanet gswe_planet_info_get_planet(GswePlanetInfo *planet_info); +gint32 gswe_planet_info_get_sweph_id(GswePlanetInfo *planet_info); +gboolean gswe_planet_info_get_real_body(GswePlanetInfo *planet_info); +gdouble gswe_planet_info_get_orb(GswePlanetInfo *planet_info); +const gchar *gswe_planet_info_get_name(GswePlanetInfo *planet_info); +gint gswe_planet_info_get_points(GswePlanetInfo *planet_info); + +G_END_DECLS + +#endif /* __SWE_GLIB_GSWE_PLANET_INFO_PRIVATE_H__ */ + diff --git a/src/gswe-types.h b/src/gswe-types.h index fc53b6a..515af7c 100644 --- a/src/gswe-types.h +++ b/src/gswe-types.h @@ -249,44 +249,6 @@ typedef enum { GSWE_MOON_PHASE_DARK } GsweMoonPhase; -/** - * GswePlanetInfo: - * @planet: the planet ID - * @sweph_id: the planet ID according to the Swiss Ephemeris libarary - * (or -1, if the planet has no such ID) - * @real_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. - * @orb: the planet's “personal” orb - * @name: the planet's name - * @points: the value this planet counts in the element/quality points - * table - * @domicile_sign_1: the first sign in which the planet is domicile - * @domicile_sign_2: the second sign in which the planet is domicile - * @exile_sign_1: the first sign in which the planet is in exile - * @exile_sign_2: the second sign in which the planet is in exile - * @exalted_sign: the sign in which the planet is exalted - * @fall_sign: the sign in which the planet is in fall - * - * This struct holds different informations of planets. You should never modify - * such a structure unless you really know what you are doing. - */ -typedef struct { - GswePlanet planet; - gint sweph_id; - gboolean real_body; - gdouble orb; - gchar *name; - gint points; - GsweZodiac domicile_sign_1; - GsweZodiac domicile_sign_2; - GsweZodiac exile_sign_1; - GsweZodiac exile_sign_2; - GsweZodiac exalted_sign; - GsweZodiac fall_sign; -} GswePlanetInfo; - /** * GsweSignInfo: * @sign_id: the identifier for this sign diff --git a/src/swe-glib-private.h b/src/swe-glib-private.h index f0640f0..3923f40 100644 --- a/src/swe-glib-private.h +++ b/src/swe-glib-private.h @@ -20,6 +20,7 @@ #include "gswe-timestamp.h" #include "gswe-types.h" #include "gswe-moon-phase-data-private.h" +#include "gswe-planet-info-private.h" #include "gswe-planet-data-private.h" #include "gswe-aspect-info-private.h" #include "gswe-aspect-data-private.h" diff --git a/src/swe-glib.c b/src/swe-glib.c index 6f0f450..3aed1a6 100644 --- a/src/swe-glib.c +++ b/src/swe-glib.c @@ -43,50 +43,50 @@ GHashTable *gswe_aspect_info_table; GHashTable *gswe_antiscion_axis_info_table; GsweTimestamp *gswe_full_moon_base_date; -#define ADD_PLANET(ht, v, i, s, r, n, o, h, dom1, dom2, exi1, exi2, exa, fal) (v) = g_new0(GswePlanetInfo, 1); \ - (v)->planet = (i); \ - (v)->sweph_id = (s); \ - (v)->real_body = (r); \ - (v)->orb = (o); \ - (v)->name = g_strdup(n); \ - (v)->points = (h); \ - (v)->domicile_sign_1 = (dom1); \ - (v)->domicile_sign_2 = (dom2); \ - (v)->exile_sign_1 = (exi1); \ - (v)->exile_sign_2 = (exi2); \ - (v)->exalted_sign = (exa); \ - (v)->fall_sign = (fal); \ - g_hash_table_replace((ht), GINT_TO_POINTER(i), (v)); +#define ADD_PLANET(ht, v, i, s, r, n, o, h) \ + (v) = g_new0(GswePlanetInfo, 1); \ + (v)->planet = (i); \ + (v)->sweph_id = (s); \ + (v)->real_body = (r); \ + (v)->orb = (o); \ + (v)->name = g_strdup(n); \ + (v)->points = (h); \ + g_hash_table_replace((ht), GINT_TO_POINTER(i), (v)); -#define ADD_SIGN(ht, v, s, n, e, q) (v) = g_new0(GsweSignInfo, 1); \ - (v)->sign_id = (s); \ - (v)->name = g_strdup(n); \ - (v)->element = (e); \ - (v)->quality = (q); \ - g_hash_table_replace((ht), GINT_TO_POINTER(s), (v)); +#define ADD_SIGN(ht, v, s, n, e, q) \ + (v) = g_new0(GsweSignInfo, 1); \ + (v)->sign_id = (s); \ + (v)->name = g_strdup(n); \ + (v)->element = (e); \ + (v)->quality = (q); \ + g_hash_table_replace((ht), GINT_TO_POINTER(s), (v)); -#define ADD_HOUSE_SYSTEM(ht, v, i, s, n) (v) = g_new0(GsweHouseSystemInfo, 1); \ - (v)->system = i; \ - (v)->sweph_id = s; \ - (v)->name = g_strdup(n); \ - g_hash_table_replace((ht), GINT_TO_POINTER(i), (v)); +#define ADD_HOUSE_SYSTEM(ht, v, i, s, n) \ + (v) = g_new0(GsweHouseSystemInfo, 1); \ + (v)->system = i; \ + (v)->sweph_id = s; \ + (v)->name = g_strdup(n); \ + g_hash_table_replace((ht), GINT_TO_POINTER(i), (v)); -#define ADD_ASPECT(ht, v, i, n, s, o, h, m) (v) = g_new0(GsweAspectInfo, 1); \ - (v)->aspect = (i); \ - (v)->name = g_strdup(n); \ - (v)->size = (s); \ - (v)->orb_modifier = (o); \ - (v)->harmonic = (h); \ - (v)->major = (m); \ - g_hash_table_replace((ht), GINT_TO_POINTER(i), (v)); +#define ADD_ASPECT(ht, v, i, n, s, o, h, m) \ + (v) = g_new0(GsweAspectInfo, 1); \ + (v)->aspect = (i); \ + (v)->name = g_strdup(n); \ + (v)->size = (s); \ + (v)->orb_modifier = (o); \ + (v)->harmonic = (h); \ + (v)->major = (m); \ + g_hash_table_replace((ht), GINT_TO_POINTER(i), (v)); + +#define ADD_ANTISCION(ht, v, hts, vs, i, n, s, m) \ + (v) = g_new0(GsweAntiscionAxisInfo, 1); \ + (vs) = g_hash_table_lookup((hts), GINT_TO_POINTER(i)); \ + (v)->axis = (i); \ + (v)->start_sign = (vs); \ + (v)->name = g_strdup(n); \ + (v)->sign_offset = m; \ + g_hash_table_replace((ht), GINT_TO_POINTER(i), (v)); -#define ADD_ANTISCION(ht, v, hts, vs, i, n, s, m) (v) = g_new0(GsweAntiscionAxisInfo, 1); \ - (vs) = g_hash_table_lookup((hts), GINT_TO_POINTER(i)); \ - (v)->axis = (i); \ - (v)->start_sign = (vs); \ - (v)->name = g_strdup(n); \ - (v)->sign_offset = m; \ - g_hash_table_replace((ht), GINT_TO_POINTER(i), (v)); void gswe_free_planet_info(gpointer planet_info) { @@ -142,26 +142,26 @@ gswe_init(void) gswe_planet_info_table = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, gswe_free_planet_info); - ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_SUN, SE_SUN, TRUE, _("Sun"), 13.0, 2, GSWE_SIGN_LEO, GSWE_SIGN_NONE, GSWE_SIGN_AQUARIUS, GSWE_SIGN_NONE, GSWE_SIGN_ARIES, GSWE_SIGN_LIBRA); - ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_MOON, SE_MOON, TRUE, _("Moon"), 9.0, 2, GSWE_SIGN_CANCER, GSWE_SIGN_NONE, GSWE_SIGN_CAPRICORN, GSWE_SIGN_NONE, GSWE_SIGN_TAURUS, GSWE_SIGN_SCORPIO); - ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_MERCURY, SE_MERCURY, TRUE, _("Mercury"), 7.0, 2, GSWE_SIGN_GEMINI, GSWE_SIGN_VIRGO, GSWE_SIGN_SAGITTARIUS, GSWE_SIGN_PISCES, GSWE_SIGN_VIRGO, GSWE_SIGN_PISCES); - ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_VENUS, SE_VENUS, TRUE, _("Venus"), 7.0, 1, GSWE_SIGN_TAURUS, GSWE_SIGN_LIBRA, GSWE_SIGN_SCORPIO, GSWE_SIGN_ARIES, GSWE_SIGN_PISCES, GSWE_SIGN_VIRGO); - ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_MARS, SE_MARS, TRUE, _("Mars"), 7.0, 1, GSWE_SIGN_ARIES, GSWE_SIGN_SCORPIO, GSWE_SIGN_LIBRA, GSWE_SIGN_TAURUS, GSWE_SIGN_CAPRICORN, GSWE_SIGN_CANCER); - ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_JUPITER, SE_JUPITER, TRUE, _("Jupiter"), 9.0, 1, GSWE_SIGN_SAGITTARIUS, GSWE_SIGN_PISCES, GSWE_SIGN_GEMINI, GSWE_SIGN_VIRGO, GSWE_SIGN_CANCER, GSWE_SIGN_CAPRICORN); - ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_SATURN, SE_SATURN, TRUE, _("Saturn"), 7.0, 1, GSWE_SIGN_CAPRICORN, GSWE_SIGN_AQUARIUS, GSWE_SIGN_CANCER, GSWE_SIGN_LEO, GSWE_SIGN_LIBRA, GSWE_SIGN_ARIES); - ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_URANUS, SE_URANUS, TRUE, _("Uranus"), 5.0, 1, GSWE_SIGN_AQUARIUS, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE); - ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_NEPTUNE, SE_NEPTUNE, TRUE, _("Neptune"), 5.0, 1, GSWE_SIGN_PISCES, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE); - ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_PLUTO, SE_PLUTO, TRUE, _("Pluto"), 3.0, 1, GSWE_SIGN_SCORPIO, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE); - ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_CHIRON, SE_CHIRON, TRUE, _("Chiron"), 2.0, 0, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE); - ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_CERES, SE_CERES, TRUE, _("Ceres"), 2.0, 0, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE); - ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_PALLAS, SE_PALLAS, TRUE, _("Pallas"), 2.0, 0, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE); - ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_JUNO, SE_JUNO, TRUE, _("Juno"), 2.0, 0, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE); - ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_VESTA, SE_VESTA, TRUE, _("Vesta"), 2.0, 0, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE); - ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_MOON_NODE, SE_MEAN_NODE, TRUE, _("Ascending Moon Node"), 2.0, 1, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE); - ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_MOON_APOGEE, SE_MEAN_APOG, TRUE, _("Dark Moon"), 2.0, 0, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE); - ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_ASCENDENT, -1, FALSE, _("Ascendent"), 9.0, 2, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE); - ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_MC, -1, FALSE, _("Midheaven"), 5.0, 1, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE); - ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_VERTEX, -1, FALSE, _("Vertex"), 2.0, 0, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE); + ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_SUN, SE_SUN, TRUE, _("Sun"), 13.0, 2); + ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_MOON, SE_MOON, TRUE, _("Moon"), 9.0, 2); + ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_MERCURY, SE_MERCURY, TRUE, _("Mercury"), 7.0, 2); + ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_VENUS, SE_VENUS, TRUE, _("Venus"), 7.0, 1); + ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_MARS, SE_MARS, TRUE, _("Mars"), 7.0, 1); + ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_JUPITER, SE_JUPITER, TRUE, _("Jupiter"), 9.0, 1); + ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_SATURN, SE_SATURN, TRUE, _("Saturn"), 7.0, 1); + ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_URANUS, SE_URANUS, TRUE, _("Uranus"), 5.0, 1); + ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_NEPTUNE, SE_NEPTUNE, TRUE, _("Neptune"), 5.0, 1); + ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_PLUTO, SE_PLUTO, TRUE, _("Pluto"), 3.0, 1); + ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_CHIRON, SE_CHIRON, TRUE, _("Chiron"), 2.0, 0); + ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_CERES, SE_CERES, TRUE, _("Ceres"), 2.0, 0); + ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_PALLAS, SE_PALLAS, TRUE, _("Pallas"), 2.0, 0); + ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_JUNO, SE_JUNO, TRUE, _("Juno"), 2.0, 0); + ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_VESTA, SE_VESTA, TRUE, _("Vesta"), 2.0, 0); + ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_MOON_NODE, SE_MEAN_NODE, TRUE, _("Ascending Moon Node"), 2.0, 1); + ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_MOON_APOGEE, SE_MEAN_APOG, TRUE, _("Dark Moon"), 2.0, 0); + ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_ASCENDENT, -1, FALSE, _("Ascendent"), 9.0, 2); + ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_MC, -1, FALSE, _("Midheaven"), 5.0, 1); + ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_VERTEX, -1, FALSE, _("Vertex"), 2.0, 0); gswe_sign_info_table = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, gswe_free_sign_info); @@ -217,36 +217,6 @@ gswe_init(void) gswe_initialized = TRUE; } -static GswePlanetInfo * -gswe_planet_info_copy(GswePlanetInfo *planet_info) -{ - GswePlanetInfo *ret = g_new0(GswePlanetInfo, 1); - - ret->planet = planet_info->planet; - ret->sweph_id = planet_info->sweph_id; - ret->real_body = planet_info->real_body; - ret->orb = planet_info->orb; - ret->name = g_strdup(planet_info->name); - ret->points = planet_info->points; - ret->domicile_sign_1 = planet_info->domicile_sign_1; - ret->domicile_sign_2 = planet_info->domicile_sign_2; - ret->exile_sign_1 = planet_info->exile_sign_1; - ret->exile_sign_2 = planet_info->exile_sign_2; - ret->exalted_sign = planet_info->exalted_sign; - ret->fall_sign = planet_info->fall_sign; - - return ret; -} - -static void -gswe_planet_info_free(GswePlanetInfo *planet_info) -{ - g_free(planet_info->name); - g_free(planet_info); -} - -G_DEFINE_BOXED_TYPE(GswePlanetInfo, gswe_planet_info, (GBoxedCopyFunc)gswe_planet_info_copy, (GBoxedFreeFunc)gswe_planet_info_free); - static GsweSignInfo * gswe_sign_info_copy(GsweSignInfo *sign_info) { diff --git a/src/swe-glib.h b/src/swe-glib.h index e3ab838..a4ef8f9 100644 --- a/src/swe-glib.h +++ b/src/swe-glib.h @@ -21,6 +21,7 @@ #include #include "gswe-types.h" #include "gswe-moon-phase-data.h" +#include "gswe-planet-info.h" #include "gswe-planet-data.h" #include "gswe-aspect-info.h" #include "gswe-aspect-data.h" @@ -32,9 +33,6 @@ void gswe_init(); -GType gswe_planet_info_get_type(void); -#define GSWE_TYPE_PLANET_INFO (gswe_planet_info_get_type()) - GType gswe_sign_info_get_type(void); #define GSWE_TYPE_SIGN_INFO (gswe_sign_info_get_type())