aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2018-12-26 15:16:46 +0100
committerEven Rouault <even.rouault@spatialys.com>2018-12-30 21:48:56 +0100
commit62b9e04cd32587b10bfac2051d3b259f3233e7b2 (patch)
tree7b7846443b6cefa2c00620d71dfce5955b65ce26
parent8ab6f683cd316acf57bb89ed83932a267c5aa3c2 (diff)
downloadPROJ-62b9e04cd32587b10bfac2051d3b259f3233e7b2.tar.gz
PROJ-62b9e04cd32587b10bfac2051d3b259f3233e7b2.zip
proj_internal.h: remove use of proj_api.h specific structures
-rw-r--r--src/gridinfo.cpp10
-rw-r--r--src/iso19111/factory.cpp1
-rw-r--r--src/nad_init.cpp16
-rw-r--r--src/proj_internal.h66
4 files changed, 49 insertions, 44 deletions
diff --git a/src/gridinfo.cpp b/src/gridinfo.cpp
index 1a0bc16a..14759557 100644
--- a/src/gridinfo.cpp
+++ b/src/gridinfo.cpp
@@ -121,7 +121,7 @@ void pj_gridinfo_free( projCtx ctx, PJ_GRIDINFO *gi )
/* stuff are loaded by pj_gridinfo_init(). */
/************************************************************************/
-int pj_gridinfo_load( projCtx ctx, PJ_GRIDINFO *gi )
+int pj_gridinfo_load( projCtx_t* ctx, PJ_GRIDINFO *gi )
{
struct CTABLE ct_tmp;
@@ -155,7 +155,7 @@ int pj_gridinfo_load( projCtx ctx, PJ_GRIDINFO *gi )
return 0;
}
- result = nad_ctable_load( ctx, &ct_tmp, fid );
+ result = nad_ctable_load( ctx, &ct_tmp, (struct projFileAPI_t*)fid );
pj_ctx_fclose( ctx, fid );
@@ -182,7 +182,7 @@ int pj_gridinfo_load( projCtx ctx, PJ_GRIDINFO *gi )
return 0;
}
- result = nad_ctable2_load( ctx, &ct_tmp, fid );
+ result = nad_ctable2_load( ctx, &ct_tmp, (struct projFileAPI_t*)fid );
pj_ctx_fclose( ctx, fid );
@@ -941,7 +941,7 @@ PJ_GRIDINFO *pj_gridinfo_init( projCtx ctx, const char *gridname )
else if( header_size >= 9 && strncmp(header + 0,"CTABLE V2",9) == 0 )
{
- struct CTABLE *ct = nad_ctable2_init( ctx, fp );
+ struct CTABLE *ct = nad_ctable2_init( ctx, (struct projFileAPI_t*)fp );
gilist->format = "ctable2";
gilist->ct = ct;
@@ -965,7 +965,7 @@ PJ_GRIDINFO *pj_gridinfo_init( projCtx ctx, const char *gridname )
else
{
- struct CTABLE *ct = nad_ctable_init( ctx, fp );
+ struct CTABLE *ct = nad_ctable_init( ctx, (struct projFileAPI_t*)fp );
if (ct == nullptr)
{
pj_log( ctx, PJ_LOG_DEBUG_MAJOR,
diff --git a/src/iso19111/factory.cpp b/src/iso19111/factory.cpp
index dcc32f32..8dac7be7 100644
--- a/src/iso19111/factory.cpp
+++ b/src/iso19111/factory.cpp
@@ -60,6 +60,7 @@
// clang-format off
#include "proj.h"
#include "proj_internal.h"
+#include "proj_api.h"
// clang-format on
#include <sqlite3.h>
diff --git a/src/nad_init.cpp b/src/nad_init.cpp
index b29f7f0e..d9701e70 100644
--- a/src/nad_init.cpp
+++ b/src/nad_init.cpp
@@ -74,9 +74,10 @@ static void swap_words( void *data_in, int word_size, int word_count )
/* Load the data portion of a ctable formatted grid. */
/************************************************************************/
-int nad_ctable_load( projCtx ctx, struct CTABLE *ct, PAFile fid )
+int nad_ctable_load( projCtx ctx, struct CTABLE *ct, struct projFileAPI_t* fileapi )
{
+ PAFile fid = (PAFile)fileapi;
size_t a_size;
pj_ctx_fseek( ctx, fid, sizeof(struct CTABLE), SEEK_SET );
@@ -105,8 +106,9 @@ int nad_ctable_load( projCtx ctx, struct CTABLE *ct, PAFile fid )
/* Read the header portion of a "ctable" format grid. */
/************************************************************************/
-struct CTABLE *nad_ctable_init( projCtx ctx, PAFile fid )
+struct CTABLE *nad_ctable_init( projCtx ctx, struct projFileAPI_t* fileapi )
{
+ PAFile fid = (PAFile)fileapi;
struct CTABLE *ct;
int id_end;
@@ -149,9 +151,10 @@ struct CTABLE *nad_ctable_init( projCtx ctx, PAFile fid )
/* Load the data portion of a ctable2 formatted grid. */
/************************************************************************/
-int nad_ctable2_load( projCtx ctx, struct CTABLE *ct, PAFile fid )
+int nad_ctable2_load( projCtx ctx, struct CTABLE *ct, struct projFileAPI_t* fileapi )
{
+ PAFile fid = (PAFile)fileapi;
size_t a_size;
pj_ctx_fseek( ctx, fid, 160, SEEK_SET );
@@ -189,8 +192,9 @@ int nad_ctable2_load( projCtx ctx, struct CTABLE *ct, PAFile fid )
/* Read the header portion of a "ctable2" format grid. */
/************************************************************************/
-struct CTABLE *nad_ctable2_init( projCtx ctx, PAFile fid )
+struct CTABLE *nad_ctable2_init( projCtx ctx, struct projFileAPI_t* fileapi )
{
+ PAFile fid = (PAFile)fileapi;
struct CTABLE *ct;
int id_end;
char header[160];
@@ -275,10 +279,10 @@ struct CTABLE *nad_init(projCtx ctx, char *name)
return nullptr;
}
- ct = nad_ctable_init( ctx, fid );
+ ct = nad_ctable_init( ctx, (struct projFileAPI_t*)fid );
if( ct != nullptr )
{
- if( !nad_ctable_load( ctx, ct, fid ) )
+ if( !nad_ctable_load( ctx, ct, (struct projFileAPI_t*)fid ) )
{
nad_free( ct );
ct = nullptr;
diff --git a/src/proj_internal.h b/src/proj_internal.h
index 93edae5e..7573e1bf 100644
--- a/src/proj_internal.h
+++ b/src/proj_internal.h
@@ -663,10 +663,6 @@ struct projCtx_t {
int epsg_file_exists; /* -1 = unknown, 0 = no, 1 = yes */
};
-/* classic public API */
-#include "proj_api.h"
-
-
/* Generate pj_list external or make list from include file */
#ifndef PJ_DATUMS__
C_NAMESPACE_VAR struct PJ_DATUMS pj_datums[];
@@ -762,37 +758,40 @@ typedef struct _PJ_GridCatalog {
/* procedure prototypes */
double PROJ_DLL dmstor(const char *, char **);
-double dmstor_ctx(projCtx ctx, const char *, char **);
+double dmstor_ctx(projCtx_t *ctx, const char *, char **);
void PROJ_DLL set_rtodms(int, int);
char PROJ_DLL *rtodms(char *, double, int, int);
double PROJ_DLL adjlon(double);
-double aacos(projCtx,double), aasin(projCtx,double), asqrt(double), aatan2(double, double);
+double aacos(projCtx_t *,double);
+double aasin(projCtx_t *,double);
+double asqrt(double);
+double aatan2(double, double);
-PROJVALUE PROJ_DLL pj_param(projCtx ctx, paralist *, const char *);
+PROJVALUE PROJ_DLL pj_param(projCtx_t *ctx, paralist *, const char *);
paralist PROJ_DLL *pj_param_exists (paralist *list, const char *parameter);
paralist PROJ_DLL *pj_mkparam(const char *);
paralist *pj_mkparam_ws (const char *str);
-int PROJ_DLL pj_ell_set(projCtx ctx, paralist *, double *, double *);
-int pj_datum_set(projCtx,paralist *, PJ *);
+int PROJ_DLL pj_ell_set(projCtx_t *ctx, paralist *, double *, double *);
+int pj_datum_set(projCtx_t *,paralist *, PJ *);
int pj_angular_units_set(paralist *, PJ *);
paralist *pj_clone_paralist( const paralist* );
paralist *pj_search_initcache( const char *filekey );
void pj_insert_initcache( const char *filekey, const paralist *list);
-paralist *pj_expand_init(projCtx ctx, paralist *init);
+paralist *pj_expand_init(projCtx_t *ctx, paralist *init);
-void *pj_dealloc_params (projCtx ctx, paralist *start, int errlev);
+void *pj_dealloc_params (projCtx_t *ctx, paralist *start, int errlev);
double *pj_enfn(double);
double pj_mlfn(double, double, double, double *);
-double pj_inv_mlfn(projCtx, double, double, double *);
+double pj_inv_mlfn(projCtx_t *, double, double, double *);
double pj_qsfn(double, double, double);
double pj_tsfn(double, double, double);
double pj_msfn(double, double, double);
-double PROJ_DLL pj_phi2(projCtx, double, double);
+double PROJ_DLL pj_phi2(projCtx_t *, double, double);
double pj_qsfn_(double, PJ *);
double *pj_authset(double);
double pj_authlat(double, double *);
@@ -830,11 +829,11 @@ int bch2bps(PJ_UV, PJ_UV, PJ_UV **, int, int);
/* nadcon related protos */
PJ_LP nad_intr(PJ_LP, struct CTABLE *);
PJ_LP nad_cvt(PJ_LP, int, struct CTABLE *);
-struct CTABLE *nad_init(projCtx ctx, char *);
-struct CTABLE *nad_ctable_init( projCtx ctx, PAFile fid );
-int nad_ctable_load( projCtx ctx, struct CTABLE *, PAFile fid );
-struct CTABLE *nad_ctable2_init( projCtx ctx, PAFile fid );
-int nad_ctable2_load( projCtx ctx, struct CTABLE *, PAFile fid );
+struct CTABLE *nad_init(projCtx_t *ctx, char *);
+struct CTABLE *nad_ctable_init( projCtx_t *ctx, struct projFileAPI_t* fid );
+int nad_ctable_load( projCtx_t *ctx, struct CTABLE *, struct projFileAPI_t* fid );
+struct CTABLE *nad_ctable2_init( projCtx_t *ctx, struct projFileAPI_t* fid );
+int nad_ctable2_load( projCtx_t *ctx, struct CTABLE *, struct projFileAPI_t* fid );
void nad_free(struct CTABLE *);
/* higher level handling of datum grid shift files */
@@ -848,21 +847,20 @@ int pj_apply_vgridshift( PJ *defn, const char *listname,
int pj_apply_gridshift_2( PJ *defn, int inverse,
long point_count, int point_offset,
double *x, double *y, double *z );
-int pj_apply_gridshift_3( projCtx ctx,
+int pj_apply_gridshift_3( projCtx_t *ctx,
PJ_GRIDINFO **gridlist, int gridlist_count,
int inverse, long point_count, int point_offset,
double *x, double *y, double *z );
-PJ_GRIDINFO **pj_gridlist_from_nadgrids( projCtx, const char *, int * );
-void PROJ_DLL pj_deallocate_grids();
+PJ_GRIDINFO **pj_gridlist_from_nadgrids( projCtx_t *, const char *, int * );
-PJ_GRIDINFO *pj_gridinfo_init( projCtx, const char * );
-int pj_gridinfo_load( projCtx, PJ_GRIDINFO * );
-void pj_gridinfo_free( projCtx, PJ_GRIDINFO * );
+PJ_GRIDINFO *pj_gridinfo_init( projCtx_t *, const char * );
+int pj_gridinfo_load( projCtx_t *, PJ_GRIDINFO * );
+void pj_gridinfo_free( projCtx_t *, PJ_GRIDINFO * );
-PJ_GridCatalog *pj_gc_findcatalog( projCtx, const char * );
-PJ_GridCatalog *pj_gc_readcatalog( projCtx, const char * );
-void pj_gc_unloadall( projCtx );
+PJ_GridCatalog *pj_gc_findcatalog( projCtx_t *, const char * );
+PJ_GridCatalog *pj_gc_readcatalog( projCtx_t *, const char * );
+void pj_gc_unloadall( projCtx_t *);
int pj_gc_apply_gridshift( PJ *defn, int inverse,
long point_count, int point_offset,
double *x, double *y, double *z );
@@ -870,20 +868,20 @@ int pj_gc_apply_gridshift( PJ *defn, int inverse,
long point_count, int point_offset,
double *x, double *y, double *z );
-PJ_GRIDINFO *pj_gc_findgrid( projCtx ctx,
+PJ_GRIDINFO *pj_gc_findgrid( projCtx_t *ctx,
PJ_GridCatalog *catalog, int after,
PJ_LP location, double date,
PJ_Region *optional_region,
double *grid_date );
-double pj_gc_parsedate( projCtx, const char * );
+double pj_gc_parsedate( projCtx_t *, const char * );
void *proj_mdist_ini(double);
double proj_mdist(double, double, double, const void *);
-double proj_inv_mdist(projCtx ctx, double, const void *);
+double proj_inv_mdist(projCtx_t *ctx, double, const void *);
void *pj_gauss_ini(double, double, double *,double *);
-PJ_LP pj_gauss(projCtx, PJ_LP, const void *);
-PJ_LP pj_inv_gauss(projCtx, PJ_LP, const void *);
+PJ_LP pj_gauss(projCtx_t *, PJ_LP, const void *);
+PJ_LP pj_inv_gauss(projCtx_t *, PJ_LP, const void *);
struct PJ_DATUMS PROJ_DLL *pj_get_datums_ref( void );
@@ -894,7 +892,9 @@ double PROJ_DLL pj_atof( const char* nptr );
double pj_strtod( const char *nptr, char **endptr );
void pj_freeup_plain (PJ *P);
-projPJ pj_init_ctx_with_allow_init_epsg( projCtx ctx, int argc, char **argv, int allow_init_epsg );
+PJ* pj_init_ctx_with_allow_init_epsg( projCtx_t *ctx, int argc, char **argv, int allow_init_epsg );
+/* classic public API */
+#include "proj_api.h"
#endif /* ndef PROJ_INTERNAL_H */