Use wasm ephemeris locally and document Caddy serving

This commit is contained in:
randogoth 2025-12-22 15:00:43 +02:00
parent dbe9758b7c
commit ba47f6dae4
7 changed files with 3876 additions and 25 deletions

View file

@ -27,10 +27,10 @@ SWEOBJ = swedate.o swehouse.o swejpl.o swemmoon.o swemplan.o swepcalc.o sweph.o\
swepdate.o swephlib.o swecl.o swehel.o
pmom: pmom.o libswe.a
$(CC) $(OP) -o pmom.js pmom.o -s WASM=1 -s "BINARYEN_TRAP_MODE='clamp'" -s EXTRA_EXPORTED_RUNTIME_METHODS='["ccall", "cwrap"]' -L. -lswe -lm -ldl
$(CC) $(OP) -o pmom.js pmom.o -s WASM=1 -s EXPORTED_RUNTIME_METHODS='["ccall","cwrap"]' -L. -lswe -lm -ldl
install:
mv pmom.js ../../js/; mv pmom.wasm ../../js/; mv pmom.wast ../../js/
mv pmom.js ../../js/; mv pmom.wasm ../../js/
# create an archive and a dynamic link libary fro SwissEph
# a user of this library will inlcude swephexp.h and link with -lswe

View file

@ -133,7 +133,7 @@ int * planetary_moment(double lat, double lon, long unixtime, double *lunar, dou
time_t timestamp = 0;
int32 year, month, day, hour, minute, second, iflag, iflgret;
int pl, ipl, rsmi, return_code, dl, lhour, nm;
double hours, tjd_ts, te, lastnew;
double hours, tjd_ts, te, lastnew = 0.0;
double x2[6], datm[2], geopos[3], moon[20], llp[20], lunarday[31], data[13], datb[10];
char serr[AS_MAXCH], starname[255];
@ -188,7 +188,8 @@ int * planetary_moment(double lat, double lon, long unixtime, double *lunar, dou
planets[16] = datb[2]; // armc
// calculate moon phase
return_code = swe_pheno(te, SE_MOON, iflag, &moon, serr);
// swe_pheno expects a pointer to the first element
return_code = swe_pheno(te, SE_MOON, iflag, moon, serr);
if (return_code == ERR) printf("%s\n", serr);
lunar[1] = moon[0];
lunar[2] = moon[1];
@ -221,7 +222,7 @@ int * solar_moment(double lat, double lon, long unixtime, long *solar) {
long epoch = 0;
struct tm *tmp;
time_t timestamp = 0;
int32 year, month, day, hour, minute, second, iflag, pday = 0;
int32 year, month, day, hour, minute, second, iflag = 0, pday = 0;
int ipl, rsmi, hourlength[3];
double hours, tjd, td;
double datm[2], geopos[3], lastset, lastrise, nextset, nextrise, onextrise, onextset;