Created gswe_sign_info_table

This commit is contained in:
Gergely Polonkai 2013-09-02 12:31:19 +02:00
parent 29968e594b
commit 770af8c2c0
3 changed files with 39 additions and 0 deletions

View File

@ -109,6 +109,13 @@ typedef struct {
GsweZodiac fall_sign; GsweZodiac fall_sign;
} GswePlanetInfo; } GswePlanetInfo;
typedef struct {
GsweZodiac sign_id;
gchar *name;
GsweElement element;
GsweQuality quality;
} GsweSignInfo;
/** /**
* GsweHouseSystemInfo: * GsweHouseSystemInfo:
* @system: the house system's ID * @system: the house system's ID

View File

@ -8,6 +8,7 @@
gboolean gswe_initialized = FALSE; gboolean gswe_initialized = FALSE;
gchar *gswe_ephe_path = NULL; gchar *gswe_ephe_path = NULL;
GHashTable *gswe_planet_info_table; GHashTable *gswe_planet_info_table;
GHashTable *gswe_sign_info_table;
GHashTable *gswe_house_system_info_table; GHashTable *gswe_house_system_info_table;
#define ADD_PLANET(ht, v, i, s, n, o, h, dom1, dom2, exi1, exi2, exa, fal) (v) = g_new0(GswePlanetInfo, 1); \ #define ADD_PLANET(ht, v, i, s, n, o, h, dom1, dom2, exi1, exi2, exa, fal) (v) = g_new0(GswePlanetInfo, 1); \
@ -24,6 +25,13 @@ GHashTable *gswe_house_system_info_table;
(v)->fall_sign = (fal); \ (v)->fall_sign = (fal); \
g_hash_table_replace((ht), GINT_TO_POINTER(i), (v)); 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_HOUSE_SYSTEM(ht, v, i, s, n) (v) = g_new0(GsweHouseSystemInfo, 1); \ #define ADD_HOUSE_SYSTEM(ht, v, i, s, n) (v) = g_new0(GsweHouseSystemInfo, 1); \
(v)->system = i; \ (v)->system = i; \
(v)->sweph_id = s; \ (v)->sweph_id = s; \
@ -37,6 +45,13 @@ gswe_free_planet_info(gpointer planet_info)
g_free(planet_info); g_free(planet_info);
} }
void
gswe_free_sign_info(gpointer sign_info)
{
g_free(((GsweSignInfo *)sign_info)->name);
g_free(sign_info);
}
void void
gswe_free_house_system_info(gpointer house_system_info) gswe_free_house_system_info(gpointer house_system_info)
{ {
@ -55,6 +70,7 @@ void
gswe_init(gchar *sweph_path) gswe_init(gchar *sweph_path)
{ {
GswePlanetInfo *planet_info; GswePlanetInfo *planet_info;
GsweSignInfo *sign_info;
GsweHouseSystemInfo *house_system_info; GsweHouseSystemInfo *house_system_info;
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
@ -83,6 +99,21 @@ gswe_init(gchar *sweph_path)
ADD_PLANET(gswe_planet_info_table, planet_info, GSWE_PLANET_MC, -1, _("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_MC, -1, _("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, _("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_VERTEX, -1, _("Vertex"), 2.0, 0, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE, GSWE_SIGN_NONE);
gswe_sign_info_table = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, gswe_free_sign_info);
ADD_SIGN(gswe_sign_info_table, sign_info, GSWE_SIGN_ARIES, _("Aries"), GSWE_ELEMENT_FIRE, GSWE_QUALITY_CARDINAL);
ADD_SIGN(gswe_sign_info_table, sign_info, GSWE_SIGN_TAURUS, _("Taurus"), GSWE_ELEMENT_FIRE, GSWE_QUALITY_CARDINAL);
ADD_SIGN(gswe_sign_info_table, sign_info, GSWE_SIGN_GEMINI, _("Gemini"), GSWE_ELEMENT_FIRE, GSWE_QUALITY_CARDINAL);
ADD_SIGN(gswe_sign_info_table, sign_info, GSWE_SIGN_CANCER, _("Cancer"), GSWE_ELEMENT_FIRE, GSWE_QUALITY_CARDINAL);
ADD_SIGN(gswe_sign_info_table, sign_info, GSWE_SIGN_LEO, _("Leo"), GSWE_ELEMENT_FIRE, GSWE_QUALITY_CARDINAL);
ADD_SIGN(gswe_sign_info_table, sign_info, GSWE_SIGN_VIRGO, _("Virgo"), GSWE_ELEMENT_FIRE, GSWE_QUALITY_CARDINAL);
ADD_SIGN(gswe_sign_info_table, sign_info, GSWE_SIGN_LIBRA, _("Libra"), GSWE_ELEMENT_FIRE, GSWE_QUALITY_CARDINAL);
ADD_SIGN(gswe_sign_info_table, sign_info, GSWE_SIGN_SCORPIO, _("Scorpio"), GSWE_ELEMENT_FIRE, GSWE_QUALITY_CARDINAL);
ADD_SIGN(gswe_sign_info_table, sign_info, GSWE_SIGN_SAGITTARIUS, _("Sagittarius"), GSWE_ELEMENT_FIRE, GSWE_QUALITY_CARDINAL);
ADD_SIGN(gswe_sign_info_table, sign_info, GSWE_SIGN_CAPRICORN, _("Capricorn"), GSWE_ELEMENT_FIRE, GSWE_QUALITY_CARDINAL);
ADD_SIGN(gswe_sign_info_table, sign_info, GSWE_SIGN_AQUARIUS, _("Aquarius"), GSWE_ELEMENT_FIRE, GSWE_QUALITY_CARDINAL);
ADD_SIGN(gswe_sign_info_table, sign_info, GSWE_SIGN_PISCES, _("Pisces"), GSWE_ELEMENT_FIRE, GSWE_QUALITY_CARDINAL);
gswe_house_system_info_table = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, gswe_free_house_system_info); gswe_house_system_info_table = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, gswe_free_house_system_info);
ADD_HOUSE_SYSTEM(gswe_house_system_info_table, house_system_info, GSWE_HOUSE_SYSTEM_NONE, 0, _("None")); ADD_HOUSE_SYSTEM(gswe_house_system_info_table, house_system_info, GSWE_HOUSE_SYSTEM_NONE, 0, _("None"));

View File

@ -7,6 +7,7 @@
#include "gswe-moment.h" #include "gswe-moment.h"
extern GHashTable *gswe_planet_info_table; extern GHashTable *gswe_planet_info_table;
extern GHashTable *gswe_sign_info_table;
extern GHashTable *gswe_house_system_info_table; extern GHashTable *gswe_house_system_info_table;
void gswe_init(gchar *sweph_path); void gswe_init(gchar *sweph_path);