Code beautification

pull/16/head
Gergely Polonkai 9 years ago
parent cb1fa1f67a
commit 95e89a4c25

@ -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;
}

@ -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

@ -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 */

@ -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)
@ -74,15 +79,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 +103,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 +117,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 +152,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 +179,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,7 +214,8 @@ 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)
@ -206,7 +233,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 +250,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 +267,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 +284,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 +304,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 +328,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 +359,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 +378,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 +395,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 +406,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
*/

@ -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);
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);
void gswe_antiscion_data_set_planet2(GsweAntiscionData *antiscion_data, GswePlanetData *planet2);
GswePlanetData *gswe_antiscion_data_get_planet2(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

@ -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 */

@ -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,7 +197,8 @@ 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)
@ -189,7 +216,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);
@ -208,7 +237,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 +254,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);
@ -243,7 +275,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)

@ -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

@ -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 */

@ -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)

@ -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);

@ -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);
}

@ -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 */

@ -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,7 +88,8 @@ 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)

@ -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 */

@ -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);

@ -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);
GsweHouseSystem gswe_house_system_info_get_house_system(
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_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);
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);
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

@ -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__ */

@ -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,7 +82,8 @@ 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)
@ -97,7 +102,10 @@ 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;
@ -148,7 +156,10 @@ 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;

@ -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);
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);
GsweMoonPhase gswe_moon_phase_data_get_phase(GsweMoonPhaseData *moon_phase_data);
gdouble gswe_moon_phase_data_get_illumination(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())

@ -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 */

@ -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,7 +93,8 @@ 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)
@ -110,12 +115,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 +171,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 +263,8 @@ gswe_planet_data_get_house(GswePlanetData *planet_data)
* gswe_planet_data_get_sign:
* @planet_data: a #GswePlanetData
*