Skip to content

Commit

Permalink
Fix readeph0.c, and DEFAULT_READEPH for make
Browse files Browse the repository at this point in the history
  • Loading branch information
attipaci committed Dec 29, 2024
1 parent c07614f commit 8460cbc
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Release candidate for the next feature release, expected around 1 February 2025.

- Fixes to GCC version checking for macros.

- Fixed dummy `readeph()` implementation in `readeph0.c`, and `DEFAULT_READEPH` in `config.mk`. `readeph0.c` is not
linked by default, and was not linked in prior releases either.


### Added

Expand Down Expand Up @@ -114,6 +117,8 @@ Release candidate for the next feature release, expected around 1 February 2025.

- Added `-g` to default `CFLAGS` as a matter of GNU best practice.

- Static library is now named `ibsupernovas.a`, which is symlinked to `libnovas.a` for back compatibility.

- Various small tweaks to Makefiles.

- Updated `README.md` documentation.
Expand Down
4 changes: 2 additions & 2 deletions config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ endif
# Compile library with a default readeph() implementation for solsys1.c, which
# will be used only if the application does not define another implementation
# via calls to the to set_ephem_reader() function.
DEFAULT_READEPH ?= $(SRC)/readeph0.c
#DEFAULT_READEPH ?= $(SRC)/readeph0.c


# Whether to build into the library planet_jplint() routines provided in
Expand Down Expand Up @@ -190,7 +190,7 @@ ifeq ($(BUILTIN_SOLSYS_EPHEM), 1)
SOURCES += $(SRC)/solsys-ephem.c
endif

ifdef (DEFAULT_READEPH)
ifdef DEFAULT_READEPH
SOURCES += $(DEFAULT_READEPH)
CPPFLAGS += -DDEFAULT_READEPH=1
endif
Expand Down
6 changes: 4 additions & 2 deletions src/readeph0.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,19 @@ double * readeph_dummy(int mp, const char *name, double jd_tdb, int *error) {

if(!name || !error) {
novas_set_errno(EINVAL, fn, "NULL parameter: name=%p, error=%p", name, error);
if(error) *error = -1;
return NULL;
}

if(isnanf(jd_tdb)) {
novas_set_errno(-1, EINVAL, fn, "NaN jd_tdb");
novas_set_errno(EINVAL, fn, "NaN jd_tdb");
*error = -1;
return NULL;
}

pv = (double*) calloc(6, sizeof(double));
*error = 9;
if(pv) *error = 0;
else *error = -1;

return pv;
}
Expand Down
2 changes: 1 addition & 1 deletion test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ LDFLAGS += -fprofile-arcs -ftest-coverage -lm
include ../config.mk

#OBJECTS := $(subst obj/,,$(OBJECTS))
OBJECTS := novas.o nutation.o solsys3.o super.o frames.o timescale.o refract.o naif.o
OBJECTS := novas.o nutation.o solsys3.o super.o frames.o timescale.o refract.o naif.o readeph0.o
TESTS := test-compat test-cio_file test-super test-errors
COVFILES := novas.c.gcov nutation.c.gcov solsys3.c.gcov super.c.gcov timescale.c.gcov refract.c.gcov frames.c.gcov naif.c.gcov

Expand Down
2 changes: 0 additions & 2 deletions test/src/test-cspice.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ static int test_cspice() {
double jd = NOVAS_JD_J2000;
double jd2[2] = { jd, 0.0 };

char filename[1024];
object earth, mars;

make_planet(NOVAS_EARTH, &earth);
Expand All @@ -91,7 +90,6 @@ static int test_cspice_planet() {
double jd = NOVAS_JD_J2000;
double jd2[2] = { jd, 0.0 };

char filename[1024];
object ssb, sun, earth, moon, mars, phobos;

make_planet(NOVAS_SSB, &ssb);
Expand Down

0 comments on commit 8460cbc

Please sign in to comment.