Files
sorsfonalak/crates/swisseph-sys/src/lib.rs
T
fecoandClaude Opus 5.5 f1bd34c394
CI / test (push) Successful in 56s
CI / build (push) Successful in 4m41s
CI / deploy (push) Skipped
Yearly forecast: solar return, transits, progressions, profection, eclipses
- astro-engine: forecast module (solar return moment, slow-planet transits
  with exact dates and periods, natal house ingresses, secondary
  progressions, annual profection, eclipses via Swiss Ephemeris)
- horoscope-api: POST /v1/forecast, solar return chart cast for the place
  of the birthday
- backend: forecasts table, /v1/charts/{id}/forecasts, /v1/forecasts/{id}
  and its analyses using a new 'forecast' unit; current year of life open,
  the next one 30 days before the birthday
- packages: Páros and Család include forecasts (6 000 / 11 000 Ft),
  +1 éves előrejelzés add-on 2 500 Ft; Egy elemzés unchanged
- worker and prompt: forecast kind with five sections and forecast rules
  (trends, no event predictions); no birth data, place or exact age sent
- frontend: /kepletek/{id}/elorejelzes with the solar return wheel, the
  keys of the year, a monthly timeline, transit list and detailed forecast
- data export: forecasts added, model name removed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
2026-11-18 08:19:13 +00:00

130 lines
4.2 KiB
Rust

//! Raw FFI bindings to the subset of the Swiss Ephemeris API used by the
//! services. The library keeps global state (ephemeris path, sidereal mode,
//! open file handles) and is compiled with `TLSOFF`, so every call must be
//! serialized by the caller.
#![allow(non_upper_case_globals)]
use std::os::raw::{c_char, c_double, c_int};
pub const OK: i32 = 0;
pub const ERR: i32 = -1;
/// Size of the error string buffers (`AS_MAXCH`).
pub const AS_MAXCH: usize = 256;
pub const SE_JUL_CAL: c_int = 0;
pub const SE_GREG_CAL: c_int = 1;
pub const SE_ECL_NUT: i32 = -1;
pub const SE_SUN: i32 = 0;
pub const SE_MOON: i32 = 1;
pub const SE_MERCURY: i32 = 2;
pub const SE_VENUS: i32 = 3;
pub const SE_MARS: i32 = 4;
pub const SE_JUPITER: i32 = 5;
pub const SE_SATURN: i32 = 6;
pub const SE_URANUS: i32 = 7;
pub const SE_NEPTUNE: i32 = 8;
pub const SE_PLUTO: i32 = 9;
pub const SE_MEAN_NODE: i32 = 10;
pub const SE_TRUE_NODE: i32 = 11;
pub const SE_MEAN_APOG: i32 = 12;
pub const SE_OSCU_APOG: i32 = 13;
pub const SE_CHIRON: i32 = 15;
pub const SE_PHOLUS: i32 = 16;
pub const SE_CERES: i32 = 17;
pub const SE_PALLAS: i32 = 18;
pub const SE_JUNO: i32 = 19;
pub const SE_VESTA: i32 = 20;
pub const SEFLG_JPLEPH: i32 = 1;
pub const SEFLG_SWIEPH: i32 = 2;
pub const SEFLG_MOSEPH: i32 = 4;
pub const SEFLG_TRUEPOS: i32 = 16;
pub const SEFLG_NONUT: i32 = 64;
pub const SEFLG_SPEED: i32 = 256;
pub const SEFLG_EQUATORIAL: i32 = 2 * 1024;
pub const SEFLG_TOPOCTR: i32 = 32 * 1024;
pub const SEFLG_SIDEREAL: i32 = 64 * 1024;
pub const SE_SIDM_FAGAN_BRADLEY: i32 = 0;
pub const SE_SIDM_LAHIRI: i32 = 1;
pub const SE_SIDM_DELUCE: i32 = 2;
pub const SE_SIDM_RAMAN: i32 = 3;
pub const SE_SIDM_KRISHNAMURTI: i32 = 5;
pub const SE_SIDM_YUKTESHWAR: i32 = 7;
pub const SE_SIDM_GALCENT_0SAG: i32 = 17;
pub const SE_SIDM_TRUE_CITRA: i32 = 27;
pub const SE_ECL_TOTAL: i32 = 4;
pub const SE_ECL_ANNULAR: i32 = 8;
pub const SE_ECL_PARTIAL: i32 = 16;
pub const SE_ECL_ANNULAR_TOTAL: i32 = 32;
pub const SE_ECL_PENUMBRAL: i32 = 64;
unsafe extern "C" {
pub fn swe_version(s: *mut c_char) -> *mut c_char;
pub fn swe_set_ephe_path(path: *const c_char);
pub fn swe_close();
pub fn swe_set_sid_mode(sid_mode: i32, t0: c_double, ayan_t0: c_double);
pub fn swe_get_ayanamsa_ex_ut(tjd_ut: c_double, iflag: i32, daya: *mut c_double, serr: *mut c_char) -> i32;
pub fn swe_set_topo(geolon: c_double, geolat: c_double, geoalt: c_double);
pub fn swe_calc_ut(tjd_ut: c_double, ipl: i32, iflag: i32, xx: *mut c_double, serr: *mut c_char) -> i32;
pub fn swe_pheno_ut(tjd_ut: c_double, ipl: i32, iflag: i32, attr: *mut c_double, serr: *mut c_char) -> i32;
pub fn swe_houses_ex2(
tjd_ut: c_double,
iflag: i32,
geolat: c_double,
geolon: c_double,
hsys: c_int,
cusps: *mut c_double,
ascmc: *mut c_double,
cusp_speed: *mut c_double,
ascmc_speed: *mut c_double,
serr: *mut c_char,
) -> c_int;
pub fn swe_house_name(hsys: c_int) -> *const c_char;
pub fn swe_julday(year: c_int, month: c_int, day: c_int, hour: c_double, gregflag: c_int) -> c_double;
pub fn swe_revjul(
jd: c_double,
gregflag: c_int,
jyear: *mut c_int,
jmon: *mut c_int,
jday: *mut c_int,
jut: *mut c_double,
);
pub fn swe_utc_to_jd(
iyear: i32,
imonth: i32,
iday: i32,
ihour: i32,
imin: i32,
dsec: c_double,
gregflag: i32,
dret: *mut c_double,
serr: *mut c_char,
) -> i32;
/// Next (or previous) solar eclipse anywhere on Earth; `tret[0]` = maximum (UT).
pub fn swe_sol_eclipse_when_glob(
tjd_start: c_double,
ifl: i32,
ifltype: i32,
tret: *mut c_double,
backward: i32,
serr: *mut c_char,
) -> i32;
/// Next (or previous) lunar eclipse; `tret[0]` = maximum (UT).
pub fn swe_lun_eclipse_when(
tjd_start: c_double,
ifl: i32,
ifltype: i32,
tret: *mut c_double,
backward: i32,
serr: *mut c_char,
) -> i32;
pub fn swe_deltat_ex(tjd: c_double, iflag: i32, serr: *mut c_char) -> c_double;
pub fn swe_sidtime(tjd_ut: c_double) -> c_double;
}