[GRASS-SVN] r37674 - grass/branches/releasebranch_6_4/include/vect

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jun 1 02:27:06 EDT 2009


Author: neteler
Date: 2009-06-01 02:27:05 -0400 (Mon, 01 Jun 2009)
New Revision: 37674

Modified:
   grass/branches/releasebranch_6_4/include/vect/dig_defines.h
   grass/branches/releasebranch_6_4/include/vect/dig_externs.h
   grass/branches/releasebranch_6_4/include/vect/dig_structs.h
Log:
backport of r37670: Add structure tags for all structure types; Replace #define with typedef; Use structure tags in preference to typedefs

Modified: grass/branches/releasebranch_6_4/include/vect/dig_defines.h
===================================================================
--- grass/branches/releasebranch_6_4/include/vect/dig_defines.h	2009-06-01 06:26:33 UTC (rev 37673)
+++ grass/branches/releasebranch_6_4/include/vect/dig_defines.h	2009-06-01 06:27:05 UTC (rev 37674)
@@ -162,12 +162,13 @@
 #define GV_ON_AND     "AND"	/* intersect */
 #define GV_ON_OVERLAP "OVERLAP"
 
-typedef enum
+enum overlay_operator
 {
     GV_O_AND,
     GV_O_OVERLAP
-} OVERLAY_OPERATOR;
+};
 
+typedef enum overlay_operator OVERLAY_OPERATOR;
 
 #define ESC	033
 

Modified: grass/branches/releasebranch_6_4/include/vect/dig_externs.h
===================================================================
--- grass/branches/releasebranch_6_4/include/vect/dig_externs.h	2009-06-01 06:26:33 UTC (rev 37673)
+++ grass/branches/releasebranch_6_4/include/vect/dig_externs.h	2009-06-01 06:27:05 UTC (rev 37674)
@@ -15,7 +15,7 @@
 int dig_line_degenerate(struct line_pnts *);
 char *dig_float_point(char *, int, double);
 
