[GRASS-SVN] r33993 - in grass/trunk: display/d.what.rast
imagery/i.maxlik imagery/i.points imagery/i.rectify
imagery/i.vpoints include/vect lib/vector/rtree
raster/r.buffer raster/r.coin raster/r.cross raster/r.kappa
raster/r.report raster/r.stats
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Oct 23 13:02:11 EDT 2008
Author: glynn
Date: 2008-10-23 13:02:10 -0400 (Thu, 23 Oct 2008)
New Revision: 33993
Removed:
grass/trunk/include/vect/dig_globs.h
Modified:
grass/trunk/display/d.what.rast/main.c
grass/trunk/display/d.what.rast/what.h
grass/trunk/imagery/i.maxlik/global.h
grass/trunk/imagery/i.maxlik/main.c
grass/trunk/imagery/i.points/globals.h
grass/trunk/imagery/i.points/main.c
grass/trunk/imagery/i.rectify/global.h
grass/trunk/imagery/i.rectify/main.c
grass/trunk/imagery/i.vpoints/globals.h
grass/trunk/imagery/i.vpoints/main.c
grass/trunk/include/vect/digit.h
grass/trunk/lib/vector/rtree/split_q.c
grass/trunk/lib/vector/rtree/split_q.h
grass/trunk/raster/r.buffer/distance.h
grass/trunk/raster/r.buffer/main.c
grass/trunk/raster/r.coin/coin.h
grass/trunk/raster/r.coin/main.c
grass/trunk/raster/r.cross/glob.h
grass/trunk/raster/r.cross/main.c
grass/trunk/raster/r.kappa/kappa.h
grass/trunk/raster/r.kappa/main.c
grass/trunk/raster/r.report/global.h
grass/trunk/raster/r.report/main.c
grass/trunk/raster/r.stats/global.h
grass/trunk/raster/r.stats/main.c
Log:
Eliminate preprocessor abuse
Modified: grass/trunk/display/d.what.rast/main.c
===================================================================
--- grass/trunk/display/d.what.rast/main.c 2008-10-23 14:39:30 UTC (rev 33992)
+++ grass/trunk/display/d.what.rast/main.c 2008-10-23 17:02:10 UTC (rev 33993)
@@ -18,7 +18,7 @@
* for details.
*
*****************************************************************************/
-#define GLOBAL
+
#include <stdlib.h>
#include <string.h>
#include "what.h"
@@ -27,6 +27,13 @@
#include <grass/glocale.h>
#include "local_proto.h"
+struct Categories *cats;
+int *fd;
+char **rast;
+int nrasts;
+char **name;
+char **mapset;
+
int main(int argc, char **argv)
{
int i, j;
Modified: grass/trunk/display/d.what.rast/what.h
===================================================================
--- grass/trunk/display/d.what.rast/what.h 2008-10-23 14:39:30 UTC (rev 33992)
+++ grass/trunk/display/d.what.rast/what.h 2008-10-23 17:02:10 UTC (rev 33993)
@@ -1,12 +1,8 @@
#include <grass/gis.h>
-#ifndef GLOBAL
-#define GLOBAL extern
-#endif
-
-GLOBAL struct Categories *cats;
-GLOBAL int *fd;
-GLOBAL char **rast;
-GLOBAL int nrasts;
-GLOBAL char **name;
-GLOBAL char **mapset;
+extern struct Categories *cats;
+extern int *fd;
+extern char **rast;
+extern int nrasts;
+extern char **name;
+extern char **mapset;
Modified: grass/trunk/imagery/i.maxlik/global.h
===================================================================
--- grass/trunk/imagery/i.maxlik/global.h 2008-10-23 14:39:30 UTC (rev 33992)
+++ grass/trunk/imagery/i.maxlik/global.h 2008-10-23 17:02:10 UTC (rev 33993)
@@ -1,18 +1,14 @@
#include <grass/imagery.h>
-#ifndef GLOBAL
-#define GLOBAL extern
-#endif
-
-GLOBAL char *group;
-GLOBAL char *subgroup;
-GLOBAL char *sigfile;
-GLOBAL struct Ref Ref;
-GLOBAL struct Signature S;
-GLOBAL DCELL **cell;
-GLOBAL int *cellfd;
-GLOBAL CELL *class_cell, *reject_cell;
-GLOBAL int class_fd, reject_fd;
-GLOBAL char *class_name, *reject_name;
-GLOBAL double *B;
-GLOBAL double *P;
+extern char *group;
+extern char *subgroup;
+extern char *sigfile;
+extern struct Ref Ref;
+extern struct Signature S;
+extern DCELL **cell;
+extern int *cellfd;
+extern CELL *class_cell, *reject_cell;
+extern int class_fd, reject_fd;
+extern char *class_name, *reject_name;
+extern double *B;
+extern double *P;
Modified: grass/trunk/imagery/i.maxlik/main.c
===================================================================
--- grass/trunk/imagery/i.maxlik/main.c 2008-10-23 14:39:30 UTC (rev 33992)
+++ grass/trunk/imagery/i.maxlik/main.c 2008-10-23 17:02:10 UTC (rev 33993)
@@ -18,13 +18,25 @@
* for details.
*
*****************************************************************************/
-#define GLOBAL
+
#include <stdlib.h>
#include <grass/gis.h>
#include <grass/glocale.h>
#include "global.h"
#include "local_proto.h"
+char *group;
+char *subgroup;
+char *sigfile;
+struct Ref Ref;
+struct Signature S;
+DCELL **cell;
+int *cellfd;
+CELL *class_cell, *reject_cell;
+int class_fd, reject_fd;
+char *class_name, *reject_name;
+double *B;
+double *P;
int main(int argc, char *argv[])
{
Modified: grass/trunk/imagery/i.points/globals.h
===================================================================
--- grass/trunk/imagery/i.points/globals.h 2008-10-23 14:39:30 UTC (rev 33992)
+++ grass/trunk/imagery/i.points/globals.h 2008-10-23 17:02:10 UTC (rev 33993)
@@ -1,59 +1,49 @@
#include "defs.h"
-#ifndef GLOBAL
-# define GLOBAL extern
-# define INIT(x)
-#else
-# define INIT(x) = x
-#endif
+extern int SCREEN_TOP;
+extern int SCREEN_BOTTOM;
+extern int SCREEN_LEFT;
+extern int SCREEN_RIGHT;
-GLOBAL int G_get_color();
+extern Window *INFO_WINDOW;
+extern Window *MENU_WINDOW;
+extern Window *PROMPT_WINDOW;
-GLOBAL int SCREEN_TOP;
-GLOBAL int SCREEN_BOTTOM;
-GLOBAL int SCREEN_LEFT;
-GLOBAL int SCREEN_RIGHT;
+extern View *VIEW_MAP1;
+extern View *VIEW_TITLE1;
+extern View *VIEW_MAP1_ZOOM;
+extern View *VIEW_TITLE1_ZOOM;
-GLOBAL Window *INFO_WINDOW;
-GLOBAL Window *MENU_WINDOW;
-GLOBAL Window *PROMPT_WINDOW;
+extern View *VIEW_MAP2;
+extern View *VIEW_TITLE2;
+extern View *VIEW_MAP2_ZOOM;
+extern View *VIEW_TITLE2_ZOOM;
-GLOBAL View *VIEW_MAP1;
-GLOBAL View *VIEW_TITLE1;
-GLOBAL View *VIEW_MAP1_ZOOM;
-GLOBAL View *VIEW_TITLE1_ZOOM;
+extern View *VIEW_MENU;
-GLOBAL View *VIEW_MAP2;
-GLOBAL View *VIEW_TITLE2;
-GLOBAL View *VIEW_MAP2_ZOOM;
-GLOBAL View *VIEW_TITLE2_ZOOM;
+extern Group group;
-GLOBAL View *VIEW_MENU;
+extern char interrupt_char;
+extern char *tempfile1;
+extern char *tempfile2;
+extern char *digit_points; /* digitizer control points */
+extern char *digit_results; /* digitizer results */
+extern int use_digitizer; /* is there a digitizer out there? */
-GLOBAL Group group;
-
-GLOBAL char interrupt_char;
-GLOBAL char *tempfile1;
-GLOBAL char *tempfile2;
-GLOBAL char *digit_points; /* digitizer control points */
-GLOBAL char *digit_results; /* digitizer results */
-GLOBAL int use_digitizer INIT(0); /* is there a digitizer out there? */
-
/* group file list, target cell,vector files */
-GLOBAL char *group_list INIT(NULL);
-GLOBAL char *cell_list INIT(NULL);
-GLOBAL char *vect_list INIT(NULL);
+extern char *group_list;
+extern char *cell_list;
+extern char *vect_list;
-GLOBAL int from_keyboard INIT(-1); /* input method */
-GLOBAL int from_digitizer INIT(-1);
-GLOBAL int from_screen INIT(-1);
-GLOBAL int from_flag INIT(0);
+extern int from_keyboard; /* input method */
+extern int from_digitizer;
+extern int from_screen;
+extern int from_flag;
-GLOBAL int dotsize INIT(4);
+extern int dotsize;
+extern int THE_COLORS[10];
-GLOBAL int THE_COLORS[10];
-
#define BLACK THE_COLORS[0]
#define BLUE THE_COLORS[1]
#define BROWN THE_COLORS[2]
Modified: grass/trunk/imagery/i.points/main.c
===================================================================
--- grass/trunk/imagery/i.points/main.c 2008-10-23 14:39:30 UTC (rev 33992)
+++ grass/trunk/imagery/i.points/main.c 2008-10-23 17:02:10 UTC (rev 33993)
@@ -26,11 +26,54 @@
#include <grass/raster.h>
#include <grass/glocale.h>
-#define GLOBAL
#include "globals.h"
#include "local_proto.h"
+int SCREEN_TOP;
+int SCREEN_BOTTOM;
+int SCREEN_LEFT;
+int SCREEN_RIGHT;
+Window *INFO_WINDOW;
+Window *MENU_WINDOW;
+Window *PROMPT_WINDOW;
+
+View *VIEW_MAP1;
+View *VIEW_TITLE1;
+View *VIEW_MAP1_ZOOM;
+View *VIEW_TITLE1_ZOOM;
+
+View *VIEW_MAP2;
+View *VIEW_TITLE2;
+View *VIEW_MAP2_ZOOM;
+View *VIEW_TITLE2_ZOOM;
+
+View *VIEW_MENU;
+
+Group group;
+
+char interrupt_char;
+char *tempfile1;
+char *tempfile2;
+char *digit_points; /* digitizer control points */
+char *digit_results; /* digitizer results */
+int use_digitizer; /* is there a digitizer out there? */
+
+/* group file list, target cell,vector files */
+char *group_list;
+char *cell_list;
+char *vect_list;
+
+int from_keyboard = -1; /* input method */
+int from_digitizer = -1;
+int from_screen = -1;
+int from_flag;
+
+int dotsize = 4;
+
+int THE_COLORS[10];
+
+
#ifdef __GNUC_MINOR__
int quit(int) __attribute__ ((__noreturn__));
#else
Modified: grass/trunk/imagery/i.rectify/global.h
===================================================================
--- grass/trunk/imagery/i.rectify/global.h 2008-10-23 14:39:30 UTC (rev 33992)
+++ grass/trunk/imagery/i.rectify/global.h 2008-10-23 17:02:10 UTC (rev 33993)
@@ -9,44 +9,38 @@
#define NROWS 64
#define NCOLS 256
-/* do not modify past this point */
-
-#ifndef GLOBAL
-#define GLOBAL extern
-#endif
-
#include <grass/imagery.h>
#include "rowcol.h"
#define IDX int
-GLOBAL ROWCOL row_map[NROWS][NCOLS];
-GLOBAL ROWCOL col_map[NROWS][NCOLS];
-GLOBAL ROWCOL row_min[NROWS];
-GLOBAL ROWCOL row_max[NROWS];
-GLOBAL ROWCOL row_left[NROWS];
-GLOBAL ROWCOL row_right[NROWS];
-GLOBAL IDX row_idx[NROWS];
-GLOBAL int matrix_rows, matrix_cols;
+extern ROWCOL row_map[NROWS][NCOLS];
+extern ROWCOL col_map[NROWS][NCOLS];
+extern ROWCOL row_min[NROWS];
+extern ROWCOL row_max[NROWS];
+extern ROWCOL row_left[NROWS];
+extern ROWCOL row_right[NROWS];
+extern IDX row_idx[NROWS];
+extern int matrix_rows, matrix_cols;
-GLOBAL void **cell_buf;
-GLOBAL int temp_fd;
-GLOBAL RASTER_MAP_TYPE map_type;
-GLOBAL char *temp_name;
-GLOBAL int *ref_list;
-GLOBAL char **new_name;
-GLOBAL struct Ref ref;
+extern void **cell_buf;
+extern int temp_fd;
+extern RASTER_MAP_TYPE map_type;
+extern char *temp_name;
+extern int *ref_list;
+extern char **new_name;
+extern struct Ref ref;
/* georef coefficients */
-GLOBAL double E12[10], N12[10];
-GLOBAL double E21[10], N21[10];
+extern double E12[10], N12[10];
+extern double E21[10], N21[10];
/* DELETED WITH CRS MODIFICATIONS
- GLOBAL double E12a, E12b, E12c, N12a, N12b, N12c;
- GLOBAL double E21a, E21b, E21c, N21a, N21b, N21c;
+ extern double E12a, E12b, E12c, N12a, N12b, N12c;
+ extern double E21a, E21b, E21c, N21a, N21b, N21c;
*/
-GLOBAL struct Cell_head target_window;
+extern struct Cell_head target_window;
/* cp.c */
int get_control_points(char *, int);
Modified: grass/trunk/imagery/i.rectify/main.c
===================================================================
--- grass/trunk/imagery/i.rectify/main.c 2008-10-23 14:39:30 UTC (rev 33992)
+++ grass/trunk/imagery/i.rectify/main.c 2008-10-23 17:02:10 UTC (rev 33993)
@@ -22,13 +22,40 @@
*
*****************************************************************************/
-#define GLOBAL
#include <stdlib.h>
#include <string.h>
#include "global.h"
#include "crs.h"
#include <grass/glocale.h>
+ROWCOL row_map[NROWS][NCOLS];
+ROWCOL col_map[NROWS][NCOLS];
+ROWCOL row_min[NROWS];
+ROWCOL row_max[NROWS];
+ROWCOL row_left[NROWS];
+ROWCOL row_right[NROWS];
+IDX row_idx[NROWS];
+int matrix_rows, matrix_cols;
+
+void **cell_buf;
+int temp_fd;
+RASTER_MAP_TYPE map_type;
+char *temp_name;
+int *ref_list;
+char **new_name;
+struct Ref ref;
+
+/* georef coefficients */
+
+double E12[10], N12[10];
+double E21[10], N21[10];
+
+/* DELETED WITH CRS MODIFICATIONS
+ double E12a, E12b, E12c, N12a, N12b, N12c;
+ double E21a, E21b, E21c, N21a, N21b, N21c;
+ */
+struct Cell_head target_window;
+
#define NFILES 15
void err_exit(char *, char *);
Modified: grass/trunk/imagery/i.vpoints/globals.h
===================================================================
--- grass/trunk/imagery/i.vpoints/globals.h 2008-10-23 14:39:30 UTC (rev 33992)
+++ grass/trunk/imagery/i.vpoints/globals.h 2008-10-23 17:02:10 UTC (rev 33993)
@@ -1,58 +1,51 @@
#include <grass/colors.h>
#include "defs.h"
-#ifndef GLOBAL
-# define GLOBAL extern
-# define INIT(x)
-#else
-# define INIT(x) = x
-#endif
+extern int cellmap_present;
-GLOBAL int cellmap_present;
+extern int SCREEN_TOP;
+extern int SCREEN_BOTTOM;
+extern int SCREEN_LEFT;
+extern int SCREEN_RIGHT;
-GLOBAL int SCREEN_TOP;
-GLOBAL int SCREEN_BOTTOM;
-GLOBAL int SCREEN_LEFT;
-GLOBAL int SCREEN_RIGHT;
+extern Window *INFO_WINDOW;
+extern Window *MENU_WINDOW;
+extern Window *PROMPT_WINDOW;
-GLOBAL Window *INFO_WINDOW;
-GLOBAL Window *MENU_WINDOW;
-GLOBAL Window *PROMPT_WINDOW;
+extern View *VIEW_MAP1;
+extern View *VIEW_TITLE1;
+extern View *VIEW_MAP1_ZOOM;
+extern View *VIEW_TITLE1_ZOOM;
-GLOBAL View *VIEW_MAP1;
-GLOBAL View *VIEW_TITLE1;
-GLOBAL View *VIEW_MAP1_ZOOM;
-GLOBAL View *VIEW_TITLE1_ZOOM;
+extern View *VIEW_MAP2;
+extern View *VIEW_TITLE2;
+extern View *VIEW_MAP2_ZOOM;
+extern View *VIEW_TITLE2_ZOOM;
-GLOBAL View *VIEW_MAP2;
-GLOBAL View *VIEW_TITLE2;
-GLOBAL View *VIEW_MAP2_ZOOM;
-GLOBAL View *VIEW_TITLE2_ZOOM;
+extern View *VIEW_MENU;
-GLOBAL View *VIEW_MENU;
+extern Group group;
-GLOBAL Group group;
+extern char interrupt_char;
+extern char *tempfile1;
+extern char *tempfile2;
+extern char *digit_points; /* digitizer control points */
+extern char *digit_results; /* digitizer results */
+extern int use_digitizer; /* is there a digitizer out there? */
-GLOBAL char interrupt_char;
-GLOBAL char *tempfile1;
-GLOBAL char *tempfile2;
-GLOBAL char *digit_points; /* digitizer control points */
-GLOBAL char *digit_results; /* digitizer results */
-GLOBAL int use_digitizer INIT(0); /* is there a digitizer out there? */
-
/* group file list, target cell,vector files */
-GLOBAL char *group_list INIT(NULL);
-GLOBAL char *cell_list INIT(NULL);
-GLOBAL char *vect_list INIT(NULL);
+extern char *group_list;
+extern char *cell_list;
+extern char *vect_list;
-GLOBAL int from_keyboard INIT(-1); /* input method */
-GLOBAL int from_digitizer INIT(-1);
-GLOBAL int from_screen INIT(-1);
-GLOBAL int from_flag INIT(0);
+extern int from_keyboard; /* input method */
+extern int from_digitizer;
+extern int from_screen;
+extern int from_flag;
-GLOBAL int dotsize INIT(4);
+extern int dotsize;
-GLOBAL int line_color;
+extern int line_color;
/* analyze.c */
int delete_control_point(int);
Modified: grass/trunk/imagery/i.vpoints/main.c
===================================================================
--- grass/trunk/imagery/i.vpoints/main.c 2008-10-23 14:39:30 UTC (rev 33992)
+++ grass/trunk/imagery/i.vpoints/main.c 2008-10-23 17:02:10 UTC (rev 33993)
@@ -30,9 +30,54 @@
#include <grass/gis.h>
#include <grass/raster.h>
#include <grass/glocale.h>
-#define GLOBAL
#include "globals.h"
+int cellmap_present;
+
+int SCREEN_TOP;
+int SCREEN_BOTTOM;
+int SCREEN_LEFT;
+int SCREEN_RIGHT;
+
+Window *INFO_WINDOW;
+Window *MENU_WINDOW;
+Window *PROMPT_WINDOW;
+
+View *VIEW_MAP1;
+View *VIEW_TITLE1;
+View *VIEW_MAP1_ZOOM;
+View *VIEW_TITLE1_ZOOM;
+
+View *VIEW_MAP2;
+View *VIEW_TITLE2;
+View *VIEW_MAP2_ZOOM;
+View *VIEW_TITLE2_ZOOM;
+
+View *VIEW_MENU;
+
+Group group;
+
+char interrupt_char;
+char *tempfile1;
+char *tempfile2;
+char *digit_points; /* digitizer control points */
+char *digit_results; /* digitizer results */
+int use_digitizer; /* is there a digitizer out there? */
+
+/* group file list, target cell,vector files */
+char *group_list;
+char *cell_list;
+char *vect_list;
+
+int from_keyboard = -1; /* input method */
+int from_digitizer = -1;
+int from_screen = -1;
+int from_flag;
+
+int dotsize = 4;
+
+int line_color;
+
int main(int argc, char *argv[])
{
char name[GNAME_MAX], mapset[GMAPSET_MAX], xmapset[GMAPSET_MAX];
Deleted: grass/trunk/include/vect/dig_globs.h
===================================================================
--- grass/trunk/include/vect/dig_globs.h 2008-10-23 14:39:30 UTC (rev 33992)
+++ grass/trunk/include/vect/dig_globs.h 2008-10-23 17:02:10 UTC (rev 33993)
@@ -1,12 +0,0 @@
-#ifdef CONTROL
-#define DIG_GLOBS_GLOBAL
-#else
-#define DIG_GLOBS_GLOBAL extern
-#endif
-
-DIG_GLOBS_GLOBAL int Lines_In_Memory;
-DIG_GLOBS_GLOBAL char *Mem_Line_Ptr;
-DIG_GLOBS_GLOBAL char *Mem_curr_position;
-
-/* Added undef 2/13/1999 WB Hughes */
-#undef DIG_GLOBS_GLOBAL
Modified: grass/trunk/include/vect/digit.h
===================================================================
--- grass/trunk/include/vect/digit.h 2008-10-23 14:39:30 UTC (rev 33992)
+++ grass/trunk/include/vect/digit.h 2008-10-23 17:02:10 UTC (rev 33993)
@@ -2,4 +2,3 @@
#include "dig_macros.h" /* #define Macros */
#include "dig_structs.h" /* system structs */
#include "dig_externs.h" /* function return value definitions */
-#include "dig_globs.h"
Modified: grass/trunk/lib/vector/rtree/split_q.c
===================================================================
--- grass/trunk/lib/vector/rtree/split_q.c 2008-10-23 14:39:30 UTC (rev 33992)
+++ grass/trunk/lib/vector/rtree/split_q.c 2008-10-23 17:02:10 UTC (rev 33993)
@@ -15,21 +15,26 @@
* for details.
*****************************************************************************/
-#define SPLIT_QC
#include <stdio.h>
#include "assert.h"
#include "index.h"
#include "card.h"
#include "split_q.h"
+struct Branch BranchBuf[MAXCARD + 1];
+int BranchCount;
+struct Rect CoverSplit;
+RectReal CoverSplitArea;
+/* variables for finding a partition */
+struct PartitionVars Partitions[METHODS];
/*-----------------------------------------------------------------------------
| Load branch buffer with branches from full node plus the extra branch.
-----------------------------------------------------------------------------*/
static void RTreeGetBranches(struct Node *n, struct Branch *b)
{
- register int i;
+ int i;
assert(n);
assert(b);
@@ -118,7 +123,7 @@
static void RTreeLoadNodes(struct Node *n, struct Node *q,
struct PartitionVars *p)
{
- register int i;
+ int i;
assert(n);
assert(q);
@@ -141,7 +146,7 @@
-----------------------------------------------------------------------------*/
static void RTreeInitPVars(struct PartitionVars *p, int maxrects, int minfill)
{
- register int i;
+ int i;
assert(p);
@@ -164,7 +169,7 @@
-----------------------------------------------------------------------------*/
static void RTreePrintPVars(struct PartitionVars *p)
{
- register int i;
+ int i;
assert(p);
@@ -215,7 +220,7 @@
-----------------------------------------------------------------------------*/
static void RTreeMethodZero(struct PartitionVars *p, int minfill)
{
- register int i;
+ int i;
RectReal biggestDiff;
int group, chosen = 0, betterGroup = 0;
@@ -284,10 +289,10 @@
| Old node is one of the new ones, and one really new one is created.
| Tries more than one method for choosing a partition, uses best result.
-----------------------------------------------------------------------------*/
-extern void RTreeSplitNode(struct Node *n, struct Branch *b, struct Node **nn)
+void RTreeSplitNode(struct Node *n, struct Branch *b, struct Node **nn)
{
- register struct PartitionVars *p;
- register int level;
+ struct PartitionVars *p;
+ int level;
assert(n);
assert(b);
Modified: grass/trunk/lib/vector/rtree/split_q.h
===================================================================
--- grass/trunk/lib/vector/rtree/split_q.h 2008-10-23 14:39:30 UTC (rev 33992)
+++ grass/trunk/lib/vector/rtree/split_q.h 2008-10-23 17:02:10 UTC (rev 33993)
@@ -21,24 +21,19 @@
#define METHODS 1
-#ifdef SPLIT_QC
-#define SPLIT_Q_GLOBAL
-#else
-#define SPLIT_Q_GLOBAL extern
-#endif
-
-SPLIT_Q_GLOBAL struct Branch BranchBuf[MAXCARD + 1];
-SPLIT_Q_GLOBAL int BranchCount;
-SPLIT_Q_GLOBAL struct Rect CoverSplit;
-SPLIT_Q_GLOBAL RectReal CoverSplitArea;
-
-/* variables for finding a partition */
-SPLIT_Q_GLOBAL struct PartitionVars
-{
+struct PartitionVars {
int partition[MAXCARD + 1];
int total, minfill;
int taken[MAXCARD + 1];
int count[2];
struct Rect cover[2];
RectReal area[2];
-} Partitions[METHODS];
+};
+
+extern struct Branch BranchBuf[MAXCARD + 1];
+extern int BranchCount;
+extern struct Rect CoverSplit;
+extern RectReal CoverSplitArea;
+
+/* variables for finding a partition */
+extern struct PartitionVars Partitions[METHODS];
Modified: grass/trunk/raster/r.buffer/distance.h
===================================================================
--- grass/trunk/raster/r.buffer/distance.h 2008-10-23 14:39:30 UTC (rev 33992)
+++ grass/trunk/raster/r.buffer/distance.h 2008-10-23 17:02:10 UTC (rev 33993)
@@ -23,12 +23,6 @@
#define __DISTANCE_H__
#include <grass/gis.h>
-#ifndef GLOBAL
-#define GLOBAL extern
-#define INIT(x)
-#else
-#define INIT(x) =(x)
-#endif
struct Distance
{
@@ -45,16 +39,16 @@
* (if short is 2 bytes)
*/
-GLOBAL struct Distance *distances;
-GLOBAL int ndist;
-GLOBAL int wrap_ncols INIT(0);
-GLOBAL MAPTYPE *map;
-GLOBAL struct Cell_head window;
-GLOBAL int minrow, maxrow, mincol, maxcol;
-GLOBAL char *pgm_name;
-GLOBAL double meters_to_grid INIT(1.0);
-GLOBAL double ns_to_ew_squared;
-GLOBAL int count_rows_with_data;
+extern struct Distance *distances;
+extern int ndist;
+extern int wrap_ncols;
+extern MAPTYPE *map;
+extern struct Cell_head window;
+extern int minrow, maxrow, mincol, maxcol;
+extern char *pgm_name;
+extern double meters_to_grid;
+extern double ns_to_ew_squared;
+extern int count_rows_with_data;
#define MAPINDEX(r,c) (r * window.cols + c)
#define ZONE_INCR 2
Modified: grass/trunk/raster/r.buffer/main.c
===================================================================
--- grass/trunk/raster/r.buffer/main.c 2008-10-23 14:39:30 UTC (rev 33992)
+++ grass/trunk/raster/r.buffer/main.c 2008-10-23 17:02:10 UTC (rev 33993)
@@ -24,11 +24,21 @@
#include <stdlib.h>
#include <string.h>
-#define GLOBAL
#include "distance.h"
#include "local_proto.h"
#include <grass/glocale.h>
+struct Distance *distances;
+int ndist;
+int wrap_ncols;
+MAPTYPE *map;
+struct Cell_head window;
+int minrow, maxrow, mincol, maxcol;
+char *pgm_name;
+double meters_to_grid = 1.0;
+double ns_to_ew_squared;
+int count_rows_with_data;
+
int main(int argc, char *argv[])
{
struct Distance *pd;
Modified: grass/trunk/raster/r.coin/coin.h
===================================================================
--- grass/trunk/raster/r.coin/coin.h 2008-10-23 14:39:30 UTC (rev 33992)
+++ grass/trunk/raster/r.coin/coin.h 2008-10-23 17:02:10 UTC (rev 33993)
@@ -21,36 +21,32 @@
#include <grass/gis.h>
-#ifndef GLOBAL
-#define GLOBAL extern
-#endif
-
struct stats_table
{
long count;
double area;
};
-GLOBAL struct Cell_head window;
+extern struct Cell_head window;
-GLOBAL char *title1, *title2;
+extern char *title1, *title2;
-GLOBAL double window_cells;
-GLOBAL double window_area;
+extern double window_cells;
+extern double window_area;
-GLOBAL struct stats_table *table;
-GLOBAL long *catlist1, *catlist2;
-GLOBAL int no_data1, no_data2;
-GLOBAL int Rndex, Cndex;
-GLOBAL char *dumpname;
-GLOBAL char *statname;
-GLOBAL FILE *dumpfile;
+extern struct stats_table *table;
+extern long *catlist1, *catlist2;
+extern int no_data1, no_data2;
+extern int Rndex, Cndex;
+extern char *dumpname;
+extern char *statname;
+extern FILE *dumpfile;
-GLOBAL char map1name[GNAME_MAX], map2name[GNAME_MAX];
-GLOBAL char *mapset1, *mapset2;
-GLOBAL int ncat1, ncat2;
+extern char map1name[GNAME_MAX], map2name[GNAME_MAX];
+extern char *mapset1, *mapset2;
+extern int ncat1, ncat2;
-GLOBAL char *fill, *midline;
+extern char *fill, *midline;
/* check.c */
int check_report_size(void);
Modified: grass/trunk/raster/r.coin/main.c
===================================================================
--- grass/trunk/raster/r.coin/main.c 2008-10-23 14:39:30 UTC (rev 33992)
+++ grass/trunk/raster/r.coin/main.c 2008-10-23 17:02:10 UTC (rev 33993)
@@ -16,16 +16,33 @@
*
***************************************************************************/
-#define GLOBAL
#include <stdlib.h>
#include <unistd.h>
#include "coin.h"
+struct Cell_head window;
+char *title1, *title2;
+
+double window_cells;
+double window_area;
+
+struct stats_table *table;
+long *catlist1, *catlist2;
+int no_data1, no_data2;
+int Rndex, Cndex;
+char *dumpname;
+char *statname;
+FILE *dumpfile;
+
+char map1name[GNAME_MAX], map2name[GNAME_MAX];
+char *mapset1, *mapset2;
+int ncat1, ncat2;
+
+char *fill, *midline;
+
int main(int argc, char *argv[])
{
- double G_area_of_cell_at_row();
-
fill =
" ";
midline =
Modified: grass/trunk/raster/r.cross/glob.h
===================================================================
--- grass/trunk/raster/r.cross/glob.h 2008-10-23 14:39:30 UTC (rev 33992)
+++ grass/trunk/raster/r.cross/glob.h 2008-10-23 17:02:10 UTC (rev 33993)
@@ -29,20 +29,13 @@
#define LEFT 1
#define RIGHT 2
-#ifndef GLOBAL
-# define GLOBAL extern
-# define INIT(x)
-#else
-# define INIT(x) =(x)
-#endif
+extern int nfiles;
+extern int nrows;
+extern int ncols;
+extern int NCATS;
+extern char *names[NFILES];
+extern struct Categories labels[NFILES];
-GLOBAL int nfiles;
-GLOBAL int nrows;
-GLOBAL int ncols;
-GLOBAL int NCATS INIT(1 << SHIFT);
-GLOBAL char *names[NFILES];
-GLOBAL struct Categories labels[NFILES];
-
typedef struct
{
CELL *cat;
@@ -51,9 +44,9 @@
int right;
} NODE;
-GLOBAL NODE *tree; /* tree of values */
-GLOBAL int tlen; /* allocate tree size */
-GLOBAL int N; /* number of actual nodes in tree */
+extern NODE *tree; /* tree of values */
+extern int tlen; /* allocate tree size */
+extern int N; /* number of actual nodes in tree */
typedef struct
{
@@ -61,7 +54,7 @@
CELL result;
} RECLASS;
-GLOBAL RECLASS *reclass INIT(NULL);
-GLOBAL CELL *table INIT(NULL);
+extern RECLASS *reclass;
+extern CELL *table;
#endif /* __R_CROSS_GLOB_H__ */
Modified: grass/trunk/raster/r.cross/main.c
===================================================================
--- grass/trunk/raster/r.cross/main.c 2008-10-23 14:39:30 UTC (rev 33992)
+++ grass/trunk/raster/r.cross/main.c 2008-10-23 17:02:10 UTC (rev 33993)
@@ -16,7 +16,6 @@
*
***************************************************************************/
-#define GLOBAL
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -24,6 +23,18 @@
#include "local_proto.h"
#include <grass/glocale.h>
+int nfiles;
+int nrows;
+int ncols;
+int NCATS = 1 << SHIFT;
+char *names[NFILES];
+struct Categories labels[NFILES];
+NODE *tree; /* tree of values */
+int tlen; /* allocate tree size */
+int N; /* number of actual nodes in tree */
+RECLASS *reclass;
+CELL *table;
+
static int cmp(const void *, const void *);
Modified: grass/trunk/raster/r.kappa/kappa.h
===================================================================
--- grass/trunk/raster/r.kappa/kappa.h 2008-10-23 14:39:30 UTC (rev 33992)
+++ grass/trunk/raster/r.kappa/kappa.h 2008-10-23 17:02:10 UTC (rev 33993)
@@ -1,36 +1,34 @@
-#ifndef GLOBAL
-# define GLOBAL extern
-# define INIT(x)
-#else
-# define INIT(x)=x
-#endif
#include <grass/gis.h>
#include <math.h>
-GLOBAL struct Cell_head window;
+struct _gstats_
+{
+ long *cats;
+ long count;
+};
-GLOBAL char *maps[2];
-GLOBAL char *output;
-GLOBAL char *title;
-GLOBAL long *matr;
-GLOBAL long *rlst;
-GLOBAL int ncat;
-GLOBAL char *stats_file;
-
-#define LAYER struct _layer_
-GLOBAL LAYER
+struct _layer_
{
char *name;
char *mapset;
struct Categories labels;
-} *layers INIT(NULL);
-GLOBAL int nlayers INIT(0);
+};
+extern struct Cell_head window;
+
+extern char *maps[2];
+extern char *output;
+extern char *title;
+extern long *matr;
+extern long *rlst;
+extern int ncat;
+extern char *stats_file;
+
+#define LAYER struct _layer_
+extern LAYER *layers;
+extern int nlayers;
+
#define GSTATS struct _gstats_
-GLOBAL GSTATS
-{
- long *cats;
- long count;
-} *Gstats INIT(NULL);
-GLOBAL size_t nstats INIT(0);
+extern GSTATS *Gstats;
+extern size_t nstats;
Modified: grass/trunk/raster/r.kappa/main.c
===================================================================
--- grass/trunk/raster/r.kappa/main.c 2008-10-23 14:39:30 UTC (rev 33992)
+++ grass/trunk/raster/r.kappa/main.c 2008-10-23 17:02:10 UTC (rev 33993)
@@ -26,9 +26,24 @@
#include <grass/gis.h>
#include <grass/glocale.h>
#include "local_proto.h"
-#define GLOBAL
#include "kappa.h"
+struct Cell_head window;
+
+char *maps[2];
+char *output;
+char *title;
+long *matr;
+long *rlst;
+int ncat;
+char *stats_file;
+
+LAYER *layers;
+int nlayers;
+
+GSTATS *Gstats;
+size_t nstats;
+
/* function prototypes */
static void layer(char *s);
Modified: grass/trunk/raster/r.report/global.h
===================================================================
--- grass/trunk/raster/r.report/global.h 2008-10-23 14:39:30 UTC (rev 33992)
+++ grass/trunk/raster/r.report/global.h 2008-10-23 17:02:10 UTC (rev 33993)
@@ -8,31 +8,32 @@
#include <grass/gis.h>
#include <grass/glocale.h>
-GLOBAL struct Cell_head window;
+extern struct Cell_head window;
-#define LAYER struct _layer_
-GLOBAL LAYER
+struct _layer_
{
char *name;
char *mapset;
struct Categories labels;
int nlen; /* num chars of largest cat when printed */
int clen; /* num chars for cat label when printed */
-} *layers INIT(NULL);
-GLOBAL int nlayers INIT(0);
+};
+#define LAYER struct _layer_
+extern LAYER *layers;
+extern int nlayers;
-#define GSTATS struct _gstats_
-GLOBAL GSTATS
+struct _gstats_
{
CELL *cats;
double area;
long count;
-} *Gstats INIT(NULL);
-GLOBAL int nstats INIT(0);
+};
+#define GSTATS struct _gstats_
+extern GSTATS *Gstats;
+extern int nstats;
#define MAX_UNITS 10
-#define UNITS struct _units_
-GLOBAL UNITS
+struct _units_
{
double factor;
int type;
@@ -40,34 +41,40 @@
int dp;
int eformat;
char *label[2];
-} unit[MAX_UNITS];
-GLOBAL int nunits INIT(0);
+};
+#define UNITS struct _units_
+extern UNITS unit[MAX_UNITS];
+extern int nunits;
#define DEFAULT_PAGE_LENGTH 0
#define DEFAULT_PAGE_WIDTH 79
-GLOBAL int page_width INIT(DEFAULT_PAGE_WIDTH);
-GLOBAL int page_length INIT(DEFAULT_PAGE_LENGTH);
-GLOBAL int masking INIT(1);
-GLOBAL int use_formfeed INIT(0);
-GLOBAL int nlines INIT(0);
-GLOBAL int with_headers INIT(1);
-GLOBAL int verbose INIT(1);
-GLOBAL int e_format INIT(0);
-GLOBAL int no_nulls INIT(0);
-GLOBAL int no_nulls_all INIT(0);
-GLOBAL char *stats_file;
-GLOBAL char *no_data_str;
-GLOBAL int stats_flag INIT(0);
-GLOBAL int nsteps, cat_ranges, as_int;
-GLOBAL int *is_fp INIT(NULL);
-GLOBAL DCELL *DMAX INIT(NULL), *DMIN INIT(NULL);
+extern int page_width;
+extern int page_length;
+extern int masking;
+extern int use_formfeed;
+extern int nlines;
+extern int with_headers;
+extern int verbose;
+extern int e_format;
+extern int no_nulls;
+extern int no_nulls_all;
-GLOBAL int maskfd;
-GLOBAL CELL *mask;
-GLOBAL CELL NULL_CELL;
-GLOBAL int (*get_row) ();
+extern char *stats_file;
+extern char *no_data_str;
+extern int stats_flag;
+extern int nsteps, cat_ranges, as_int;
+extern int *is_fp;
+extern DCELL *DMAX, *DMIN;
+extern int maskfd;
+extern CELL *mask;
+extern CELL NULL_CELL;
+extern int (*get_row)();
+
+extern char fs[2];
+extern struct Categories *labels;
+
/* format.c */
int format_parms(double, int *, int *, int *, int);
int scient_format(double, char *, int, int);
@@ -114,9 +121,6 @@
long count_sum(int *, int);
int same_cats(int, int, int);
-GLOBAL char fs[2];
-GLOBAL struct Categories *labels INIT(NULL);
-
#define EVERYTHING 0
#define REPORT_ONLY 1
#define STATS_ONLY 2
Modified: grass/trunk/raster/r.report/main.c
===================================================================
--- grass/trunk/raster/r.report/main.c 2008-10-23 14:39:30 UTC (rev 33992)
+++ grass/trunk/raster/r.report/main.c 2008-10-23 17:02:10 UTC (rev 33993)
@@ -13,10 +13,47 @@
* for details.
*
*****************************************************************************/
-#define GLOBAL
+
#include <stdlib.h>
#include "global.h"
+struct Cell_head window;
+
+LAYER *layers;
+int nlayers;
+
+GSTATS *Gstats;
+int nstats;
+
+UNITS unit[MAX_UNITS];
+int nunits;
+
+int page_width = DEFAULT_PAGE_WIDTH;
+int page_length = DEFAULT_PAGE_LENGTH;
+int masking = 1;
+int use_formfeed;
+int nlines;
+int with_headers = 1;
+int verbose = 1;
+int e_format;
+int no_nulls;
+int no_nulls_all;
+
+char *stats_file;
+char *no_data_str;
+int stats_flag;
+int nsteps, cat_ranges, as_int;
+int *is_fp;
+DCELL *DMAX, *DMIN;
+
+int maskfd;
+CELL *mask;
+CELL NULL_CELL;
+int (*get_row)();
+
+char fs[2];
+struct Categories *labels;
+
int main(int argc, char *argv[])
{
struct GModule *module;
Modified: grass/trunk/raster/r.stats/global.h
===================================================================
--- grass/trunk/raster/r.stats/global.h 2008-10-23 14:39:30 UTC (rev 33992)
+++ grass/trunk/raster/r.stats/global.h 2008-10-23 17:02:10 UTC (rev 33993)
@@ -1,26 +1,19 @@
#include <grass/gis.h>
-#ifndef GLOBAL
-# define GLOBAL extern
-# define INIT(x)
-#else
-# define INIT(x) =(x)
-#endif
+extern char *no_data_str;
+extern int nfiles;
+extern int nrows;
+extern int ncols, no_nulls, no_nulls_all;
+extern int nsteps, cat_ranges, raw_output, as_int, averaged;
+extern int *is_fp;
+extern DCELL *DMAX, *DMIN;
-GLOBAL char *no_data_str;
-GLOBAL int nfiles;
-GLOBAL int nrows;
-GLOBAL int ncols, no_nulls INIT(0), no_nulls_all INIT(0);
-GLOBAL int nsteps, cat_ranges, raw_output, as_int, averaged;
-GLOBAL int *is_fp INIT(NULL);
-GLOBAL DCELL *DMAX INIT(NULL), *DMIN INIT(NULL);
+extern CELL NULL_CELL;
+extern int (*get_row) ();
-GLOBAL CELL NULL_CELL;
-GLOBAL int (*get_row) ();
+extern char fs[2];
+extern struct Categories *labels;
-GLOBAL char fs[2];
-GLOBAL struct Categories *labels INIT(NULL);
-
/* cell_stats.c */
int cell_stats(int[], int, int, int, int, char *);
Modified: grass/trunk/raster/r.stats/main.c
===================================================================
--- grass/trunk/raster/r.stats/main.c 2008-10-23 14:39:30 UTC (rev 33992)
+++ grass/trunk/raster/r.stats/main.c 2008-10-23 17:02:10 UTC (rev 33993)
@@ -16,7 +16,6 @@
* for details.
*
*****************************************************************************/
-#define GLOBAL
#include <stdlib.h>
#include <string.h>
@@ -26,6 +25,20 @@
#include "global.h"
+char *no_data_str;
+int nfiles;
+int nrows;
+int ncols, no_nulls, no_nulls_all;
+int nsteps, cat_ranges, raw_output, as_int, averaged;
+int *is_fp;
+DCELL *DMAX, *DMIN;
+
+CELL NULL_CELL;
+int (*get_row) ();
+
+char fs[2];
+struct Categories *labels;
+
int main(int argc, char *argv[])
{
int *fd;
More information about the grass-commit
mailing list