From c2fd5555505092a37e66458cb7ef0bddac75a8a9 Mon Sep 17 00:00:00 2001 From: "Gergely POLONKAI (W00d5t0ck)" Date: Tue, 3 Sep 2013 12:01:08 +0200 Subject: [PATCH] (split from Astrognome)Added mirror point axes --- src/gswe-types.h | 15 +++++++++++++++ src/swe-glib.c | 24 ++++++++++++++++++++++++ src/swe-glib.h | 1 + 3 files changed, 40 insertions(+) diff --git a/src/gswe-types.h b/src/gswe-types.h index 0f9c846..8cee229 100644 --- a/src/gswe-types.h +++ b/src/gswe-types.h @@ -59,6 +59,14 @@ typedef enum { GSWE_ASPECT_QUINCUNX } GsweAspect; +typedef enum { + GSWE_MIRROR_NONE, + GSWE_MIRROR_ARIES, + GSWE_MIRROR_MID_TAURUS, + GSWE_MIRROR_CANCER, + GSWE_MIRROR_MID_LEO +} GsweMirror; + typedef enum { GSWE_ELEMENT_NONE, GSWE_ELEMENT_FIRE, @@ -156,5 +164,12 @@ typedef struct { gboolean major; } GsweAspectInfo; +typedef struct { + GsweMirror mirror_id; + GsweSignInfo *start_sign; + gchar *name; + gboolean middle_axis; +} GsweMirrorInfo; + #endif /* __SWE_GLIB_GSWE_PLANETS_H__ */ diff --git a/src/swe-glib.c b/src/swe-glib.c index 13308d5..4e1df4b 100644 --- a/src/swe-glib.c +++ b/src/swe-glib.c @@ -11,6 +11,7 @@ GHashTable *gswe_planet_info_table; GHashTable *gswe_sign_info_table; GHashTable *gswe_house_system_info_table; GHashTable *gswe_aspect_info_table; +GHashTable *gswe_mirror_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); \ @@ -50,6 +51,13 @@ GsweTimestamp *gswe_full_moon_base_date; (v)->major = (m); \ g_hash_table_replace((ht), GINT_TO_POINTER(i), (v)); +#define ADD_MIRROR(ht, v, hts, vs, i, n, s, m) (v) = g_new0(GsweMirrorInfo, 1); \ + (vs) = g_hash_table_lookup((hts), GINT_TO_POINTER(i)); \ + (v)->mirror_id = (i); \ + (v)->start_sign = (vs); \ + (v)->name = g_strdup(n); \ + (v)->middle_axis = m; \ + g_hash_table_replace((ht), GINT_TO_POINTER(i), (v)); void gswe_free_planet_info(gpointer planet_info) { @@ -78,6 +86,13 @@ gswe_free_aspect_info(gpointer aspect_info) g_free(aspect_info); } +void +gswe_free_mirror_info(gpointer mirror_info) +{ + g_free(((GsweMirrorInfo *)mirror_info)->name); + g_free(mirror_info); +} + /** * gswe_init: * @sweph_path: the file system path to the Swiss Ephemeris data files @@ -92,6 +107,7 @@ gswe_init(gchar *sweph_path) GsweSignInfo *sign_info; GsweHouseSystemInfo *house_system_info; GsweAspectInfo *aspect_info; + GsweMirrorInfo *mirror_info; bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); @@ -158,6 +174,14 @@ gswe_init(gchar *sweph_path) ADD_ASPECT(gswe_aspect_info_table, aspect_info, GSWE_ASPECT_QUINTILE, _("Quintile"), 72, 3, TRUE, FALSE); ADD_ASPECT(gswe_aspect_info_table, aspect_info, GSWE_ASPECT_BIQUINTILE, _("Bi-quintile"), 144, 3, TRUE, FALSE); + gswe_mirror_info_table = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, gswe_free_mirror_info); + + ADD_MIRROR(gswe_mirror_info_table, mirror_info, gswe_sign_info_table, sign_info, GSWE_MIRROR_NONE, _("None"), GSWE_SIGN_NONE, FALSE); + ADD_MIRROR(gswe_mirror_info_table, mirror_info, gswe_sign_info_table, sign_info, GSWE_MIRROR_ARIES, _("Aries/Libra"), GSWE_SIGN_ARIES, FALSE); + ADD_MIRROR(gswe_mirror_info_table, mirror_info, gswe_sign_info_table, sign_info, GSWE_MIRROR_MID_TAURUS, _("mid Taurus/Scorpio"), GSWE_SIGN_TAURUS, TRUE); + ADD_MIRROR(gswe_mirror_info_table, mirror_info, gswe_sign_info_table, sign_info, GSWE_MIRROR_CANCER, _("Cancer/Capricorn"), GSWE_SIGN_CANCER, FALSE); + ADD_MIRROR(gswe_mirror_info_table, mirror_info, gswe_sign_info_table, sign_info, GSWE_MIRROR_MID_LEO, _("mid Leo/Aquarius"), GSWE_SIGN_LEO, TRUE); + gswe_full_moon_base_date = gswe_timestamp_new_from_gregorian_full(2005, 5, 8, 3, 48, 0, 0, 0.0); gswe_ephe_path = g_strdup(sweph_path); diff --git a/src/swe-glib.h b/src/swe-glib.h index ec8f5f3..3e3a9a3 100644 --- a/src/swe-glib.h +++ b/src/swe-glib.h @@ -10,6 +10,7 @@ extern GHashTable *gswe_planet_info_table; extern GHashTable *gswe_sign_info_table; extern GHashTable *gswe_house_system_info_table; extern GHashTable *gswe_aspect_info_table; +extern GHashTable *gswe_mirror_info_table; void gswe_init(gchar *sweph_path);