-/* double dig_point_in_area (struct Map_info *, double, double, P_AREA *); */
+/* double dig_point_in_area (struct Map_info *, double, double, struct P_area *); */
 double dig_x_intersect(double, double, double, double, double);
 double dig_distance2_point_to_line(double, double, double, double, double,
 				   double, double, double, double, int,
@@ -48,22 +48,21 @@
 int dig__write_head(struct Map_info *);
 int dig__read_head(struct Map_info *);
 
-int dig__fread_port_D(double *, int, GVFILE *);
-int dig__fread_port_F(float *, int, GVFILE *);
-int dig__fread_port_L(long *, int, GVFILE *);
-int dig__fread_port_S(short *, int, GVFILE *);
-int dig__fread_port_I(int *, int, GVFILE *);
-int dig__fread_port_P(plus_t *, int, GVFILE *);
-int dig__fread_port_C(char *, int, GVFILE *);
-int dig__fwrite_port_D(double *, int, GVFILE *);
-int dig__fwrite_port_F(float *, int, GVFILE *);
-int dig__fwrite_port_L(long *, int, GVFILE *);
-int dig__fwrite_port_S(short *, int, GVFILE *);
-int dig__fwrite_port_I(int *, int, GVFILE *);
-int dig__fwrite_port_P(plus_t *, int, GVFILE *);
-int dig__fwrite_port_C(char *, int, GVFILE *);
+int dig__fread_port_D(double *, int, struct gvfile *);
+int dig__fread_port_F(float *, int, struct gvfile *);
+int dig__fread_port_L(long *, int, struct gvfile *);
+int dig__fread_port_S(short *, int, struct gvfile *);
+int dig__fread_port_I(int *, int, struct gvfile *);
+int dig__fread_port_P(plus_t *, int, struct gvfile *);
+int dig__fread_port_C(char *, int, struct gvfile *);
+int dig__fwrite_port_D(double *, int, struct gvfile *);
+int dig__fwrite_port_F(float *, int, struct gvfile *);
+int dig__fwrite_port_L(long *, int, struct gvfile *);
+int dig__fwrite_port_S(short *, int, struct gvfile *);
+int dig__fwrite_port_I(int *, int, struct gvfile *);
+int dig__fwrite_port_P(plus_t *, int, struct gvfile *);
+int dig__fwrite_port_C(char *, int, struct gvfile *);
 
-
 /******************************************************************************/
 int dig_build_area_with_line(struct Plus_head *, plus_t, int, plus_t **);
 plus_t dig_line_get_area(struct Plus_head *, plus_t, int);
@@ -74,31 +73,31 @@
 int dig_del_area(struct Plus_head *, int);
 int dig_angle_next_line(struct Plus_head *, plus_t, int, int);
 
-/* int dig_area_bound_box (struct Map_info *, P_AREA *); */
+/* int dig_area_bound_box (struct Map_info *, struct P_area *); */
 int dig_bound_box2(struct line_pnts *, double *, double *, double *, double *,
 		   long);
-int dig_box_copy(BOUND_BOX *, BOUND_BOX *);
-int dig_box_extend(BOUND_BOX *, BOUND_BOX *);
-int dig_line_box(struct line_pnts *, BOUND_BOX *);
-int dig_line_set_box(struct Plus_head *, plus_t, BOUND_BOX *);
-int dig_line_get_box(struct Plus_head *, plus_t, BOUND_BOX *);
-int dig_area_set_box(struct Plus_head *, plus_t, BOUND_BOX *);
-int dig_area_get_box(struct Plus_head *, plus_t, BOUND_BOX *);
-int dig_isle_set_box(struct Plus_head *, plus_t, BOUND_BOX *);
-int dig_isle_get_box(struct Plus_head *, plus_t, BOUND_BOX *);
+int dig_box_copy(struct bound_box *, struct bound_box *);
+int dig_box_extend(struct bound_box *, struct bound_box *);
+int dig_line_box(struct line_pnts *, struct bound_box *);
+int dig_line_set_box(struct Plus_head *, plus_t, struct bound_box *);
+int dig_line_get_box(struct Plus_head *, plus_t, struct bound_box *);
+int dig_area_set_box(struct Plus_head *, plus_t, struct bound_box *);
+int dig_area_get_box(struct Plus_head *, plus_t, struct bound_box *);
+int dig_isle_set_box(struct Plus_head *, plus_t, struct bound_box *);
+int dig_isle_get_box(struct Plus_head *, plus_t, struct bound_box *);
 
 int dig_is_line_degenerate(struct line_pnts *, double);
 
 /* int dig_check_nodes (struct Map_info *, struct new_node *, struct line_pnts *);
-   int dig_in_area_bbox (P_AREA *, double, double); */
+   int dig_in_area_bbox (struct P_area *, double, double); */
 int dig_start_clock(long *);
 int dig_stop_clock(long *);
 char *dig_stop_clock_str(long *);
-int dig_write_file_checks(GVFILE *, struct Plus_head *);
+int dig_write_file_checks(struct gvfile *, struct Plus_head *);
 int dig_do_file_checks(struct Map_info *, char *, char *);
 
-/* int dig_find_area (struct Map_info *, P_AREA *, double *, double *, double *, double);
-   int dig_find_area2 (struct Map_info *, P_AREA *, double *); */
+/* int dig_find_area (struct Map_info *, struct P_area *, double *, double *, double *, double);
+   int dig_find_area2 (struct Map_info *, struct P_area *, double *); */
 int dig_find_area_poly(struct line_pnts *, double *);
 int dig_get_poly_points(int, struct line_pnts **, int *, struct line_pnts *);
 int dig_add_isle(struct Plus_head *, int, plus_t *);
@@ -115,7 +114,7 @@
 void dig_free_plus_areas(struct Plus_head *);
 void dig_free_plus_isles(struct Plus_head *);
 void dig_free_plus(struct Plus_head *);
-int dig_load_plus(struct Plus_head *, GVFILE *, int);
+int dig_load_plus(struct Plus_head *, struct gvfile *, int);
 int dig_map_to_head(struct Map_info *, struct Plus_head *);
 int dig_head_to_map(struct Plus_head *, struct Map_info *);
 int dig_spindex_init(struct Plus_head *);
@@ -152,19 +151,19 @@
 /* spatial index */
 
 int dig_spidx_add_node(struct Plus_head *, int, double, double, double);
-int dig_spidx_add_line(struct Plus_head *, int, BOUND_BOX *);
-int dig_spidx_add_area(struct Plus_head *, int, BOUND_BOX *);
-int dig_spidx_add_isle(struct Plus_head *, int, BOUND_BOX *);
+int dig_spidx_add_line(struct Plus_head *, int, struct bound_box *);
+int dig_spidx_add_area(struct Plus_head *, int, struct bound_box *);
+int dig_spidx_add_isle(struct Plus_head *, int, struct bound_box *);
 
 int dig_spidx_del_node(struct Plus_head *, int);
 int dig_spidx_del_line(struct Plus_head *, int);
 int dig_spidx_del_area(struct Plus_head *, int);
 int dig_spidx_del_isle(struct Plus_head *, int);
 
-int dig_select_nodes(struct Plus_head *, BOUND_BOX *, struct ilist *);
-int dig_select_lines(struct Plus_head *, BOUND_BOX *, struct ilist *);
-int dig_select_areas(struct Plus_head *, BOUND_BOX *, struct ilist *);
-int dig_select_isles(struct Plus_head *, BOUND_BOX *, struct ilist *);
+int dig_select_nodes(struct Plus_head *, struct bound_box *, struct ilist *);
+int dig_select_lines(struct Plus_head *, struct bound_box *, struct ilist *);
+int dig_select_areas(struct Plus_head *, struct bound_box *, struct ilist *);
+int dig_select_isles(struct Plus_head *, struct bound_box *, struct ilist *);
 int dig_find_node(struct Plus_head *, double, double, double);
 
 int dig_spidx_init(struct Plus_head *);
@@ -173,9 +172,9 @@
 void dig_spidx_free_areas(struct Plus_head *);
 void dig_spidx_free_isles(struct Plus_head *);
 void dig_spidx_free(struct Plus_head *);
-int dig_write_spidx(GVFILE *, struct Plus_head *);
+int dig_write_spidx(struct gvfile *, struct Plus_head *);
 int dig_dump_spidx(FILE *, struct Plus_head *);
-int dig_read_spidx(GVFILE *, struct Plus_head *);
+int dig_read_spidx(struct gvfile *, struct Plus_head *);
 
 /* category index */
 int dig_cidx_init(struct Plus_head *);
@@ -185,65 +184,65 @@
 int dig_cidx_del_cat(struct Plus_head *, int, int, int, int);
 void dig_cidx_sort(struct Plus_head *);
 
-int dig_write_cidx_head(GVFILE *, struct Plus_head *);
-int dig_read_cidx_head(GVFILE *, struct Plus_head *);
-int dig_write_cidx(GVFILE *, struct Plus_head *);
-int dig_read_cidx(GVFILE *, struct Plus_head *, int);
+int dig_write_cidx_head(struct gvfile *, struct Plus_head *);
+int dig_read_cidx_head(struct gvfile *, struct Plus_head *);
+int dig_write_cidx(struct gvfile *, struct Plus_head *);
+int dig_read_cidx(struct gvfile *, struct Plus_head *, int);
 
-/* int dig_in_line_bbox (P_LINE *, double, double); */
+/* int dig_in_line_bbox (struct P_line *, double, double); */
 int dig_check_dist(struct Map_info *, int, double, double, double *);
 int dig__check_dist(struct Map_info *, struct line_pnts *, double, double,
 		    double *);
-/* int dig_center_check (P_LINE *, int, int, double, double); */
+/* int dig_center_check (struct P_line *, int, int, double, double); */
 int dig_point_by_line(struct Map_info *, double, double, double, double,
 		      char);
-/* int dig_by_line_bbox (P_LINE *, double, double, double, double); */
+/* int dig_by_line_bbox (struct P_line *, double, double, double, double); */
 int dig_prune(struct line_pnts *, double);
 int dig_write_head_ascii(FILE *, struct dig_head *);
 int dig_read_head_ascii(FILE *, struct dig_head *);
 int dig_write_frmt_ascii(FILE *, struct Format_info *, int);
 int dig_read_frmt_ascii(FILE *, struct Format_info *);
-int dig_node_alloc_line(P_NODE *, int add);
+int dig_node_alloc_line(struct P_node *, int add);
 int dig_alloc_nodes(struct Plus_head *, int);
 int dig_alloc_lines(struct Plus_head *, int);
 int dig_alloc_areas(struct Plus_head *, int);
 int dig_alloc_isles(struct Plus_head *, int);
-P_NODE *dig_alloc_node();
-P_LINE *dig_alloc_line();
-P_AREA *dig_alloc_area();
-P_ISLE *dig_alloc_isle();
+struct P_node *dig_alloc_node();
+struct P_line *dig_alloc_line();
+struct P_area *dig_alloc_area();
+struct P_isle *dig_alloc_isle();
 int dig_alloc_points(struct line_pnts *, int);
 int dig_alloc_cats(struct line_cats *, int);
-int dig_area_alloc_line(P_AREA *, int);
-int dig_area_alloc_isle(P_AREA *, int);
-int dig_isle_alloc_line(P_ISLE *, int);
+int dig_area_alloc_line(struct P_area *, int);
+int dig_area_alloc_isle(struct P_area *, int);
+int dig_isle_alloc_line(struct P_isle *, int);
 int dig_out_of_memory(void);
 int dig_struct_copy(void *, void *, int);
 int dig_rmcr(char *);
-int dig_write_plus_file(GVFILE *, struct Plus_head *);
-int dig_write_nodes(GVFILE *, struct Plus_head *);
-int dig_write_lines(GVFILE *, struct Plus_head *);
-int dig_write_areas(GVFILE *, struct Plus_head *);
-int dig_write_isles(GVFILE *, struct Plus_head *);
+int dig_write_plus_file(struct gvfile *, struct Plus_head *);
+int dig_write_nodes(struct gvfile *, struct Plus_head *);
+int dig_write_lines(struct gvfile *, struct Plus_head *);
+int dig_write_areas(struct gvfile *, struct Plus_head *);
+int dig_write_isles(struct gvfile *, struct Plus_head *);
 
-int dig_Rd_P_node(struct Plus_head *, int i, GVFILE *);
-int dig_Wr_P_node(struct Plus_head *, int i, GVFILE *);
-int dig_Rd_P_line(struct Plus_head *, int i, GVFILE *);
-int dig_Wr_P_line(struct Plus_head *, int i, GVFILE *);
-int dig_Rd_P_area(struct Plus_head *, int i, GVFILE *);
-int dig_Wr_P_area(struct Plus_head *, int i, GVFILE *);
-int dig_Rd_P_isle(struct Plus_head *, int i, GVFILE *);
-int dig_Wr_P_isle(struct Plus_head *, int i, GVFILE *);
-int dig_Rd_Plus_head(GVFILE *, struct Plus_head *);
-int dig_Wr_Plus_head(GVFILE *, struct Plus_head *);
+int dig_Rd_P_node(struct Plus_head *, int i, struct gvfile *);
+int dig_Wr_P_node(struct Plus_head *, int i, struct gvfile *);
+int dig_Rd_P_line(struct Plus_head *, int i, struct gvfile *);
+int dig_Wr_P_line(struct Plus_head *, int i, struct gvfile *);
+int dig_Rd_P_area(struct Plus_head *, int i, struct gvfile *);
+int dig_Wr_P_area(struct Plus_head *, int i, struct gvfile *);
+int dig_Rd_P_isle(struct Plus_head *, int i, struct gvfile *);
+int dig_Wr_P_isle(struct Plus_head *, int i, struct gvfile *);
+int dig_Rd_Plus_head(struct gvfile *, struct Plus_head *);
+int dig_Wr_Plus_head(struct gvfile *, struct Plus_head *);
 
 /* file loaded to memory */
-long dig_ftell(GVFILE * file);
-int dig_fseek(GVFILE * file, long offset, int whence);
-void dig_rewind(GVFILE * file);
-int dig_fflush(GVFILE * file);
-size_t dig_fread(void *ptr, size_t size, size_t nmemb, GVFILE * file);
-size_t dig_fwrite(void *ptr, size_t size, size_t nmemb, GVFILE * file);
-void dig_file_init(GVFILE * file);
-int dig_file_load(GVFILE * file);
-void dig_file_free(GVFILE * file);
+long dig_ftell(struct gvfile * file);
+int dig_fseek(struct gvfile * file, long offset, int whence);
+void dig_rewind(struct gvfile * file);
+int dig_fflush(struct gvfile * file);
+size_t dig_fread(void *ptr, size_t size, size_t nmemb, struct gvfile * file);
+size_t dig_fwrite(void *ptr, ssize_t size, size_t nmemb, struct gvfile * file);
+void dig_file_init(struct gvfile * file);
+int dig_file_load(struct gvfile * file);
+void dig_file_free(struct gvfile * file);

Modified: grass/branches/releasebranch_6_4/include/vect/dig_structs.h
===================================================================
--- grass/branches/releasebranch_6_4/include/vect/dig_structs.h	2009-06-01 06:26:33 UTC (rev 37673)
+++ grass/branches/releasebranch_6_4/include/vect/dig_structs.h	2009-06-01 06:27:05 UTC (rev 37674)
@@ -35,21 +35,23 @@
  */
 typedef int plus_t;
 
-#define BOUND_BOX struct bound_box
+typedef struct bound_box BOUND_BOX;
 
-#define P_NODE struct P_node
-#define P_AREA struct P_area
-#define P_LINE struct P_line
-#define P_ISLE struct P_isle
+typedef struct P_node P_NODE;
+typedef struct P_area P_AREA;
+typedef struct P_line P_LINE;
+typedef struct P_isle P_ISLE;
 
 /* Used by sites lib */
-typedef struct
+struct site_att
 {
     int cat;			/* category */
     double *dbl;		/* double attributes */
     char **str;			/* string attributes */
-} SITE_ATT;
+};
 
