diff options
| author | Thomas Knudsen <lastname DOT firstname AT gmail DOT com> | 2016-04-07 22:21:21 +0200 |
|---|---|---|
| committer | Thomas Knudsen <lastname DOT firstname AT gmail DOT com> | 2016-04-07 22:21:21 +0200 |
| commit | 2d111097d76ce52fb0ba019b20e02b33abe842ed (patch) | |
| tree | 8e73195c423859bd6926a843167fceeb054bc6ff /src/projects.h | |
| parent | 2dc4630e3fb5cabb46a4678109e58aee7ab242d8 (diff) | |
| download | PROJ-2d111097d76ce52fb0ba019b20e02b33abe842ed.tar.gz PROJ-2d111097d76ce52fb0ba019b20e02b33abe842ed.zip | |
pj_list cleanup + added selftest stubs for all projections
The projection list maintained by code in pj_list.c depended on stuff in
projects.h.
This stuff is non-obvious and since it is only used in pj_list.c, it has
been moved from projects.h to pj_list.c (The material moved is based on
some really clever X-macro techniques implemented by numerous
redefinitions of the PROJ_HEAD macro, followed by immediate re-inclusion
of te pj_list.h file).
Also, the self test runner pj_run_selftests has been remodelled, now
depending on a list of self test functions, generated in a similar way
to the projection list, and like the projection list generated by
X-macro techniques in pj_list.c.
For this to work, self test functions need to be available for all
projections. To fulfill this, stubs for all projections not having self
tests already, have been added to PJ_aea.c
Along with the recent build system patches by @kbevers, this first part
of the macro-refactoring project is considered close to finished.
Diffstat (limited to 'src/projects.h')
| -rw-r--r-- | src/projects.h | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/projects.h b/src/projects.h index 2b638e94..307b69bd 100644 --- a/src/projects.h +++ b/src/projects.h @@ -169,6 +169,13 @@ struct PJ_LIST { struct PJconsts *(*proj)(struct PJconsts*);/* projection entry point */ char * const *descr; /* description text */ }; + +/* Merging this into the PJ_LIST infrastructure is tempting, but may imply ABI breakage. Perhaps at next major version? */ +struct PJ_SELFTEST_LIST { + char *id; /* projection keyword */ + int (* testfunc)(void); /* projection entry point */ +}; + struct PJ_ELLPS { char *id; /* ellipse keyword name */ char *major; /* a= value */ @@ -301,24 +308,16 @@ PROJ_PARMS__ /* public API */ #include "proj_api.h" + /* Generate pj_list external or make list from include file */ + #ifndef USE_PJ_LIST_H extern struct PJ_LIST pj_list[]; -#else -#define PROJ_HEAD(id, name) \ - struct PJconsts *pj_##id(struct PJconsts*); extern char * const pj_s_##id; - -#include "pj_list.h" -#undef PROJ_HEAD -#define PROJ_HEAD(id, name) {#id, pj_##id, &pj_s_##id}, - struct PJ_LIST -pj_list[] = { -#include "pj_list.h" - {0, 0, 0}, - }; -#undef PROJ_HEAD +extern struct PJ_SELFTEST_LIST pj_selftest_list[]; #endif + + #ifndef PJ_ELLPS__ extern struct PJ_ELLPS pj_ellps[]; #endif @@ -571,6 +570,7 @@ struct PJ_ELLPS *pj_get_ellps_ref( void ); struct PJ_DATUMS *pj_get_datums_ref( void ); struct PJ_UNITS *pj_get_units_ref( void ); struct PJ_LIST *pj_get_list_ref( void ); +struct PJ_SELFTEST_LIST *pj_get_selftest_list_ref ( void ); struct PJ_PRIME_MERIDIANS *pj_get_prime_meridians_ref( void ); double pj_atof( const char* nptr ); |
