(split from Astrognome)Added aspect definitions to SWE-GLib

This commit is contained in:
Gergely Polonkai 2013-09-02 23:49:17 +02:00
parent 1467ae8b8c
commit f5525ffdd8
3 changed files with 42 additions and 0 deletions

View File

@ -147,5 +147,14 @@ typedef struct {
gchar *name;
} GsweHouseSystemInfo;
typedef struct {
GsweAspect aspect;
gchar *name;
guint size;
guint orb_modifier;
gboolean harmonic;
gboolean major;
} GsweAspectInfo;
#endif /* __SWE_GLIB_GSWE_PLANETS_H__ */

View File

@ -10,6 +10,7 @@ gchar *gswe_ephe_path = NULL;
GHashTable *gswe_planet_info_table;
GHashTable *gswe_sign_info_table;
GHashTable *gswe_house_system_info_table;
GHashTable *gswe_aspect_info_table;
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); \
@ -40,6 +41,15 @@ GsweTimestamp *gswe_full_moon_base_date;
(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));
void
gswe_free_planet_info(gpointer planet_info)
{
@ -61,6 +71,13 @@ gswe_free_house_system_info(gpointer house_system_info)
g_free(house_system_info);
}
void
gswe_free_aspect_info(gpointer aspect_info)
{
g_free(((GsweAspectInfo *)aspect_info)->name);
g_free(aspect_info);
}
/**
* gswe_init:
* @sweph_path: the file system path to the Swiss Ephemeris data files
@ -74,6 +91,7 @@ gswe_init(gchar *sweph_path)
GswePlanetInfo *planet_info;
GsweSignInfo *sign_info;
GsweHouseSystemInfo *house_system_info;
GsweAspectInfo *aspect_info;
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
@ -123,6 +141,20 @@ gswe_init(gchar *sweph_path)
ADD_HOUSE_SYSTEM(gswe_house_system_info_table, house_system_info, GSWE_HOUSE_SYSTEM_KOCH, 'K', _("Koch"));
ADD_HOUSE_SYSTEM(gswe_house_system_info_table, house_system_info, GSWE_HOUSE_SISTEM_EQUAL, 'E', _("Equal"));
gswe_aspect_info_table = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, gswe_free_aspect_info);
ADD_ASPECT(gswe_aspect_info_table, aspect_info, GSWE_ASPECT_CONJUCTION, "Conjuction", 0, 0, TRUE, TRUE);
ADD_ASPECT(gswe_aspect_info_table, aspect_info, GSWE_ASPECT_OPPOSITION, "Opposition", 180, 0, TRUE, TRUE);
ADD_ASPECT(gswe_aspect_info_table, aspect_info, GSWE_ASPECT_TRINE, "Trine", 120, 0, TRUE, TRUE);
ADD_ASPECT(gswe_aspect_info_table, aspect_info, GSWE_ASPECT_SQUARE, "Square", 90, 0, FALSE, TRUE);
ADD_ASPECT(gswe_aspect_info_table, aspect_info, GSWE_ASPECT_SEXTILE, "Sextile", 60, 1, TRUE, TRUE);
ADD_ASPECT(gswe_aspect_info_table, aspect_info, GSWE_ASPECT_QUINCUNX, "Quincunx", 150, 2, FALSE, FALSE);
ADD_ASPECT(gswe_aspect_info_table, aspect_info, GSWE_ASPECT_SEMISEXTILE, "Semi-sextile", 30, 2, TRUE, FALSE);
ADD_ASPECT(gswe_aspect_info_table, aspect_info, GSWE_ASPECT_SEMISQUARE, "Semi-square", 45, 2, FALSE, FALSE);
ADD_ASPECT(gswe_aspect_info_table, aspect_info, GSWE_ASPECT_SESQUISQUARE, "Sesqui-square", 135, 2, FALSE, FALSE);
ADD_ASPECT(gswe_aspect_info_table, aspect_info, GSWE_ASPECT_QUINTILE, "Quintile", 72, 3, TRUE, FALSE);
ADD_ASPECT(gswe_aspect_info_table, aspect_info, GSWE_ASPECT_BIQUINTILE, "Bi-quintile", 144, 3, TRUE, FALSE);
gswe_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);

View File

@ -9,6 +9,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;
void gswe_init(gchar *sweph_path);