[GRASS-SVN] r44518 - in
grass/branches/releasebranch_6_4/raster/simwe: r.sim.sediment
r.sim.water simlib
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Dec 2 07:59:06 EST 2010
Author: neteler
Date: 2010-12-02 04:59:06 -0800 (Thu, 02 Dec 2010)
New Revision: 44518
Modified:
grass/branches/releasebranch_6_4/raster/simwe/r.sim.sediment/main.c
grass/branches/releasebranch_6_4/raster/simwe/r.sim.water/main.c
grass/branches/releasebranch_6_4/raster/simwe/simlib/hydro.c
grass/branches/releasebranch_6_4/raster/simwe/simlib/output.c
grass/branches/releasebranch_6_4/raster/simwe/simlib/waterglobs.h
Log:
glynn: Eliminate preprocessor abuse (backport of trunk r42402)
Modified: grass/branches/releasebranch_6_4/raster/simwe/r.sim.sediment/main.c
===================================================================
--- grass/branches/releasebranch_6_4/raster/simwe/r.sim.sediment/main.c 2010-12-02 11:16:35 UTC (rev 44517)
+++ grass/branches/releasebranch_6_4/raster/simwe/r.sim.sediment/main.c 2010-12-02 12:59:06 UTC (rev 44518)
@@ -7,7 +7,7 @@
* AUTHOR(S): L. Mitas, H. Mitasova, J. Hofierka
* PURPOSE: Sediment transport simulation (SIMWE)
*
- * COPYRIGHT: (C) 2002 by the GRASS Development Team
+ * COPYRIGHT: (C) 2002, 2010 by the GRASS Development Team
*
* This program is free software under the GNU General Public
* License (>=v2). Read the file COPYING that comes with GRASS
@@ -80,7 +80,7 @@
/* Specific stuff */
/********************************/
-#define MAIN
+
#include <grass/waterglobs.h>
char fncdsm[32];
@@ -99,7 +99,7 @@
/****************************************/
int main(int argc, char *argv[])
{
- int i, ii, j, l;
+ int i, j, l, ii;
int ret_val;
double x_orig, y_orig;
static int rand1 = 12345;
Modified: grass/branches/releasebranch_6_4/raster/simwe/r.sim.water/main.c
===================================================================
--- grass/branches/releasebranch_6_4/raster/simwe/r.sim.water/main.c 2010-12-02 11:16:35 UTC (rev 44517)
+++ grass/branches/releasebranch_6_4/raster/simwe/r.sim.water/main.c 2010-12-02 12:59:06 UTC (rev 44518)
@@ -7,7 +7,7 @@
* AUTHOR(S): L. Mitas, H. Mitasova, J. Hofierka
* PURPOSE: Hydrologic and sediment transport simulation (SIMWE)
*
- * COPYRIGHT: (C) 2002 by the GRASS Development Team
+ * COPYRIGHT: (C) 2002, 2010 by the GRASS Development Team
*
* This program is free software under the GNU General Public
* License (>=v2). Read the file COPYING that comes with GRASS
@@ -87,7 +87,7 @@
/* Specific stuff */
/********************************/
-#define MAIN
+
#include <grass/waterglobs.h>
char fncdsm[32];
@@ -106,7 +106,7 @@
/****************************************/
int main(int argc, char *argv[])
{
- int i, ii, j, l;
+ int i, j, l, ii;
int ret_val;
double x_orig, y_orig;
static int rand1 = 12345;
Modified: grass/branches/releasebranch_6_4/raster/simwe/simlib/hydro.c
===================================================================
--- grass/branches/releasebranch_6_4/raster/simwe/simlib/hydro.c 2010-12-02 11:16:35 UTC (rev 44517)
+++ grass/branches/releasebranch_6_4/raster/simwe/simlib/hydro.c 2010-12-02 12:59:06 UTC (rev 44518)
@@ -24,9 +24,101 @@
#include <grass/linkm.h>
#include <grass/glocale.h>
-#define MAIN
#include <grass/waterglobs.h>
+struct options parm;
+struct flags flag;
+
+FILE *fdelevin, *fddxin, *fddyin, *fdrain, *fdinfil, *fdtraps,
+ *fdmanin, *fddepth, *fddisch, *fderr;
+FILE *fdwdepth, *fddetin, *fdtranin, *fdtauin, *fdtc, *fdet, *fdconc,
+ *fdflux, *fderdep;
+FILE *fdsfile, *fw;
+
+char *elevin;
+char *dxin;
+char *dyin;
+char *rain;
+char *infil;
+char *traps;
+char *manin;
+/* char *sfile; */
+char *depth;
+char *disch;
+char *err;
+/* char *outwalk; */
+char *mapset;
+char *mscale;
+char *tserie;
+
+char *wdepth;
+char *detin;
+char *tranin;
+char *tauin;
+char *tc;
+char *et;
+char *conc;
+char *flux;
+char *erdep;
+
+char *rainval;
+char *maninval;
+char *infilval;
+
+struct seed seed;
+
+struct Cell_head cellhd;
+
+/*
+struct Point *points;
+int npoints;
+int npoints_alloc;
+*/
+
+double xmin, ymin, xmax, ymax;
+double mayy, miyy, maxx, mixx;
+int mx, my;
+int mx2, my2;
+
+double bxmi, bymi, bxma, byma, bresx, bresy;
+int maxwab;
+double step, conv;
+
+double frac;
+double bxmi, bymi;
+
+float **zz, **cchez;
+double **v1, **v2, **slope;
+double **gama, **gammas, **si, **inf, **sigma;
+float **dc, **tau, **er, **ct, **trap;
+float **dif;
+
+/* double vavg[MAXW][2], stack[MAXW][3], w[MAXW][3]; */
+double vavg[MAXW][2], w[MAXW][3];
+int iflag[MAXW];
+
+double hbeta;
+/* int ldemo; */
+double hhmax, sisum, vmean;
+double infsum, infmean;
+int maxw, maxwa, nwalk;
+double rwalk, bresx, bresy, xrand, yrand;
+double stepx, stepy, xp0, yp0;
+double chmean, si0, deltap, deldif, cch, hhc, halpha;
+double eps;
+/* int maxwab, nstack; */
+int maxwab;
+int iterout, mx2o, my2o;
+int miter, nwalka, lwwfin;
+double timec;
+int ts, timesec;
+
+double rain_val;
+double manin_val;
+double infil_val;
+
+struct History history; /* holds meta-data (title, comments,..) */
+
/* **************************************************** */
/* create walker representation of si */
/* ******************************************************** */
Modified: grass/branches/releasebranch_6_4/raster/simwe/simlib/output.c
===================================================================
--- grass/branches/releasebranch_6_4/raster/simwe/simlib/output.c 2010-12-02 11:16:35 UTC (rev 44517)
+++ grass/branches/releasebranch_6_4/raster/simwe/simlib/output.c 2010-12-02 12:59:06 UTC (rev 44518)
@@ -609,7 +609,7 @@
float etmax = -1.e+12, etmin = 1.e+12;
float trc;
struct Colors colors;
- char *mapst = NULL;
+ const char *mapst = NULL;
/* char buf[256]; */
FCELL dat1, dat2;
Modified: grass/branches/releasebranch_6_4/raster/simwe/simlib/waterglobs.h
===================================================================
--- grass/branches/releasebranch_6_4/raster/simwe/simlib/waterglobs.h 2010-12-02 11:16:35 UTC (rev 44517)
+++ grass/branches/releasebranch_6_4/raster/simwe/simlib/waterglobs.h 2010-12-02 12:59:06 UTC (rev 44518)
@@ -5,76 +5,74 @@
#define MAXW 7000000
#define UNDEF -9999
-#ifdef MAIN
-#define GLOBAL
-#else
-#define GLOBAL extern
-#endif
-
/*
-GLOBAL FILE *fdelevin, *fddxin, *fddyin, *fdrain, *fdinfil, *fdtraps,
+extern FILE *fdelevin, *fddxin, *fddyin, *fdrain, *fdinfil, *fdtraps,
*fdmanin, *fddepth, *fddisch, *fderr, *fdoutwalk, *fdwalkers;
*/
-GLOBAL FILE *fdelevin, *fddxin, *fddyin, *fdrain, *fdinfil, *fdtraps,
+extern FILE *fdelevin, *fddxin, *fddyin, *fdrain, *fdinfil, *fdtraps,
*fdmanin, *fddepth, *fddisch, *fderr;
-GLOBAL FILE *fdwdepth, *fddetin, *fdtranin, *fdtauin, *fdtc, *fdet, *fdconc,
+extern FILE *fdwdepth, *fddetin, *fdtranin, *fdtauin, *fdtc, *fdet, *fdconc,
*fdflux, *fderdep;
-GLOBAL FILE *fdsfile, *fw;
+extern FILE *fdsfile, *fw;
-GLOBAL char *elevin;
-GLOBAL char *dxin;
-GLOBAL char *dyin;
-GLOBAL char *rain;
-GLOBAL char *infil;
-GLOBAL char *traps;
-GLOBAL char *manin;
-/* GLOBAL char *sfile; */
-GLOBAL char *depth;
-GLOBAL char *disch;
-GLOBAL char *err;
-/* GLOBAL char *outwalk; */
-GLOBAL char *mapset;
-GLOBAL char *mscale;
-GLOBAL char *tserie;
+extern char *elevin;
+extern char *dxin;
+extern char *dyin;
+extern char *rain;
+extern char *infil;
+extern char *traps;
+extern char *manin;
+/* extern char *sfile; */
+extern char *depth;
+extern char *disch;
+extern char *err;
+/* extern char *outwalk; */
+extern char *mapset;
+extern char *mscale;
+extern char *tserie;
-GLOBAL char *wdepth;
-GLOBAL char *detin;
-GLOBAL char *tranin;
-GLOBAL char *tauin;
-GLOBAL char *tc;
-GLOBAL char *et;
-GLOBAL char *conc;
-GLOBAL char *flux;
-GLOBAL char *erdep;
+extern char *wdepth;
+extern char *detin;
+extern char *tranin;
+extern char *tauin;
+extern char *tc;
+extern char *et;
+extern char *conc;
+extern char *flux;
+extern char *erdep;
-GLOBAL char *rainval;
-GLOBAL char *maninval;
-GLOBAL char *infilval;
+extern char *rainval;
+extern char *maninval;
+extern char *infilval;
-GLOBAL struct
+struct options
{
struct Option *elevin, *dxin, *dyin, *rain, *infil, *traps, *manin,
*sfile, *depth, *disch, *err, *outwalk, *nwalk, *niter, *outiter,
*density, *diffc, *hmax, *halpha, *hbeta, *wdepth, *detin, *tranin,
*tauin, *tc, *et, *conc, *flux, *erdep, *rainval, *maninval,
*infilval;
-} parm;
+};
+extern struct options parm;
-GLOBAL struct
+struct flags
{
struct Flag *mscale, *tserie;
-} flag;
+};
+extern struct flags flag;
-GLOBAL struct
+struct seed
{
long int is1, is2;
-} seed;
+};
+extern struct seed seed;
-GLOBAL struct Cell_head cellhd;
+extern struct Cell_head cellhd;
+
struct Point
{
double north, east;
@@ -82,68 +80,68 @@
};
/*
-GLOBAL struct Point *points;
-GLOBAL int npoints;
-GLOBAL int npoints_alloc;
+extern struct Point *points;
+extern int npoints;
+extern int npoints_alloc;
*/
-GLOBAL int input_data(void);
-GLOBAL int seeds(long int, long int);
-GLOBAL int seedg(long int, long int);
-GLOBAL int grad_check(void);
-GLOBAL void erod(double **);
-GLOBAL void main_loop(void);
-GLOBAL int output_data(int, double);
-GLOBAL int output_et(void);
-GLOBAL double ulec(void);
-GLOBAL double gasdev(void);
-GLOBAL double amax1(double, double);
-GLOBAL double amin1(double, double);
-GLOBAL int min(int, int);
-GLOBAL int max(int, int);
+extern int input_data(void);
+extern int seeds(long int, long int);
+extern int seedg(long int, long int);
+extern int grad_check(void);
+extern void erod(double **);
+extern void main_loop(void);
+extern int output_data(int, double);
+extern int output_et(void);
+extern double ulec(void);
+extern double gasdev(void);
+extern double amax1(double, double);
+extern double amin1(double, double);
+extern int min(int, int);
+extern int max(int, int);
-GLOBAL double xmin, ymin, xmax, ymax;
-GLOBAL double mayy, miyy, maxx, mixx;
-GLOBAL int mx, my;
-GLOBAL int mx2, my2;
+extern double xmin, ymin, xmax, ymax;
+extern double mayy, miyy, maxx, mixx;
+extern int mx, my;
+extern int mx2, my2;
-GLOBAL double bxmi, bymi, bxma, byma, bresx, bresy;
-GLOBAL int maxwab;
-GLOBAL double step, conv;
+extern double bxmi, bymi, bxma, byma, bresx, bresy;
+extern int maxwab;
+extern double step, conv;
-GLOBAL double frac;
-GLOBAL double bxmi, bymi;
+extern double frac;
+extern double bxmi, bymi;
-GLOBAL float **zz, **cchez;
-GLOBAL double **v1, **v2, **slope;
-GLOBAL double **gama, **gammas, **si, **inf, **sigma;
-GLOBAL float **dc, **tau, **er, **ct, **trap;
-GLOBAL float **dif;
+extern float **zz, **cchez;
+extern double **v1, **v2, **slope;
+extern double **gama, **gammas, **si, **inf, **sigma;
+extern float **dc, **tau, **er, **ct, **trap;
+extern float **dif;
-/* GLOBAL double vavg[MAXW][2], stack[MAXW][3], w[MAXW][3]; */
-GLOBAL double vavg[MAXW][2], w[MAXW][3];
-GLOBAL int iflag[MAXW];
+/* extern double vavg[MAXW][2], stack[MAXW][3], w[MAXW][3]; */
+extern double vavg[MAXW][2], w[MAXW][3];
+extern int iflag[MAXW];
-GLOBAL double hbeta;
-/* GLOBAL int ldemo; */
-GLOBAL double hhmax, sisum, vmean;
-GLOBAL double infsum, infmean;
-GLOBAL int maxw, maxwa, nwalk;
-GLOBAL double rwalk, bresx, bresy, xrand, yrand;
-GLOBAL double stepx, stepy, xp0, yp0;
-GLOBAL double chmean, si0, deltap, deldif, cch, hhc, halpha;
-GLOBAL double eps;
-/* GLOBAL int maxwab, nstack; */
-GLOBAL int maxwab;
-GLOBAL int iterout, mx2o, my2o;
-GLOBAL int miter, nwalka, lwwfin;
-GLOBAL double timec;
-GLOBAL int ts, timesec;
+extern double hbeta;
+/* extern int ldemo; */
+extern double hhmax, sisum, vmean;
+extern double infsum, infmean;
+extern int maxw, maxwa, nwalk;
+extern double rwalk, bresx, bresy, xrand, yrand;
+extern double stepx, stepy, xp0, yp0;
+extern double chmean, si0, deltap, deldif, cch, hhc, halpha;
+extern double eps;
+/* extern int maxwab, nstack; */
+extern int maxwab;
+extern int iterout, mx2o, my2o;
+extern int miter, nwalka, lwwfin;
+extern double timec;
+extern int ts, timesec;
-GLOBAL double rain_val;
-GLOBAL double manin_val;
-GLOBAL double infil_val;
+extern double rain_val;
+extern double manin_val;
+extern double infil_val;
-GLOBAL struct History history; /* holds meta-data (title, comments,..) */
+extern struct History history; /* holds meta-data (title, comments,..) */
#endif /* __WATERGLOBS_H__ */
More information about the grass-commit
mailing list