[GRASS-SVN] r37670 - grass/trunk/include/vect
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Jun 1 01:27:36 EDT 2009
Author: glynn
Date: 2009-06-01 01:27:36 -0400 (Mon, 01 Jun 2009)
New Revision: 37670
Modified:
grass/trunk/include/vect/dig_defines.h
grass/trunk/include/vect/dig_externs.h
grass/trunk/include/vect/dig_structs.h
Log:
Add structure tags for all structure types
Replace #define with typedef
Use structure tags in preference to typedefs
Modified: grass/trunk/include/vect/dig_defines.h
===================================================================
--- grass/trunk/include/vect/dig_defines.h 2009-06-01 05:24:58 UTC (rev 37669)
+++ grass/trunk/include/vect/dig_defines.h 2009-06-01 05:27:36 UTC (rev 37670)
@@ -163,12 +163,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/trunk/include/vect/dig_externs.h
===================================================================
--- grass/trunk/include/vect/dig_externs.h 2009-06-01 05:24:58 UTC (rev 37669)
+++ grass/trunk/include/vect/dig_externs.h 2009-06-01 05:27:36 UTC (rev 37670)
@@ -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,22 @@
int dig__write_head(struct Map_info *);
int dig__read_head(struct Map_info *);
-int dig__fread_port_D(double *, size_t, GVFILE *);
-int dig__fread_port_F(float *, size_t, GVFILE *);
-int dig__fread_port_O(off_t *, size_t, GVFILE *, size_t);
-int dig__fread_port_L(long *, size_t, GVFILE *);
-int dig__fread_port_S(short *, size_t, GVFILE *);
-int dig__fread_port_I(int *, size_t, GVFILE *);
-int dig__fread_port_P(plus_t *, size_t, GVFILE *);
-int dig__fread_port_C(char *, size_t, GVFILE *);
-int dig__fwrite_port_D(const double *, size_t, GVFILE *);
-int dig__fwrite_port_F(const float *, size_t, GVFILE *);
-int dig__fwrite_port_O(const off_t *, size_t, GVFILE *, size_t);
-int dig__fwrite_port_L(const long *, size_t, GVFILE *);
-int dig__fwrite_port_S(const short *, size_t, GVFILE *);
-int dig__fwrite_port_I(const int *, size_t, GVFILE *);
-int dig__fwrite_port_P(const plus_t *, size_t, GVFILE *);
-int dig__fwrite_port_C(const char *, size_t, GVFILE *);
+int dig__fread_port_D(double *, size_t, struct gvfile *);
+int dig__fread_port_F(float *, size_t, struct gvfile *);
+int dig__fread_port_O(off_t *, size_t, struct gvfile *, size_t);
+int dig__fread_port_L(long *, size_t, struct gvfile *);
+int dig__fread_port_S(short *, size_t, struct gvfile *);
+int dig__fread_port_I(int *, size_t, struct gvfile *);
+int dig__fread_port_P(plus_t *, size_t, struct gvfile *);
+int dig__fread_port_C(char *, size_t, struct gvfile *);
+int dig__fwrite_port_D(const double *, size_t, struct gvfile *);
+int dig__fwrite_port_F(const float *, size_t, struct gvfile *);
+int dig__fwrite_port_O(const off_t *, size_t, struct gvfile *, size_t);
+int dig__fwrite_port_L(const long *, size_t, struct gvfile *);
+int dig__fwrite_port_S(const short *, size_t, struct gvfile *);
+int dig__fwrite_port_I(const int *, size_t, struct gvfile *);
+int dig__fwrite_port_P(const plus_t *, size_t, struct gvfile *);
+int dig__fwrite_port_C(const char *, size_t, struct gvfile *);
/******************************************************************************/
@@ -76,31 +76,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(const 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(const 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 *);
double dig_find_poly_orientation(struct line_pnts *);
int dig_get_poly_points(int, struct line_pnts **, int *, struct line_pnts *);
@@ -118,7 +118,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 *);
@@ -155,19 +155,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 *, const BOUND_BOX *, struct ilist *);
-int dig_select_lines(struct Plus_head *, const BOUND_BOX *, struct ilist *);
-int dig_select_areas(struct Plus_head *, const BOUND_BOX *, struct ilist *);
-int dig_select_isles(struct Plus_head *, const BOUND_BOX *, struct ilist *);
+int dig_select_nodes(struct Plus_head *, const struct bound_box *, struct ilist *);
+int dig_select_lines(struct Plus_head *, const struct bound_box *, struct ilist *);
+int dig_select_areas(struct Plus_head *, const struct bound_box *, struct ilist *);
+int dig_select_isles(struct Plus_head *, const struct bound_box *, struct ilist *);
int dig_find_node(struct Plus_head *, double, double, double);
int dig_spidx_init(struct Plus_head *);
@@ -176,9 +176,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 *, const 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 *);
@@ -188,69 +188,69 @@
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();
-void dig_free_node(P_NODE *);
-void dig_free_line(P_LINE *);
-void dig_free_area(P_AREA *);
-void dig_free_isle(P_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();
+void dig_free_node(struct P_node *);
+void dig_free_line(struct P_line *);
+void dig_free_area(struct P_area *);
+void dig_free_isle(struct P_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 */
-off_t dig_ftell(GVFILE * file);
-int dig_fseek(GVFILE * file, off_t 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(const 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);
+off_t dig_ftell(struct gvfile * file);
+int dig_fseek(struct gvfile * file, off_t 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(const void *ptr, size_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/trunk/include/vect/dig_structs.h
===================================================================
--- grass/trunk/include/vect/dig_structs.h 2009-06-01 05:24:58 UTC (rev 37669)
+++ grass/trunk/include/vect/dig_structs.h 2009-06-01 05:27:36 UTC (rev 37670)
@@ -37,21 +37,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 */
@@ -62,7 +64,7 @@
double B; /* bottom */
};
-typedef struct
+struct gvfile
{
FILE *file;
char *start; /* pointer to beginnig of the file in the memory */
@@ -71,8 +73,10 @@
off_t size; /* size of the file loaded to memory */
off_t alloc; /* allocated space */
int loaded; /* 0 - not loaded, 1 - loaded */
-} GVFILE;
+};
+typedef struct gvfile GVFILE;
+
/* category field information */
struct field_info
{
@@ -532,18 +536,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