diff options
| author | Thomas Knudsen <busstoptaktik@users.noreply.github.com> | 2018-02-12 11:53:27 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-02-12 11:53:27 +0100 |
| commit | a557b49e85ebfbfe0af076bc529002ca60e4a045 (patch) | |
| tree | 3f56b95bd9fcce2a4f4c0725b7cda1bcb4bba1cf /src/projects.h | |
| parent | 4bbb3df6c7ca56f477ef53113258d13f8a71bbce (diff) | |
| parent | 5480a1ffaa38e16dd592beeaa42deb7e2cf4eadb (diff) | |
| download | PROJ-a557b49e85ebfbfe0af076bc529002ca60e4a045.tar.gz PROJ-a557b49e85ebfbfe0af076bc529002ca60e4a045.zip | |
Merge pull request #793 from busstoptaktik/pj_init_cleanup
A few repairs in and around pj_init.c
Diffstat (limited to 'src/projects.h')
| -rw-r--r-- | src/projects.h | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/src/projects.h b/src/projects.h index bfbe08cb..25ff82a4 100644 --- a/src/projects.h +++ b/src/projects.h @@ -218,6 +218,37 @@ struct PJ_AREA { struct projCtx_t; typedef struct projCtx_t projCtx_t; +/***************************************************************************** + + Some function types that are especially useful when working with PJs + +****************************************************************************** + +PJ_CONSTRUCTOR: + + A function taking a pointer-to-PJ as arg, and returning a pointer-to-PJ. + Historically called twice: First with a 0 argument, to allocate memory, + second with the first return value as argument, for actual setup. + +PJ_DESTRUCTOR: + + A function taking a pointer-to-PJ and an integer as args, then first + handling the deallocation of the PJ, afterwards handing the integer over + to the error reporting subsystem, and finally returning a null pointer in + support of the "return free (P)" (aka "get the hell out of here") idiom. + +PJ_OPERATOR: + + A function taking a PJ_COORD and a pointer-to-PJ as args, applying the + PJ to the PJ_COORD, and returning the resulting PJ_COORD. + +*****************************************************************************/ +typedef PJ *(* PJ_CONSTRUCTOR) (PJ *); +typedef void *(* PJ_DESTRUCTOR) (PJ *, int); +typedef PJ_COORD (* PJ_OPERATOR) (PJ_COORD, PJ *); +/****************************************************************************/ + + /* base projection data structure */ struct PJconsts { @@ -267,10 +298,10 @@ struct PJconsts { LP (*inv)(XY, PJ *); XYZ (*fwd3d)(LPZ, PJ *); LPZ (*inv3d)(XYZ, PJ *); - PJ_COORD (*fwd4d)(PJ_COORD, PJ *); - PJ_COORD (*inv4d)(PJ_COORD, PJ *); + PJ_OPERATOR fwd4d; + PJ_OPERATOR inv4d; - void *(*destructor)(PJ *, int); + PJ_DESTRUCTOR destructor; /************************************************************************************* |