+typedef struct site_att SITE_ATT;
+
 struct bound_box		/* Bounding Box */
 {
     double N;			/* north */
@@ -60,7 +62,7 @@
     double B;			/* bottom */
 };
 
-typedef struct
+struct gvfile
 {
     FILE *file;
     char *start;		/* pointer to beginnig of the file in the memory */
@@ -69,8 +71,10 @@
     long size;			/* size of the file loaded to memory */
     long alloc;			/* allocated space */
     int loaded;			/* 0 - not loaded, 1 - loaded */
-} GVFILE;
+};
 
+typedef struct gvfile GVFILE;
+
 /* category field information */
 struct field_info
 {
@@ -526,18 +530,22 @@
 };
 
 /* Vector array. Space allocated is size + 1. */
-typedef struct
+struct varray
 {
     int size;			/* array size */
     int *c;			/* array where 'class' or new category or something like that is stored */
-} VARRAY;
+};
 
+typedef struct varray VARRAY;
+
 /* Spatial index for use in modules. */
-typedef struct
+struct spatial_index
 {
     struct Node *root;
-} SPATIAL_INDEX;
+};
 
+typedef struct spatial_index SPATIAL_INDEX;
+
 typedef dglGraph_s GRAPH;	/* graph structure */
 
 #endif /* DIG___STRUCTS___ */



More information about the grass-commit mailing list