diff options
| author | Frank Warmerdam <warmerdam@pobox.com> | 2002-07-08 02:32:05 +0000 |
|---|---|---|
| committer | Frank Warmerdam <warmerdam@pobox.com> | 2002-07-08 02:32:05 +0000 |
| commit | 22b01721aee54803d0d0d5566e4a9b2ef1384382 (patch) | |
| tree | 1a2f1b797d3c9549518a5cc778201f1366e10e88 /src | |
| parent | d26cb6597ecd1c6b612d0159651cd607f9003a09 (diff) | |
| download | PROJ-22b01721aee54803d0d0d5566e4a9b2ef1384382.tar.gz PROJ-22b01721aee54803d0d0d5566e4a9b2ef1384382.zip | |
ensure clean C++ builds
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1025 4e78687f-474d-0410-85f9-8d5e500ac6b2
Diffstat (limited to 'src')
| -rw-r--r-- | src/PJ_goode.c | 2 | ||||
| -rw-r--r-- | src/PJ_ob_tran.c | 3 | ||||
| -rw-r--r-- | src/adjlon.c | 1 | ||||
| -rw-r--r-- | src/bchgen.c | 4 | ||||
| -rw-r--r-- | src/biveval.c | 3 | ||||
| -rw-r--r-- | src/dmstor.c | 4 | ||||
| -rw-r--r-- | src/emess.c | 2 | ||||
| -rw-r--r-- | src/gen_cheb.c | 4 | ||||
| -rw-r--r-- | src/geod_set.c | 5 | ||||
| -rw-r--r-- | src/geodesic.h | 20 | ||||
| -rw-r--r-- | src/makefile.vc | 30 | ||||
| -rw-r--r-- | src/nad2nad.c | 2 | ||||
| -rw-r--r-- | src/nad_init.c | 6 | ||||
| -rw-r--r-- | src/pj_apply_gridshift.c | 8 | ||||
| -rw-r--r-- | src/pj_datums.c | 5 | ||||
| -rw-r--r-- | src/pj_ellps.c | 3 | ||||
| -rw-r--r-- | src/pj_errno.c | 4 | ||||
| -rw-r--r-- | src/pj_init.c | 6 | ||||
| -rw-r--r-- | src/pj_msfn.c | 1 | ||||
| -rw-r--r-- | src/pj_open_lib.c | 3 | ||||
| -rw-r--r-- | src/pj_param.c | 12 | ||||
| -rw-r--r-- | src/pj_qsfn.c | 2 | ||||
| -rw-r--r-- | src/pj_release.c | 2 | ||||
| -rw-r--r-- | src/pj_strerrno.c | 2 | ||||
| -rw-r--r-- | src/pj_tsfn.c | 1 | ||||
| -rw-r--r-- | src/pj_units.c | 2 | ||||
| -rw-r--r-- | src/proj.c | 4 | ||||
| -rw-r--r-- | src/projects.h | 45 |
28 files changed, 116 insertions, 70 deletions
diff --git a/src/PJ_goode.c b/src/PJ_goode.c index d1e6c447..19e67c6d 100644 --- a/src/PJ_goode.c +++ b/src/PJ_goode.c @@ -7,7 +7,7 @@ static const char SCCSID[]="@(#)PJ_goode.c 4.1 94/02/15 GIE REL"; #define PJ_LIB__ #include <projects.h> PROJ_HEAD(goode, "Goode Homolosine") "\n\tPCyl, Sph."; - extern PJ + C_NAMESPACE PJ *pj_sinu(PJ *), *pj_moll(PJ *); #define Y_COR 0.05280 #define PHI_LIM .71093078197902358062 diff --git a/src/PJ_ob_tran.c b/src/PJ_ob_tran.c index 8cf5d995..a1fce2b6 100644 --- a/src/PJ_ob_tran.c +++ b/src/PJ_ob_tran.c @@ -6,7 +6,8 @@ static const char SCCSID[]="@(#)PJ_ob_tran.c 4.1 94/02/15 GIE REL"; double lamp; \ double cphip, sphip; #define PJ_LIB__ -#include <projects.h> +#include <projects.h> +#include <string.h> PROJ_HEAD(ob_tran, "General Oblique Transformation") "\n\tMisc Sph" "\n\to_proj= plus parameters for projection" "\n\to_lat_p= o_lon_p= (new pole) or" diff --git a/src/adjlon.c b/src/adjlon.c index 04f04400..5fd8ea95 100644 --- a/src/adjlon.c +++ b/src/adjlon.c @@ -3,6 +3,7 @@ static const char SCCSID[]="@(#)adjlon.c 4.3 93/06/12 GIE REL"; #endif #include <math.h> +#include <projects.h> #define SPI 3.14159265359 #define TWOPI 6.2831853071795864769 diff --git a/src/bchgen.c b/src/bchgen.c index 4baf73a6..28bcfa75 100644 --- a/src/bchgen.c +++ b/src/bchgen.c @@ -20,7 +20,7 @@ bchgen(projUV a, projUV b, int nu, int nv, projUV **f, projUV(*func)(projUV)) { return(1); } } - if (!(c = vector1(nu, sizeof(projUV)))) return 1; + if (!(c = (projUV *) vector1(nu, sizeof(projUV)))) return 1; fac = 2. / nu; for ( j = 0; j < nv ; ++j) { for ( i = 0; i < nu; ++i) { @@ -38,7 +38,7 @@ bchgen(projUV a, projUV b, int nu, int nv, projUV **f, projUV(*func)(projUV)) { f[i][j] = c[i]; } pj_dalloc(c); - if (!(c = vector1(nv, sizeof(projUV)))) return 1; + if (!(c = (projUV*) vector1(nv, sizeof(projUV)))) return 1; fac = 2. / nv; for ( i = 0; i < nu; ++i) { t = f[i]; diff --git a/src/biveval.c b/src/biveval.c index 5dca4792..c0586cc7 100644 --- a/src/biveval.c +++ b/src/biveval.c @@ -6,8 +6,7 @@ static const char SCCSID[]="@(#)biveval.c 4.4 93/06/12 GIE REL"; # define NEAR_ONE 1.00001 static projUV w2, w; - static double /* basic bivariate Chebyshev evaluation */ -ceval(C, n) struct PW_COEF *C; { +static double ceval(struct PW_COEF *C, int n) { double d=0, dd=0, vd, vdd, tmp, *c; int j; diff --git a/src/dmstor.c b/src/dmstor.c index e4b6064a..ecfac1fc 100644 --- a/src/dmstor.c +++ b/src/dmstor.c @@ -6,7 +6,7 @@ static const char SCCSID[]="@(#)dmstor.c 4.4 93/06/16 GIE REL"; #include <string.h> #include <ctype.h> -static double proj_strtod(const char *nptr, char **endptr); +static double proj_strtod(char *nptr, char **endptr); /* following should be sufficient for all but the rediculous */ #define MAX_WORK 64 @@ -80,7 +80,7 @@ dmstor(const char *is, char **rs) { } static double -proj_strtod(const char *nptr, char **endptr) +proj_strtod(char *nptr, char **endptr) { char c, *cp = nptr; diff --git a/src/emess.c b/src/emess.c index 9e357f9f..81be83ec 100644 --- a/src/emess.c +++ b/src/emess.c @@ -8,9 +8,9 @@ static const char SCCSID[]="@(#)emess.c 4.6 94/05/24 GIE REL"; #include <stdarg.h> #include <errno.h> #include <string.h> +#include <proj_api.h> #define EMESS_ROUTINE #include "emess.h" -extern char const pj_release[]; void emess(int code, char *fmt, ...) { va_list args; diff --git a/src/gen_cheb.c b/src/gen_cheb.c index 191cb822..e85305d8 100644 --- a/src/gen_cheb.c +++ b/src/gen_cheb.c @@ -12,13 +12,13 @@ static const char SCCSID[]="@(#)gen_cheb.c 4.9 95/09/23 GIE REL"; #define COEF_LINE_MAX 60 #endif void -gen_cheb(int inverse, projUV (*proj)(), char *s, PJ *P, int iargc, char **iargv) { +gen_cheb(int inverse, projUV (*proj)(projUV), char *s, PJ *P, int iargc, char **iargv) { int NU = 15, NV = 15, i, res = -1, errin = 0, pwr; char *arg, fmt[15]; projUV low, upp, resid; Tseries *F; extern void p_series(Tseries *, FILE *, char *); - double (*input)(); + double (*input)(const char *, char **); input = inverse ? strtod : dmstor; if (*s) low.u = input(s, &s); else ++errin; diff --git a/src/geod_set.c b/src/geod_set.c index 2f00e9c2..7f3595eb 100644 --- a/src/geod_set.c +++ b/src/geod_set.c @@ -1,8 +1,13 @@ #ifndef lint static const char SCCSID[]="@(#)geod_set.c 4.8 95/09/23 GIE REL"; #endif + +#define _IN_GEOD_SET + +#include <string.h> #include "projects.h" #include "geodesic.h" +#include "emess.h" void geod_set(int argc, char **argv) { paralist *start = 0, *curr; diff --git a/src/geodesic.h b/src/geodesic.h index 825b6925..268cff59 100644 --- a/src/geodesic.h +++ b/src/geodesic.h @@ -6,9 +6,13 @@ static char GEODESIC_H_ID[] = "@(#)geodesic.h 4.3 95/08/19 GIE REL"; extern "C" { #endif -extern double dmstor(); -double proj_strtod(const char *, char **); -struct geodesic { +#ifndef _IN_GEOD_SET +# define GEOD_EXTERN extern +#else +# define GEOD_EXTERN +#endif + +GEOD_EXTERN struct geodesic { double A; double LAM1, PHI1, ALPHA12; double LAM2, PHI2, ALPHA21; @@ -33,13 +37,13 @@ struct geodesic { # define f64 GEODESIC.FLAT64 # define ellipse GEODESIC.ELLIPSE - int -n_alpha, n_S; - double -to_meter, fr_meter, del_alpha; + +GEOD_EXTERN int n_alpha, n_S; +GEOD_EXTERN double to_meter, fr_meter, del_alpha; + void geod_set(int, char **); void geod_for(void); -void geod_prefor(void); +void geod_pre(void); void geod_inv(void); #ifdef __cplusplus diff --git a/src/makefile.vc b/src/makefile.vc index b9ad47a1..eff767c0 100644 --- a/src/makefile.vc +++ b/src/makefile.vc @@ -51,13 +51,13 @@ support = \ pj_zpoly1.obj rtodms.obj vector1.obj pj_release.obj \ geocent.obj pj_transform.obj pj_datum_set.obj pj_datums.obj \ pj_apply_gridshift.obj nad_cvt.obj nad_init.obj \ - nad_intr.obj strtod.obj pj_utils.obj + nad_intr.obj pj_utils.obj LIBOBJ = $(support) $(pseudo) $(azimuthal) $(conic) $(cylinder) $(misc) -PROJEXE_SRC = proj.c gen_cheb.c p_series.c emess.c -CS2CSEXE_SRC = cs2cs.c gen_cheb.c p_series.c emess.c -GEODEXE_SRC = geod.c geod_set.c geod_for.c geod_inv.c emess.c -CFLAGS = /nologo -I. -DPROJ_LIB=\"$(PROJ_LIB_DIR)\" +PROJEXE_OBJ = proj.obj gen_cheb.obj p_series.obj emess.obj +CS2CSEXE_OBJ = cs2cs.obj gen_cheb.obj p_series.obj emess.obj +GEODEXE_OBJ = geod.obj geod_set.obj geod_for.obj geod_inv.obj emess.obj +CFLAGS = /nologo /TP -I. -DPROJ_LIB=\"$(PROJ_LIB_DIR)\" default: all @@ -71,20 +71,20 @@ proj.dll: $(LIBOBJ) link /debug /dll /def:proj.def /out:proj.dll /implib:proj_i.lib \ $(LIBOBJ) -proj.exe: $(PROJEXE_SRC) proj.lib - cl $(CFLAGS) $(PROJEXE_SRC) proj.lib +proj.exe: $(PROJEXE_OBJ) proj.lib + cl $(PROJEXE_OBJ) proj.lib -cs2cs.exe: $(CS2CSEXE_SRC) proj.lib - cl $(CFLAGS) $(CS2CSEXE_SRC) proj.lib +cs2cs.exe: $(CS2CSEXE_OBJ) proj.lib + cl $(CS2CSEXE_OBJ) proj.lib -geod.exe: $(GEODEXE_SRC) proj.lib - cl $(CFLAGS) $(GEODEXE_SRC) proj.lib +geod.exe: $(GEODEXE_OBJ) proj.lib + cl $(GEODEXE_OBJ) proj.lib -nad2nad.exe: nad2nad.c emess.c proj.lib - cl $(CFLAGS) nad2nad.c emess.c proj.lib +nad2nad.exe: nad2nad.obj emess.obj proj.lib + cl nad2nad.obj emess.obj proj.lib -nad2bin.exe: nad2bin.c emess.c proj.lib - cl $(CFLAGS) nad2bin.c emess.c proj.lib +nad2bin.exe: nad2bin.obj emess.obj proj.lib + cl nad2bin.obj emess.obj proj.lib nadshift: nad2bin.exe cd ..\nad diff --git a/src/nad2nad.c b/src/nad2nad.c index b6f158dd..e3833cb0 100644 --- a/src/nad2nad.c +++ b/src/nad2nad.c @@ -134,7 +134,7 @@ set_ops(char *s, struct IO_CON *io) { case 5: if (!(intag = strchr(intag, '=')) || *++intag == '\0') emess(1,"hp missing name"); - strcpy(io->hp = malloc(strlen(intag)+1), intag); + strcpy(io->hp = (char*)malloc(strlen(intag)+1), intag); break; case 6: io->bin = 1; break; case 7: io->rev = 1; break; diff --git a/src/nad_init.c b/src/nad_init.c index 455f4b14..cdc13d41 100644 --- a/src/nad_init.c +++ b/src/nad_init.c @@ -28,6 +28,9 @@ ****************************************************************************** * * $Log$ + * Revision 1.6 2002/07/08 02:32:05 warmerda + * ensure clean C++ builds + * * Revision 1.5 2002/04/30 16:26:07 warmerda * trip newlines of ctable id field * @@ -45,6 +48,7 @@ #include <stdio.h> #include <errno.h> #include <assert.h> +#include <string.h> static int byte_order_test = 1; #define IS_LSB (((unsigned char *) (&byte_order_test))[0] == 1) @@ -92,7 +96,7 @@ static void local_order( unsigned char *data, int word_size, int word_count ) static struct CTABLE *nad_load_ntv1( FILE * fid ) { - char header[176]; + unsigned char header[176]; struct CTABLE *ct; LP ur; double *row_buf; diff --git a/src/pj_apply_gridshift.c b/src/pj_apply_gridshift.c index 61a5944b..7860cbdd 100644 --- a/src/pj_apply_gridshift.c +++ b/src/pj_apply_gridshift.c @@ -31,6 +31,9 @@ ****************************************************************************** * * $Log$ + * Revision 1.4 2002/07/08 02:32:05 warmerda + * ensure clean C++ builds + * * Revision 1.3 2002/04/30 16:27:27 warmerda * improve debug output * @@ -129,9 +132,10 @@ static struct CTABLE *pj_get_grid( const char *name ) /* -------------------------------------------------------------------- */ if( grid_count == 0 ) { - grid_names = pj_malloc(sizeof(char *) * GRID_MAX); + grid_names = (char **) pj_malloc(sizeof(char *) * GRID_MAX); memset( grid_names, 0, sizeof(char *) * GRID_MAX ); - grid_list = pj_malloc(sizeof(struct CTABLE *) * GRID_MAX ); + grid_list = (struct CTABLE **) + pj_malloc(sizeof(struct CTABLE *) * GRID_MAX ); memset( grid_list, 0, sizeof(struct CTABLE *) * GRID_MAX ); } else if( grid_count >= GRID_MAX ) diff --git a/src/pj_datums.c b/src/pj_datums.c index c9c4ae82..9a8aa302 100644 --- a/src/pj_datums.c +++ b/src/pj_datums.c @@ -28,6 +28,9 @@ ****************************************************************************** * * $Log$ + * Revision 1.3 2002/07/08 02:32:05 warmerda + * ensure clean C++ builds + * * Revision 1.2 2001/04/05 19:32:41 warmerda * added ntv1_can.dat to NAD27 list * @@ -46,7 +49,7 @@ * datum name for the comments if available. */ -struct PJ_DATUMS pj_datums[] = { +C_NAMESPACE struct PJ_DATUMS pj_datums[] = { /* id definition ellipse comments */ /* -- ---------- ------- -------- */ "WGS84", "towgs84=0,0,0", "WGS84", "", diff --git a/src/pj_ellps.c b/src/pj_ellps.c index e59b4026..79429776 100644 --- a/src/pj_ellps.c +++ b/src/pj_ellps.c @@ -4,7 +4,8 @@ static const char SCCSID[]="@(#)pj_ellps.c 4.6 95/08/25 GIE REL"; #endif #define PJ_ELLPS__ #include "projects.h" - struct PJ_ELLPS + +C_NAMESPACE struct PJ_ELLPS pj_ellps[] = { "MERIT", "a=6378137.0", "rf=298.257", "MERIT 1983", "SGS85", "a=6378136.0", "rf=298.257", "Soviet Geodetic System 85", diff --git a/src/pj_errno.c b/src/pj_errno.c index 2eb95707..002a5c06 100644 --- a/src/pj_errno.c +++ b/src/pj_errno.c @@ -3,7 +3,9 @@ static const char SCCSID[]="@(#)pj_errno.c 4.3 95/06/03 GIE REL"; #endif -int pj_errno = 0; +#include <projects.h> + +C_NAMESPACE int pj_errno = 0; /************************************************************************/ /* pj_get_errno_ref() */ diff --git a/src/pj_init.c b/src/pj_init.c index ef002a87..39cb7c81 100644 --- a/src/pj_init.c +++ b/src/pj_init.c @@ -91,7 +91,7 @@ pj_init_plus( const char *definition ) PJ *result; /* make a copy that we can manipulate */ - defn_copy = pj_malloc( strlen(definition)+1 ); + defn_copy = (char *) pj_malloc( strlen(definition)+1 ); strcpy( defn_copy, definition ); /* split into arguments based on '+' and trim white space */ @@ -141,7 +141,7 @@ pj_init_plus( const char *definition ) PJ * pj_init(int argc, char **argv) { char *s, *name; - void *(*proj)(PJ *); + PJ *(*proj)(PJ *); paralist *curr; int i; PJ *PIN = 0; @@ -175,7 +175,7 @@ pj_init(int argc, char **argv) { /* set defaults, unless inhibited */ if (!pj_param(start, "bno_defs").i) curr = get_defaults(curr, name); - proj = pj_list[i].proj; + proj = (PJ *(*)(PJ *)) pj_list[i].proj; /* allocate projection structure */ if (!(PIN = (*proj)(0))) goto bum_call; diff --git a/src/pj_msfn.c b/src/pj_msfn.c index 55e3983c..ea6e3cd2 100644 --- a/src/pj_msfn.c +++ b/src/pj_msfn.c @@ -3,6 +3,7 @@ static const char SCCSID[]="@(#)pj_msfn.c 4.3 93/06/12 GIE REL"; #endif #include <math.h> +#include <projects.h> double pj_msfn(double sinphi, double cosphi, double es) { return (cosphi / sqrt (1. - es * sinphi * sinphi)); diff --git a/src/pj_open_lib.c b/src/pj_open_lib.c index 69031fd3..31784c0f 100644 --- a/src/pj_open_lib.c +++ b/src/pj_open_lib.c @@ -32,7 +32,8 @@ void pj_set_finder( const char *(*new_finder)(const char *) ) FILE * pj_open_lib(char *name, char *mode) { - char fname[MAX_PATH_FILENAME+1], *sysname; + char fname[MAX_PATH_FILENAME+1]; + const char *sysname; FILE *fid; int n = 0; diff --git a/src/pj_param.c b/src/pj_param.c index 97df90c0..122c1028 100644 --- a/src/pj_param.c +++ b/src/pj_param.c @@ -7,16 +7,16 @@ static const char SCCSID[]="@(#)pj_param.c 4.4 93/06/12 GIE REL"; #include <string.h> paralist * /* create parameter list entry */ pj_mkparam(char *str) { - paralist *new; + paralist *newitem; - if (new = (paralist *)pj_malloc(sizeof(paralist) + strlen(str))) { - new->used = 0; - new->next = 0; + if (newitem = (paralist *)pj_malloc(sizeof(paralist) + strlen(str))) { + newitem->used = 0; + newitem->next = 0; if (*str == '+') ++str; - (void)strcpy(new->param, str); + (void)strcpy(newitem->param, str); } - return new; + return newitem; } /************************************************************************/ diff --git a/src/pj_qsfn.c b/src/pj_qsfn.c index c0610be3..0462bfee 100644 --- a/src/pj_qsfn.c +++ b/src/pj_qsfn.c @@ -3,6 +3,8 @@ static const char SCCSID[]="@(#)pj_qsfn.c 4.3 93/06/12 GIE REL"; #endif #include <math.h> +#include <projects.h> + # define EPSILON 1.0e-7 double pj_qsfn(double sinphi, double e, double one_es) { diff --git a/src/pj_release.c b/src/pj_release.c index f6b7a8f0..d474b9d8 100644 --- a/src/pj_release.c +++ b/src/pj_release.c @@ -3,4 +3,6 @@ static const char SCCSID[]="@(#)pj_release.c 4.5 95/09/23 GIE REL"; #endif +#include <projects.h> + char const pj_release[]="Rel. 4.4.5, 9 January 2002"; diff --git a/src/pj_strerrno.c b/src/pj_strerrno.c index 0340fb9f..f903588f 100644 --- a/src/pj_strerrno.c +++ b/src/pj_strerrno.c @@ -2,8 +2,10 @@ #ifndef lint static const char SCCSID[]="@(#)pj_strerrno.c 4.12 94/05/25 GIE REL"; #endif +#include <stdio.h> #include <errno.h> #include <string.h> +#include <projects.h> static char * pj_err_list[] = { "no arguments in initialization list", /* -1 */ diff --git a/src/pj_tsfn.c b/src/pj_tsfn.c index 3c223e05..bbb30cda 100644 --- a/src/pj_tsfn.c +++ b/src/pj_tsfn.c @@ -3,6 +3,7 @@ static const char SCCSID[]="@(#)pj_tsfn.c 4.3 93/06/12 GIE REL"; #endif #include <math.h> +#include <projects.h> #define HALFPI 1.5707963267948966 double pj_tsfn(double phi, double sinphi, double e) { diff --git a/src/pj_units.c b/src/pj_units.c index a29b3a18..23372371 100644 --- a/src/pj_units.c +++ b/src/pj_units.c @@ -7,7 +7,7 @@ static const char SCCSID[]="@(#)pj_units.c 4.6 93/06/12 GIE REL"; /* Field 2 that contains the multiplier to convert named units to meters ** may be expressed by either a simple floating point constant or a ** numerator/denomenator values (e.g. 1/1000) */ - struct PJ_UNITS +C_NAMESPACE struct PJ_UNITS pj_units[] = { "km", "1000.", "Kilometer", "m", "1.", "Meter", @@ -52,7 +52,7 @@ facs; (*informat)(const char *, char **), /* input data deformatter function */ fscale = 0.; /* cartesian scale factor */ static projUV -int_proj(data) projUV data; { +int_proj(projUV data) { if (prescale) { data.u *= fscale; data.v *= fscale; } data = (*proj)(data, Proj); if (postscale && data.u != HUGE_VAL) @@ -429,7 +429,7 @@ int main(int argc, char **argv) { } else proj = pj_fwd; if (cheby_str) { - extern void gen_cheb(int, projUV(*)(), char *, PJ *, int, char **); + extern void gen_cheb(int, projUV(*)(projUV), char *, PJ *, int, char **); gen_cheb(inverse, int_proj, cheby_str, Proj, iargc, iargv); exit(0); diff --git a/src/projects.h b/src/projects.h index fe602c08..4091fc9a 100644 --- a/src/projects.h +++ b/src/projects.h @@ -28,6 +28,9 @@ ****************************************************************************** * * $Log$ + * Revision 1.12 2002/07/08 02:32:05 warmerda + * ensure clean C++ builds + * * Revision 1.11 2002/06/20 16:09:31 warmerda * removed strtod, reimplement non-GPL strtod cover within dmstor.c * @@ -61,7 +64,10 @@ #include <stdlib.h> #ifdef __cplusplus +#define C_NAMESPACE extern "C" extern "C" { +#else +#define C_NAMESPACE extern #endif #ifndef NULL @@ -137,10 +143,11 @@ typedef struct { double lam, phi; } LP; #endif typedef union { double f; int i; char *s; } PVALUE; - +struct PJconsts; + struct PJ_LIST { char *id; /* projection keyword */ - void *(*proj)(); /* projection entry point */ + struct PJconsts *(*proj)(struct PJconsts*);/* projection entry point */ char * const *descr; /* description text */ }; struct PJ_ELLPS { @@ -162,11 +169,13 @@ struct PJ_DATUMS { char *comments; /* EPSG code, etc */ }; +struct DERIVS { + double x_l, x_p; /* derivatives of x for lambda-phi */ + double y_l, y_p; /* derivatives of y for lambda-phi */ +}; + struct FACTORS { - struct DERIVS { - double x_l, x_p; /* derivatives of x for lambda-phi */ - double y_l, y_p; /* derivatives of y for lambda-phi */ - } der; + struct DERIVS der; double h, k; /* meridinal, parallel scales */ double omega, thetap; /* angular distortion, theta prime */ double conv; /* convergence */ @@ -224,7 +233,8 @@ PROJ_PARMS__ extern struct PJ_LIST pj_list[]; #else #define PROJ_HEAD(id, name) \ - extern void *pj_##id(); extern char * const pj_s_##id; + struct PJconsts *pj_##id(struct PJconsts*); extern char * const pj_s_##id; + #ifndef lint #define DO_PJ_LIST_ID #endif @@ -257,9 +267,9 @@ extern struct PJ_DATUMS pj_datums[]; #ifdef PJ_LIB__ /* repeatative projection code */ #define PROJ_HEAD(id, name) static const char des_##id [] = name -#define ENTRYA(name) const char * const pj_s_##name = des_##name; \ - PJ *pj_##name(PJ *P) { if (!P) { \ - if( (P = pj_malloc(sizeof(PJ))) != NULL) { \ +#define ENTRYA(name) C_NAMESPACE const char * const pj_s_##name = des_##name; \ + C_NAMESPACE PJ *pj_##name(PJ *P) { if (!P) { \ + if( (P = (PJ*) pj_malloc(sizeof(PJ))) != NULL) { \ P->pfree = freeup; P->fwd = 0; P->inv = 0; \ P->spc = 0; P->descr = des_##name; #define ENTRYX } return P; } else { @@ -271,8 +281,8 @@ extern struct PJ_DATUMS pj_datums[]; #define E_ERROR_0 { freeup(P); return(0); } #define F_ERROR { pj_errno = -20; return(xy); } #define I_ERROR { pj_errno = -20; return(lp); } -#define FORWARD(name) static XY name(LP lp, PJ *P) { XY xy -#define INVERSE(name) static LP name(XY xy, PJ *P) { LP lp +#define FORWARD(name) static XY name(LP lp, PJ *P) { XY xy = {0.0,0.0} +#define INVERSE(name) static LP name(XY xy, PJ *P) { LP lp = {0.0,0.0} #define FREEUP static void freeup(PJ *P) { #define SPECIAL(name) static void name(LP lp, PJ *P, struct FACTORS *fac) #endif @@ -313,14 +323,16 @@ FILE *pj_open_lib(char *, char *); int pj_deriv(LP, double, PJ *, struct DERIVS *); int pj_factors(LP, PJ *, double, struct FACTORS *); +struct PW_COEF {/* row coefficient structure */ + int m; /* number of c coefficients (=0 for none) */ + double *c; /* power coefficients */ +}; + /* Approximation structures and procedures */ typedef struct { /* Chebyshev or Power series structure */ projUV a, b; /* power series range for evaluation */ /* or Chebyshev argument shift/scaling */ - struct PW_COEF {/* row coefficient structure */ - int m; /* number of c coefficients (=0 for none) */ - double *c; /* power coefficients */ - } *cu, *cv; + struct PW_COEF *cu, *cv; int mu, mv; /* maximum cu and cv index (+1 for count) */ int power; /* != 0 if power series, else Chebyshev */ } Tseries; @@ -330,6 +342,7 @@ projUV bcheval(projUV, Tseries *); projUV biveval(projUV, Tseries *); void *vector1(int, int); void **vector2(int, int, int); +void freev2(void **v, int nrows); int bchgen(projUV, projUV, int, int, projUV **, projUV(*)(projUV)); int bch2bps(projUV, projUV, projUV **, int, int); /* nadcon related protos */ |
