From 5a19727dfea190ece290f09d8f33ffb261cc3656 Mon Sep 17 00:00:00 2001 From: Don Cross Date: Sun, 26 May 2019 15:49:37 -0400 Subject: [PATCH] Hiding C code internals from Doxygen. Certain macros and typedefs were ending up in Doxygen output that have no reason to be documented for outside users. Mostly I used Doxygen conditionals to hide them. In a couple of cases I had some internal functions that needed to be declared static so Doxygen hides them. Added DoxygenLayout.xml, but not using it yet. Still trying to figure out how to make Markdown output that doesn't look terrible. Not sure I can get Moxygen to do what I want. I may have to create my own simple(?) tool. --- generate/template/astronomy.c | 46 +++++-- source/c/DoxygenLayout.xml | 194 ++++++++++++++++++++++++++++ source/c/README.md | 235 ---------------------------------- source/c/astronomy.c | 46 +++++-- source/c/astronomy.h | 7 - 5 files changed, 270 insertions(+), 258 deletions(-) create mode 100644 source/c/DoxygenLayout.xml diff --git a/generate/template/astronomy.c b/generate/template/astronomy.c index a09ef7f8..e7bde57f 100644 --- a/generate/template/astronomy.c +++ b/generate/template/astronomy.c @@ -36,12 +36,8 @@ extern "C" { #endif -#define ARRAYSIZE(x) (sizeof(x) / sizeof(x[0])) - static const double T0 = 2451545.0; static const double MJD_BASIS = 2400000.5; -#define Y2000_IN_MJD (T0 - MJD_BASIS) -#define PI 3.14159265358979323846 static const double DEG2RAD = 0.017453292519943296; static const double RAD2DEG = 57.295779513082321; static const double ASEC360 = 1296000.0; @@ -61,7 +57,13 @@ static const double REFRACTION_NEAR_HORIZON = 34.0 / 60.0; /* degrees of refra static const double SUN_RADIUS_AU = 4.6505e-3; static const double MOON_RADIUS_AU = 1.15717e-5; static const double ASEC180 = 180.0 * 60.0 * 60.0; /* arcseconds per 180 degrees (or pi radians) */ -#define AU_PER_PARSEC (ASEC180 / PI) /* exact definition of how many AU = one parsec */ + +/** @cond DOXYGEN_SKIP */ +#define ARRAYSIZE(x) (sizeof(x) / sizeof(x[0])) +#define AU_PER_PARSEC (ASEC180 / PI) /* exact definition of how many AU = one parsec */ +#define Y2000_IN_MJD (T0 - MJD_BASIS) +#define PI 3.14159265358979323846 +/** @endcond */ static astro_time_t UniversalTime(double ut); static astro_ecliptic_t RotateEquatorialToEcliptic(const double pos[3], double obliq_radians); @@ -98,6 +100,11 @@ double Astronomy_VectorLength(astro_vector_t vector) return sqrt(vector.x*vector.x + vector.y*vector.y + vector.z*vector.z); } +/** + * @brief Finds the name of a celestial body. + * @param body The celestial body whose name is to be found. + * @return The English-language name of the celestial body, or "" if the body is not valid. + */ const char *Astronomy_BodyName(astro_body_t body) { switch (body) @@ -325,16 +332,20 @@ static astro_angle_result_t AngleBetween(astro_vector_t a, astro_vector_t b) return result; } +/** @cond DOXYGEN_SKIP */ typedef struct { double mjd; double dt; } deltat_entry_t; +/** @endcond */ static const deltat_entry_t DT[] = $ASTRO_DELTA_T(); +/** @cond DOXYGEN_SKIP */ #define DT_LENGTH (sizeof(DT) / sizeof(DT[0])) +/** @endcond */ static double DeltaT(double mjd) { @@ -487,7 +498,7 @@ astro_observer_t Astronomy_MakeObserver(double latitude, double longitude, doubl return observer; } -void iau2000b(astro_time_t time, double *dpsi, double *deps) +static void iau2000b(astro_time_t time, double *dpsi, double *deps) { /* Adapted from the NOVAS C 3.1 function of the same name. */ @@ -690,6 +701,7 @@ static double mean_obliq(double tt) return asec / 3600.0; } +/** @cond DOXYGEN_SKIP */ typedef struct { double tt; @@ -700,6 +712,7 @@ typedef struct double tobl; } earth_tilt_t; +/** @endcond */ static earth_tilt_t e_tilt(astro_time_t time) { @@ -967,6 +980,8 @@ static void ter2cel(astro_time_t time, const double vec1[3], double vec2[3]) /*------------------ CalcMoon ------------------*/ +/** @cond DOXYGEN_SKIP */ + #define DECLARE_PASCAL_ARRAY_1(elemtype,name,xmin,xmax) \ elemtype name[(xmax)-(xmin)+1] @@ -1323,6 +1338,8 @@ static void CalcMoon( #undef CO #undef SI +/** @endcond */ + astro_vector_t Astronomy_GeoMoon(astro_time_t time) { double geo_eclip_lon, geo_eclip_lat, distance_au; @@ -1356,6 +1373,7 @@ astro_vector_t Astronomy_GeoMoon(astro_time_t time) /*------------------ VSOP ------------------*/ +/** @cond DOXYGEN_SKIP */ typedef struct { double amplitude; @@ -1383,6 +1401,7 @@ typedef struct const vsop_formula_t formula[3]; } vsop_model_t; +/** @endcond */ $ASTRO_C_VSOP(Mercury); $ASTRO_C_VSOP(Venus); @@ -1393,7 +1412,9 @@ $ASTRO_C_VSOP(Saturn); $ASTRO_C_VSOP(Uranus); $ASTRO_C_VSOP(Neptune); +/** @cond DOXYGEN_SKIP */ #define VSOPFORMULA(x) { ARRAYSIZE(x), x } +/** @endcond */ static const vsop_model_t vsop[] = { @@ -1407,7 +1428,9 @@ static const vsop_model_t vsop[] = { { VSOPFORMULA(vsop_lat_Neptune), VSOPFORMULA(vsop_lon_Neptune), VSOPFORMULA(vsop_rad_Neptune) } } }; +/** @cond DOXYGEN_SKIP */ #define CalcEarth(time) CalcVsop(&vsop[BODY_EARTH], (time)) +/** @endcond */ static astro_vector_t CalcVsop(const vsop_model_t *model, astro_time_t time) { @@ -1455,6 +1478,7 @@ static astro_vector_t CalcVsop(const vsop_model_t *model, astro_time_t time) /*------------------ Chebyshev model for Pluto ------------------*/ +/** @cond DOXYGEN_SKIP */ typedef struct { double data[3]; @@ -1469,6 +1493,7 @@ typedef struct const astro_cheb_coeff_t *coeff; } astro_cheb_record_t; +/** @endcond */ $ASTRO_C_CHEBYSHEV(8); @@ -1520,8 +1545,9 @@ static astro_vector_t CalcChebyshev(const astro_cheb_record_t model[], int nrecs return VecError(ASTRO_BAD_TIME, time); } +/** @cond DOXYGEN_SKIP */ #define CalcPluto(time) (CalcChebyshev(cheb_8, ARRAYSIZE(cheb_8), (time))) - +/** @endcond */ /*------------------ end of generated code ------------------*/ @@ -1942,12 +1968,14 @@ static astro_search_result_t SearchErr(astro_status_t status) return result; } +/** @cond DOXYGEN_SKIP */ #define CALLFUNC(f,t) \ do { \ funcres = func(context, (t)); \ if (funcres.status != ASTRO_SUCCESS) return SearchErr(funcres.status); \ (f) = funcres.value; \ } while(0) +/** @endcond */ astro_search_result_t Astronomy_Search( astro_search_func_t func, @@ -2182,7 +2210,7 @@ astro_elongation_t Astronomy_Elongation(astro_body_t body, astro_time_t time) return result; } -astro_func_result_t neg_elong_slope(void *context, astro_time_t time) +static astro_func_result_t neg_elong_slope(void *context, astro_time_t time) { static const double dt = 0.1; astro_angle_result_t e1, e2; @@ -2603,6 +2631,7 @@ astro_hour_angle_t Astronomy_SearchHourAngle( } } +/** @cond DOXYGEN_SKIP */ typedef struct { astro_body_t body; @@ -2611,6 +2640,7 @@ typedef struct double body_radius_au; } context_peak_altitude_t; +/** @endcond */ static astro_func_result_t peak_altitude(void *context, astro_time_t time) { diff --git a/source/c/DoxygenLayout.xml b/source/c/DoxygenLayout.xml new file mode 100644 index 00000000..ac353bf8 --- /dev/null +++ b/source/c/DoxygenLayout.xml @@ -0,0 +1,194 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source/c/README.md b/source/c/README.md index bbb29a75..c070ba48 100644 --- a/source/c/README.md +++ b/source/c/README.md @@ -4,8 +4,6 @@ --------------------------------|--------------------------------------------- `struct `[`astro_angle_result_t`](#structastro__angle__result__t) | An angular value expressed in degrees. `struct `[`astro_apsis_t`](#structastro__apsis__t) | -`struct `[`astro_cheb_coeff_t`](#structastro__cheb__coeff__t) | -`struct `[`astro_cheb_record_t`](#structastro__cheb__record__t) | `struct `[`astro_ecliptic_t`](#structastro__ecliptic__t) | `struct `[`astro_elongation_t`](#structastro__elongation__t) | `struct `[`astro_equatorial_t`](#structastro__equatorial__t) | @@ -20,14 +18,6 @@ `struct `[`astro_time_t`](#structastro__time__t) | A date and time used for astronomical calculations. `struct `[`astro_utc_t`](#structastro__utc__t) | A calendar date and time expressed in UTC. `struct `[`astro_vector_t`](#structastro__vector__t) | A 3D Cartesian vector whose components are expressed in Astronomical Units (AU). -`struct `[`context_peak_altitude_t`](#structcontext__peak__altitude__t) | -`struct `[`deltat_entry_t`](#structdeltat__entry__t) | -`struct `[`earth_tilt_t`](#structearth__tilt__t) | -`struct `[`MoonContext`](#structMoonContext) | -`struct `[`vsop_formula_t`](#structvsop__formula__t) | -`struct `[`vsop_model_t`](#structvsop__model__t) | -`struct `[`vsop_series_t`](#structvsop__series__t) | -`struct `[`vsop_term_t`](#structvsop__term__t) | # struct `astro_angle_result_t` @@ -74,39 +64,6 @@ An angle expressed in degrees. #### `public double `[`dist_km`](#structastro__apsis__t_1a1ff80b5f6e5d1cb863a5ccbcd362007f) -# struct `astro_cheb_coeff_t` - -## Summary - - Members | Descriptions ---------------------------------|--------------------------------------------- -`public double `[`data`](#structastro__cheb__coeff__t_1a5d2769c57b5d74a488f348b56a7aaada) | - -## Members - -#### `public double `[`data`](#structastro__cheb__coeff__t_1a5d2769c57b5d74a488f348b56a7aaada) - -# struct `astro_cheb_record_t` - -## Summary - - Members | Descriptions ---------------------------------|--------------------------------------------- -`public double `[`tt`](#structastro__cheb__record__t_1ab5716af5a2fa0b23cc9b7885872634c8) | -`public double `[`ndays`](#structastro__cheb__record__t_1a18fad328273a7ba45b99db03accb93e8) | -`public int `[`ncoeff`](#structastro__cheb__record__t_1a72137ec8ccee0c8e5252f99cf4e1364a) | -`public const `[`astro_cheb_coeff_t`](#structastro__cheb__coeff__t)` * `[`coeff`](#structastro__cheb__record__t_1adbf5052cec3a7a9e0ece662b4712b714) | - -## Members - -#### `public double `[`tt`](#structastro__cheb__record__t_1ab5716af5a2fa0b23cc9b7885872634c8) - -#### `public double `[`ndays`](#structastro__cheb__record__t_1a18fad328273a7ba45b99db03accb93e8) - -#### `public int `[`ncoeff`](#structastro__cheb__record__t_1a72137ec8ccee0c8e5252f99cf4e1364a) - -#### `public const `[`astro_cheb_coeff_t`](#structastro__cheb__coeff__t)` * `[`coeff`](#structastro__cheb__record__t_1adbf5052cec3a7a9e0ece662b4712b714) - # struct `astro_ecliptic_t` ## Summary @@ -447,196 +404,4 @@ The Cartesian z-coordinate of the vector in AU. The date and time at which this vector is valid. -# struct `context_peak_altitude_t` - -## Summary - - Members | Descriptions ---------------------------------|--------------------------------------------- -`public `[`astro_body_t`](#astronomy_8h_1abc11a4185b6fd5086da5ee9d3c7ce928)` `[`body`](#structcontext__peak__altitude__t_1aa47c0f204bd7230b55dd7d42a5a4d39d) | -`public int `[`direction`](#structcontext__peak__altitude__t_1a500c08071e6eb2916623c1a235e26412) | -`public `[`astro_observer_t`](#structastro__observer__t)` `[`observer`](#structcontext__peak__altitude__t_1a2482ce7ba3aac1be3636a2f07a1c8b53) | -`public double `[`body_radius_au`](#structcontext__peak__altitude__t_1aea0fe57205509ba0753730e84c9e8b97) | - -## Members - -#### `public `[`astro_body_t`](#astronomy_8h_1abc11a4185b6fd5086da5ee9d3c7ce928)` `[`body`](#structcontext__peak__altitude__t_1aa47c0f204bd7230b55dd7d42a5a4d39d) - -#### `public int `[`direction`](#structcontext__peak__altitude__t_1a500c08071e6eb2916623c1a235e26412) - -#### `public `[`astro_observer_t`](#structastro__observer__t)` `[`observer`](#structcontext__peak__altitude__t_1a2482ce7ba3aac1be3636a2f07a1c8b53) - -#### `public double `[`body_radius_au`](#structcontext__peak__altitude__t_1aea0fe57205509ba0753730e84c9e8b97) - -# struct `deltat_entry_t` - -## Summary - - Members | Descriptions ---------------------------------|--------------------------------------------- -`public double `[`mjd`](#structdeltat__entry__t_1aaea1f67366018adb1df1b8ba59d551b8) | -`public double `[`dt`](#structdeltat__entry__t_1a2e9ba25a4ea80205f1eabe7878f7c9f8) | - -## Members - -#### `public double `[`mjd`](#structdeltat__entry__t_1aaea1f67366018adb1df1b8ba59d551b8) - -#### `public double `[`dt`](#structdeltat__entry__t_1a2e9ba25a4ea80205f1eabe7878f7c9f8) - -# struct `earth_tilt_t` - -## Summary - - Members | Descriptions ---------------------------------|--------------------------------------------- -`public double `[`tt`](#structearth__tilt__t_1a672d10b8a865c97d10f940f850e23218) | -`public double `[`dpsi`](#structearth__tilt__t_1aecf0599dd0aaf72c6da8dee770e22154) | -`public double `[`deps`](#structearth__tilt__t_1a0d522907b75ba96ec4878e4d3896e881) | -`public double `[`ee`](#structearth__tilt__t_1a174d39ec59199e212ce12eed15770e15) | -`public double `[`mobl`](#structearth__tilt__t_1aa87141a38e1a48ed0cea091d662cec61) | -`public double `[`tobl`](#structearth__tilt__t_1a1220c4af0e00156f1d2d527b4c9176f9) | - -## Members - -#### `public double `[`tt`](#structearth__tilt__t_1a672d10b8a865c97d10f940f850e23218) - -#### `public double `[`dpsi`](#structearth__tilt__t_1aecf0599dd0aaf72c6da8dee770e22154) - -#### `public double `[`deps`](#structearth__tilt__t_1a0d522907b75ba96ec4878e4d3896e881) - -#### `public double `[`ee`](#structearth__tilt__t_1a174d39ec59199e212ce12eed15770e15) - -#### `public double `[`mobl`](#structearth__tilt__t_1aa87141a38e1a48ed0cea091d662cec61) - -#### `public double `[`tobl`](#structearth__tilt__t_1a1220c4af0e00156f1d2d527b4c9176f9) - -# struct `MoonContext` - -## Summary - - Members | Descriptions ---------------------------------|--------------------------------------------- -`public double `[`t`](#structMoonContext_1aaaf561e8c74cf5b38efeabf945fbe7c7) | -`public double `[`dgam`](#structMoonContext_1a72984bcb2447cb83383d440afde31f7a) | -`public double `[`dlam`](#structMoonContext_1aa83859066b6b745f6a865ed61ae9fb0b) | -`public double `[`n`](#structMoonContext_1a6c440a84e40d26cea2fc0cc2d2b074e4) | -`public double `[`gam1c`](#structMoonContext_1a591cb67157db09b81e73c208fafb0f30) | -`public double `[`sinpi`](#structMoonContext_1aaf3e242c96281538ecbae825d158a095) | -`public double `[`l0`](#structMoonContext_1a124c9586686ae0506029ab98ce4993fe) | -`public double `[`l`](#structMoonContext_1ac6b65ca94db24548276265c7f75f7ccb) | -`public double `[`ls`](#structMoonContext_1aa4d999955bb2bca04d25eb00291a5308) | -`public double `[`f`](#structMoonContext_1a9ef4eefb9f624a98f2823f90c1928417) | -`public double `[`d`](#structMoonContext_1ab3cc1fec2e00544413ccfcf313bd1d85) | -`public double `[`s`](#structMoonContext_1a7a2ebea092b91340db5d0146e763f17b) | -`public double `[`dl0`](#structMoonContext_1af46590adaa21bf6b42fd3783f7d8db9c) | -`public double `[`dl`](#structMoonContext_1a86bec90c26afe7c88475bd9131a5b392) | -`public double `[`dls`](#structMoonContext_1a2b17842eef72ebc0e8084afcb18805a7) | -`public double `[`df`](#structMoonContext_1a8726d33dec64f105c8bfd47ae8845227) | -`public double `[`dd`](#structMoonContext_1aaee8afdea6e3275079da08934d6b4497) | -`public double `[`ds`](#structMoonContext_1ae4f02d1ae1f84d3b53a79a2b11f24095) | -`public `[`DECLARE_PASCAL_ARRAY_2`](#structMoonContext_1a56219dd4d574ba8f969a346be8e8a94b)`(double,co,- 6,6,1,4)` | -`public `[`DECLARE_PASCAL_ARRAY_2`](#structMoonContext_1a6bbd892350493626fccf00c5b68cbd74)`(double,si,- 6,6,1,4)` | - -## Members - -#### `public double `[`t`](#structMoonContext_1aaaf561e8c74cf5b38efeabf945fbe7c7) - -#### `public double `[`dgam`](#structMoonContext_1a72984bcb2447cb83383d440afde31f7a) - -#### `public double `[`dlam`](#structMoonContext_1aa83859066b6b745f6a865ed61ae9fb0b) - -#### `public double `[`n`](#structMoonContext_1a6c440a84e40d26cea2fc0cc2d2b074e4) - -#### `public double `[`gam1c`](#structMoonContext_1a591cb67157db09b81e73c208fafb0f30) - -#### `public double `[`sinpi`](#structMoonContext_1aaf3e242c96281538ecbae825d158a095) - -#### `public double `[`l0`](#structMoonContext_1a124c9586686ae0506029ab98ce4993fe) - -#### `public double `[`l`](#structMoonContext_1ac6b65ca94db24548276265c7f75f7ccb) - -#### `public double `[`ls`](#structMoonContext_1aa4d999955bb2bca04d25eb00291a5308) - -#### `public double `[`f`](#structMoonContext_1a9ef4eefb9f624a98f2823f90c1928417) - -#### `public double `[`d`](#structMoonContext_1ab3cc1fec2e00544413ccfcf313bd1d85) - -#### `public double `[`s`](#structMoonContext_1a7a2ebea092b91340db5d0146e763f17b) - -#### `public double `[`dl0`](#structMoonContext_1af46590adaa21bf6b42fd3783f7d8db9c) - -#### `public double `[`dl`](#structMoonContext_1a86bec90c26afe7c88475bd9131a5b392) - -#### `public double `[`dls`](#structMoonContext_1a2b17842eef72ebc0e8084afcb18805a7) - -#### `public double `[`df`](#structMoonContext_1a8726d33dec64f105c8bfd47ae8845227) - -#### `public double `[`dd`](#structMoonContext_1aaee8afdea6e3275079da08934d6b4497) - -#### `public double `[`ds`](#structMoonContext_1ae4f02d1ae1f84d3b53a79a2b11f24095) - -#### `public `[`DECLARE_PASCAL_ARRAY_2`](#structMoonContext_1a56219dd4d574ba8f969a346be8e8a94b)`(double,co,- 6,6,1,4)` - -#### `public `[`DECLARE_PASCAL_ARRAY_2`](#structMoonContext_1a6bbd892350493626fccf00c5b68cbd74)`(double,si,- 6,6,1,4)` - -# struct `vsop_formula_t` - -## Summary - - Members | Descriptions ---------------------------------|--------------------------------------------- -`public int `[`nseries`](#structvsop__formula__t_1a56afa21306a89bf18ddfac5ca85ee677) | -`public const `[`vsop_series_t`](#structvsop__series__t)` * `[`series`](#structvsop__formula__t_1acf5e628306f23d4583199dbe2048e5ce) | - -## Members - -#### `public int `[`nseries`](#structvsop__formula__t_1a56afa21306a89bf18ddfac5ca85ee677) - -#### `public const `[`vsop_series_t`](#structvsop__series__t)` * `[`series`](#structvsop__formula__t_1acf5e628306f23d4583199dbe2048e5ce) - -# struct `vsop_model_t` - -## Summary - - Members | Descriptions ---------------------------------|--------------------------------------------- -`public const `[`vsop_formula_t`](#structvsop__formula__t)` `[`formula`](#structvsop__model__t_1afc3a605659bf015b0439ee087419af94) | - -## Members - -#### `public const `[`vsop_formula_t`](#structvsop__formula__t)` `[`formula`](#structvsop__model__t_1afc3a605659bf015b0439ee087419af94) - -# struct `vsop_series_t` - -## Summary - - Members | Descriptions ---------------------------------|--------------------------------------------- -`public int `[`nterms`](#structvsop__series__t_1a7aeb051802ffd6ef6ae02a9403031b58) | -`public const `[`vsop_term_t`](#structvsop__term__t)` * `[`term`](#structvsop__series__t_1a4adb390ffedd92b0726b125c04c9a76f) | - -## Members - -#### `public int `[`nterms`](#structvsop__series__t_1a7aeb051802ffd6ef6ae02a9403031b58) - -#### `public const `[`vsop_term_t`](#structvsop__term__t)` * `[`term`](#structvsop__series__t_1a4adb390ffedd92b0726b125c04c9a76f) - -# struct `vsop_term_t` - -## Summary - - Members | Descriptions ---------------------------------|--------------------------------------------- -`public double `[`amplitude`](#structvsop__term__t_1aecd5a26eb7821a3c526b439790d99aab) | -`public double `[`phase`](#structvsop__term__t_1a67104f91069ca921319a4035cb836ec8) | -`public double `[`frequency`](#structvsop__term__t_1a82d3dd5cc631234a6185c01c33930532) | - -## Members - -#### `public double `[`amplitude`](#structvsop__term__t_1aecd5a26eb7821a3c526b439790d99aab) - -#### `public double `[`phase`](#structvsop__term__t_1a67104f91069ca921319a4035cb836ec8) - -#### `public double `[`frequency`](#structvsop__term__t_1a82d3dd5cc631234a6185c01c33930532) - Generated by [Moxygen](https://github.com/sourcey/moxygen) \ No newline at end of file diff --git a/source/c/astronomy.c b/source/c/astronomy.c index 3a53c25e..33529799 100644 --- a/source/c/astronomy.c +++ b/source/c/astronomy.c @@ -36,12 +36,8 @@ extern "C" { #endif -#define ARRAYSIZE(x) (sizeof(x) / sizeof(x[0])) - static const double T0 = 2451545.0; static const double MJD_BASIS = 2400000.5; -#define Y2000_IN_MJD (T0 - MJD_BASIS) -#define PI 3.14159265358979323846 static const double DEG2RAD = 0.017453292519943296; static const double RAD2DEG = 57.295779513082321; static const double ASEC360 = 1296000.0; @@ -61,7 +57,13 @@ static const double REFRACTION_NEAR_HORIZON = 34.0 / 60.0; /* degrees of refra static const double SUN_RADIUS_AU = 4.6505e-3; static const double MOON_RADIUS_AU = 1.15717e-5; static const double ASEC180 = 180.0 * 60.0 * 60.0; /* arcseconds per 180 degrees (or pi radians) */ -#define AU_PER_PARSEC (ASEC180 / PI) /* exact definition of how many AU = one parsec */ + +/** @cond DOXYGEN_SKIP */ +#define ARRAYSIZE(x) (sizeof(x) / sizeof(x[0])) +#define AU_PER_PARSEC (ASEC180 / PI) /* exact definition of how many AU = one parsec */ +#define Y2000_IN_MJD (T0 - MJD_BASIS) +#define PI 3.14159265358979323846 +/** @endcond */ static astro_time_t UniversalTime(double ut); static astro_ecliptic_t RotateEquatorialToEcliptic(const double pos[3], double obliq_radians); @@ -98,6 +100,11 @@ double Astronomy_VectorLength(astro_vector_t vector) return sqrt(vector.x*vector.x + vector.y*vector.y + vector.z*vector.z); } +/** + * @brief Finds the name of a celestial body. + * @param body The celestial body whose name is to be found. + * @return The English-language name of the celestial body, or "" if the body is not valid. + */ const char *Astronomy_BodyName(astro_body_t body) { switch (body) @@ -325,12 +332,14 @@ static astro_angle_result_t AngleBetween(astro_vector_t a, astro_vector_t b) return result; } +/** @cond DOXYGEN_SKIP */ typedef struct { double mjd; double dt; } deltat_entry_t; +/** @endcond */ static const deltat_entry_t DT[] = { { -72638.0, 38 }, @@ -425,7 +434,9 @@ static const deltat_entry_t DT[] = { { 61680.0, 73.66 } }; +/** @cond DOXYGEN_SKIP */ #define DT_LENGTH (sizeof(DT) / sizeof(DT[0])) +/** @endcond */ static double DeltaT(double mjd) { @@ -578,7 +589,7 @@ astro_observer_t Astronomy_MakeObserver(double latitude, double longitude, doubl return observer; } -void iau2000b(astro_time_t time, double *dpsi, double *deps) +static void iau2000b(astro_time_t time, double *dpsi, double *deps) { /* Adapted from the NOVAS C 3.1 function of the same name. */ @@ -781,6 +792,7 @@ static double mean_obliq(double tt) return asec / 3600.0; } +/** @cond DOXYGEN_SKIP */ typedef struct { double tt; @@ -791,6 +803,7 @@ typedef struct double tobl; } earth_tilt_t; +/** @endcond */ static earth_tilt_t e_tilt(astro_time_t time) { @@ -1058,6 +1071,8 @@ static void ter2cel(astro_time_t time, const double vec1[3], double vec2[3]) /*------------------ CalcMoon ------------------*/ +/** @cond DOXYGEN_SKIP */ + #define DECLARE_PASCAL_ARRAY_1(elemtype,name,xmin,xmax) \ elemtype name[(xmax)-(xmin)+1] @@ -1414,6 +1429,8 @@ static void CalcMoon( #undef CO #undef SI +/** @endcond */ + astro_vector_t Astronomy_GeoMoon(astro_time_t time) { double geo_eclip_lon, geo_eclip_lat, distance_au; @@ -1447,6 +1464,7 @@ astro_vector_t Astronomy_GeoMoon(astro_time_t time) /*------------------ VSOP ------------------*/ +/** @cond DOXYGEN_SKIP */ typedef struct { double amplitude; @@ -1474,6 +1492,7 @@ typedef struct const vsop_formula_t formula[3]; } vsop_model_t; +/** @endcond */ static const vsop_term_t vsop_lat_Mercury_0[] = { @@ -2279,7 +2298,9 @@ static const vsop_series_t vsop_rad_Neptune[] = ; +/** @cond DOXYGEN_SKIP */ #define VSOPFORMULA(x) { ARRAYSIZE(x), x } +/** @endcond */ static const vsop_model_t vsop[] = { @@ -2293,7 +2314,9 @@ static const vsop_model_t vsop[] = { { VSOPFORMULA(vsop_lat_Neptune), VSOPFORMULA(vsop_lon_Neptune), VSOPFORMULA(vsop_rad_Neptune) } } }; +/** @cond DOXYGEN_SKIP */ #define CalcEarth(time) CalcVsop(&vsop[BODY_EARTH], (time)) +/** @endcond */ static astro_vector_t CalcVsop(const vsop_model_t *model, astro_time_t time) { @@ -2341,6 +2364,7 @@ static astro_vector_t CalcVsop(const vsop_model_t *model, astro_time_t time) /*------------------ Chebyshev model for Pluto ------------------*/ +/** @cond DOXYGEN_SKIP */ typedef struct { double data[3]; @@ -2355,6 +2379,7 @@ typedef struct const astro_cheb_coeff_t *coeff; } astro_cheb_record_t; +/** @endcond */ static const astro_cheb_coeff_t cheb_8_0[] = { @@ -2576,8 +2601,9 @@ static astro_vector_t CalcChebyshev(const astro_cheb_record_t model[], int nrecs return VecError(ASTRO_BAD_TIME, time); } +/** @cond DOXYGEN_SKIP */ #define CalcPluto(time) (CalcChebyshev(cheb_8, ARRAYSIZE(cheb_8), (time))) - +/** @endcond */ /*------------------ end of generated code ------------------*/ @@ -2998,12 +3024,14 @@ static astro_search_result_t SearchErr(astro_status_t status) return result; } +/** @cond DOXYGEN_SKIP */ #define CALLFUNC(f,t) \ do { \ funcres = func(context, (t)); \ if (funcres.status != ASTRO_SUCCESS) return SearchErr(funcres.status); \ (f) = funcres.value; \ } while(0) +/** @endcond */ astro_search_result_t Astronomy_Search( astro_search_func_t func, @@ -3238,7 +3266,7 @@ astro_elongation_t Astronomy_Elongation(astro_body_t body, astro_time_t time) return result; } -astro_func_result_t neg_elong_slope(void *context, astro_time_t time) +static astro_func_result_t neg_elong_slope(void *context, astro_time_t time) { static const double dt = 0.1; astro_angle_result_t e1, e2; @@ -3659,6 +3687,7 @@ astro_hour_angle_t Astronomy_SearchHourAngle( } } +/** @cond DOXYGEN_SKIP */ typedef struct { astro_body_t body; @@ -3667,6 +3696,7 @@ typedef struct double body_radius_au; } context_peak_altitude_t; +/** @endcond */ static astro_func_result_t peak_altitude(void *context, astro_time_t time) { diff --git a/source/c/astronomy.h b/source/c/astronomy.h index 2bc5787f..7b0d587b 100644 --- a/source/c/astronomy.h +++ b/source/c/astronomy.h @@ -265,14 +265,7 @@ astro_apsis_t; /*---------- functions ----------*/ double Astronomy_VectorLength(astro_vector_t vector); - -/** - * @brief Finds the name of a celestial body. - * @param body The celestial body whose name is to be found. - * @return The English-language name of the celestial body, or "" if the body is not valid. - */ const char *Astronomy_BodyName(astro_body_t body); - astro_body_t Astronomy_BodyCode(const char *name); astro_observer_t Astronomy_MakeObserver(double latitude, double longitude, double height); astro_time_t Astronomy_CurrentTime(void);