浏览代码

vectorlib:
* eliminate 'typedef struct'
* GRASS_VECT renamed to GV_


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@38552 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 15 年之前
父节点
当前提交
b06b8a0105
共有 100 个文件被更改,包括 1185 次插入1053 次删除
  1. 1 1
      display/d.extract/extract.c
  2. 1 1
      display/d.thematic.area/area.c
  3. 1 1
      display/d.thematic.area/main.c
  4. 2 2
      display/d.vect/area.c
  5. 1 1
      display/d.vect/main.c
  6. 1 1
      display/d.vect/plot1.c
  7. 1 1
      display/d.zoom/main.c
  8. 1 1
      general/g.region/main.c
  9. 1 1
      gui/wxpython/vdigit/driver.cpp
  10. 1 1
      gui/wxpython/vdigit/driver.h
  11. 1 1
      gui/wxpython/vdigit/driver_draw.cpp
  12. 1 1
      gui/wxpython/vdigit/driver_select.cpp
  13. 1 1
      gui/wxpython/vdigit/line.cpp
  14. 1 1
      imagery/i.points/driver.c
  15. 1 1
      include/P_site.h
  16. 6 6
      include/cluster.h
  17. 3 3
      include/proto_dbmi.h
  18. 1 1
      include/std_incs.h
  19. 109 89
      include/vect/dig_defines.h
  20. 6 0
      include/vect/dig_externs.h
  21. 4 14
      include/vect/dig_macros.h
  22. 293 269
      include/vect/dig_structs.h
  23. 34 33
      include/vector.h
  24. 1 1
      lib/gis/Makefile
  25. 2 1
      lib/gis/find_file.c
  26. 96 58
      lib/gis/find_vect.c
  27. 21 24
      lib/gis/legal_name.c
  28. 1 1
      lib/gis/open.c
  29. 7 13
      lib/gis/zero.c
  30. 5 3
      lib/nviz/nvizlib.dox
  31. 11 11
      lib/sites/sites.c
  32. 10 10
      lib/vector/Vlib/area.c
  33. 8 8
      lib/vector/Vlib/array.c
  34. 13 13
      lib/vector/Vlib/box.c
  35. 1 1
      lib/vector/Vlib/break_lines.c
  36. 14 14
      lib/vector/Vlib/build.c
  37. 14 14
      lib/vector/Vlib/build_nat.c
  38. 5 5
      lib/vector/Vlib/build_ogr.c
  39. 6 6
      lib/vector/Vlib/cindex.c
  40. 1 1
      lib/vector/Vlib/clean_nodes.c
  41. 1 1
      lib/vector/Vlib/close.c
  42. 2 2
      lib/vector/Vlib/close_ogr.c
  43. 1 1
      lib/vector/Vlib/constraint.c
  44. 2 2
      lib/vector/Vlib/dgraph.h
  45. 1 1
      lib/vector/Vlib/error.c
  46. 4 4
      lib/vector/Vlib/find.c
  47. 6 6
      lib/vector/Vlib/geos.c
  48. 6 6
      lib/vector/Vlib/graph.c
  49. 14 14
      lib/vector/Vlib/header.c
  50. 2 2
      lib/vector/Vlib/hist.c
  51. 20 10
      lib/vector/Vlib/init_head.c
  52. 1 1
      lib/vector/Vlib/level_two.c
  53. 1 1
      lib/vector/Vlib/line.c
  54. 10 10
      lib/vector/Vlib/map.c
  55. 1 1
      lib/vector/Vlib/merge_lines.c
  56. 95 70
      lib/vector/Vlib/open.c
  57. 11 12
      lib/vector/Vlib/open_nat.c
  58. 6 6
      lib/vector/Vlib/open_ogr.c
  59. 5 5
      lib/vector/Vlib/poly.c
  60. 4 4
      lib/vector/Vlib/read_nat.c
  61. 3 3
      lib/vector/Vlib/read_ogr.c
  62. 1 1
      lib/vector/Vlib/remove_duplicates.c
  63. 7 7
      lib/vector/Vlib/select.c
  64. 6 6
      lib/vector/Vlib/sindex.c
  65. 1 1
      lib/vector/Vlib/tin.c
  66. 15 15
      lib/vector/Vlib/write_nat.c
  67. 2 2
      lib/vector/dglib/graph.h
  68. 2 2
      lib/vector/dglib/graph_v1.h
  69. 2 2
      lib/vector/dglib/graph_v2.h
  70. 3 3
      lib/vector/diglib/box.c
  71. 6 5
      lib/vector/diglib/cindex.c
  72. 23 9
      lib/vector/diglib/cindex_rw.c
  73. 27 27
      lib/vector/diglib/file.c
  74. 9 5
      lib/vector/diglib/frmt.c
  75. 1 1
      lib/vector/diglib/inside.c
  76. 11 11
      lib/vector/diglib/plus.c
  77. 21 21
      lib/vector/diglib/plus_area.c
  78. 10 10
      lib/vector/diglib/plus_line.c
  79. 4 4
      lib/vector/diglib/plus_node.c
  80. 29 23
      lib/vector/diglib/plus_struct.c
  81. 1 1
      lib/vector/diglib/port_init.c
  82. 36 36
      lib/vector/diglib/portable.c
  83. 11 11
      lib/vector/diglib/spindex.c
  84. 15 15
      lib/vector/diglib/spindex_rw.c
  85. 28 28
      lib/vector/diglib/struct_alloc.c
  86. 1 1
      lib/vector/diglib/test.c
  87. 2 2
      ps/ps.map/ps_vareas.c
  88. 1 1
      ps/ps.map/ps_vlines.c
  89. 1 1
      ps/ps.map/ps_vpoints.c
  90. 1 1
      raster/r.region/main.c
  91. 6 6
      vector/lidar/lidarlib/PolimiFunct.h
  92. 3 3
      vector/lidar/lidarlib/raster.c
  93. 4 4
      vector/lidar/lidarlib/zones.c
  94. 2 2
      vector/lidar/v.lidar.correction/correction.c
  95. 2 2
      vector/lidar/v.lidar.correction/correction.h
  96. 1 1
      vector/lidar/v.lidar.correction/main.c
  97. 2 2
      vector/lidar/v.lidar.edgedetection/edgedetection.c
  98. 3 3
      vector/lidar/v.lidar.edgedetection/edgedetection.h
  99. 1 1
      vector/lidar/v.lidar.edgedetection/main.c
  100. 0 0
      vector/lidar/v.lidar.growing/main.c

+ 1 - 1
display/d.extract/extract.c

@@ -25,7 +25,7 @@ int extract(struct Map_info *In, struct Map_info *Out, int type,
     int screen_x, screen_y, cur_screen_x, cur_screen_y;
     int screen_x, screen_y, cur_screen_x, cur_screen_y;
     double x1, y1, x2, y2;
     double x1, y1, x2, y2;
     struct ilist *List, *CList;
     struct ilist *List, *CList;
-    BOUND_BOX box;
+    struct bound_box box;
     struct line_pnts *Points;
     struct line_pnts *Points;
     struct line_cats *Cats;
     struct line_cats *Cats;
 
 

+ 1 - 1
display/d.thematic.area/area.c

@@ -38,7 +38,7 @@ int dareatheme(struct Map_info *Map, struct cat_list *Clist,
 
 
     for (area = 1; area <= num; area++) {
     for (area = 1; area <= num; area++) {
 	int i;
 	int i;
-	BOUND_BOX box;
+	struct bound_box box;
 
 
 	G_debug(3, "area = %d", area);
 	G_debug(3, "area = %d", area);
 
 

+ 1 - 1
display/d.thematic.area/main.c

@@ -64,7 +64,7 @@ int main(int argc, char **argv)
     dbHandle handle;
     dbHandle handle;
     dbCatValArray cvarr;
     dbCatValArray cvarr;
     struct Cell_head window;
     struct Cell_head window;
-    BOUND_BOX box;
+    struct bound_box box;
     double overlap, *breakpoints, *data = NULL, class_info = 0.0;
     double overlap, *breakpoints, *data = NULL, class_info = 0.0;
     struct GASTATS stats;
     struct GASTATS stats;
     FILE *fd;
     FILE *fd;

+ 2 - 2
display/d.vect/area.c

@@ -132,7 +132,7 @@ int darea(struct Map_info *Map, struct cat_list *Clist,
 
 
     for (area = 1; area <= num; area++) {
     for (area = 1; area <= num; area++) {
 	int i;
 	int i;
-	BOUND_BOX box;
+	struct bound_box box;
 
 
 	G_debug(3, "area = %d", area);
 	G_debug(3, "area = %d", area);
 
 
@@ -231,7 +231,7 @@ int darea(struct Map_info *Map, struct cat_list *Clist,
 
 
 	/* z height colors */
 	/* z height colors */
 	if (z_color_flag && Vect_is_3d(Map)) {
 	if (z_color_flag && Vect_is_3d(Map)) {
-	    BOUND_BOX box;
+	    struct bound_box box;
 	    double zval;
 	    double zval;
 	    struct Colors colors;
 	    struct Colors colors;
 
 

+ 1 - 1
display/d.vect/main.c

@@ -109,7 +109,7 @@ int main(int argc, char **argv)
     dbDriver *driver;
     dbDriver *driver;
     dbHandle handle;
     dbHandle handle;
     struct Cell_head window;
     struct Cell_head window;
-    BOUND_BOX box;
+    struct bound_box box;
     double overlap;
     double overlap;
 
 
     /* Initialize the GIS calls */
     /* Initialize the GIS calls */

+ 1 - 1
display/d.vect/plot1.c

@@ -323,7 +323,7 @@ int plot1(struct Map_info *Map, int type, int area, struct cat_list *Clist,
 
 
 	/* z height colors */
 	/* z height colors */
 	if (z_color_flag && Vect_is_3d(Map)) {
 	if (z_color_flag && Vect_is_3d(Map)) {
-	    BOUND_BOX box;
+	    struct bound_box box;
 	    double zval;
 	    double zval;
 	    struct Colors colors;
 	    struct Colors colors;
 
 

+ 1 - 1
display/d.zoom/main.c

@@ -161,7 +161,7 @@ int main(int argc, char **argv)
 
 
     if (vect) {
     if (vect) {
 	struct Map_info Map;
 	struct Map_info Map;
-	BOUND_BOX box;
+	struct bound_box box;
 
 
 	for (i = 0; vect[i]; i++) ;
 	for (i = 0; vect[i]; i++) ;
 	nvects = i;
 	nvects = i;

+ 1 - 1
general/g.region/main.c

@@ -496,7 +496,7 @@ int main(int argc, char *argv[])
 	vect_ptr = parm.vect->answers;
 	vect_ptr = parm.vect->answers;
 	for (; *vect_ptr != NULL; vect_ptr++) {
 	for (; *vect_ptr != NULL; vect_ptr++) {
 	    struct Map_info Map;
 	    struct Map_info Map;
-	    BOUND_BOX box;
+	    struct bound_box box;
 	    char vect_name[GNAME_MAX];
 	    char vect_name[GNAME_MAX];
 	    struct Cell_head map_window;
 	    struct Cell_head map_window;
 
 

+ 1 - 1
gui/wxpython/vdigit/driver.cpp

@@ -498,7 +498,7 @@ int DisplayDriver::VectorToList(struct ilist *list, const std::vector<int>& vec)
 std::vector<double> DisplayDriver::GetMapBoundingBox()
 std::vector<double> DisplayDriver::GetMapBoundingBox()
 {
 {
     std::vector<double> region;
     std::vector<double> region;
-    BOUND_BOX bbox;
+    struct bound_box bbox;
 
 
     if (!mapInfo) {
     if (!mapInfo) {
 	return region;
 	return region;

+ 1 - 1
gui/wxpython/vdigit/driver.h

@@ -66,7 +66,7 @@ private:
     
     
     struct _region {
     struct _region {
 	// GRASS region section
 	// GRASS region section
-	BOUND_BOX box; // W,E,N,S,T,B
+	struct bound_box box; // W,E,N,S,T,B
 	double ns_res;
 	double ns_res;
 	double ew_res;
 	double ew_res;
 	double center_easting;
 	double center_easting;

+ 1 - 1
gui/wxpython/vdigit/driver_draw.cpp

@@ -32,7 +32,7 @@ int DisplayDriver::DrawMap(bool force)
 	return -1;
 	return -1;
 
 
     int nlines;
     int nlines;
-    BOUND_BOX mapBox;
+    struct bound_box mapBox;
     struct ilist *listLines;
     struct ilist *listLines;
 
 
     // ids.clear();
     // ids.clear();

+ 1 - 1
gui/wxpython/vdigit/driver_select.cpp

@@ -489,7 +489,7 @@ std::vector<double> DisplayDriver::GetRegionSelected()
     
     
     std::vector<double> region;
     std::vector<double> region;
 
 
-    BOUND_BOX region_box, line_box;
+    struct bound_box region_box, line_box;
     struct ilist *list, *list_tmp;
     struct ilist *list, *list_tmp;
 
 
     list = list_tmp = NULL;
     list = list_tmp = NULL;

+ 1 - 1
gui/wxpython/vdigit/line.cpp

@@ -962,7 +962,7 @@ int Digit::BreakLineAtIntersection(int line, struct line_pnts* points_line,
 {
 {
     int ret, type, nlines;
     int ret, type, nlines;
     int lineBreak;
     int lineBreak;
-    BOUND_BOX lineBox;
+    struct bound_box lineBox;
     struct ilist *list, *listBreak, *listRef;
     struct ilist *list, *listBreak, *listRef;
     struct line_pnts *points_check, *points;
     struct line_pnts *points_check, *points;
 
 

+ 1 - 1
imagery/i.points/driver.c

@@ -14,7 +14,7 @@ int driver(void)
 	MENU("PLOT RASTER", plotcell, &use),
 	MENU("PLOT RASTER", plotcell, &use),
 	MENU("ANALYZE", analyze, &use),
 	MENU("ANALYZE", analyze, &use),
 	INFO("  Input method -> ", &from_flag),
 	INFO("  Input method -> ", &from_flag),
-	OPTION("DIGITIZER", 2, &from_digitizer),
+	/*	OPTION("DIGITIZER", 2, &from_digitizer), */
 	OPTION("KEYBOARD", 2, &from_keyboard),
 	OPTION("KEYBOARD", 2, &from_keyboard),
 	OPTION("SCREEN", 2, &from_screen),
 	OPTION("SCREEN", 2, &from_screen),
 	OTHER(mark, &use),
 	OTHER(mark, &use),

+ 1 - 1
include/P_site.h

@@ -13,7 +13,7 @@ int G_site_c_cmp(const void *a, const void *b);
 int G_site_s_cmp(const void *a, const void *b);
 int G_site_s_cmp(const void *a, const void *b);
 char *G_site_format(const Site * s, const char *fs, int id);
 char *G_site_format(const Site * s, const char *fs, int id);
 
 
-/* SITE_ATT * G_sites_get_atts (struct Map_info * ptr, int* cat); */
+/* struct site_att * G_sites_get_atts (struct Map_info * ptr, int* cat); */
 int G_sites_get_fields(struct Map_info *ptr, char ***cnames, int **ctypes,
 int G_sites_get_fields(struct Map_info *ptr, char ***cnames, int **ctypes,
 		       int **ndx);
 		       int **ndx);
 void G_sites_free_fields(int ncols, char **cnames, int *ctypes, int *ndx);
 void G_sites_free_fields(int ncols, char **cnames, int *ctypes, int *ndx);

+ 6 - 6
include/cluster.h

@@ -6,9 +6,9 @@
 
 
 struct Cluster
 struct Cluster
 {
 {
-    int nbands;
-    int npoints;
-    DCELL **points;
+    int nbands;                 /* number of bands */
+    int npoints;                /* number of points */
+    DCELL **points;             /* array of points */
     int np;
     int np;
 
 
     double *band_sum;		/* sum over each band */
     double *band_sum;		/* sum over each band */
@@ -24,10 +24,10 @@ struct Cluster
     double **mean;		/* initial class means */
     double **mean;		/* initial class means */
     struct Signature S;		/* final signature(s) */
     struct Signature S;		/* final signature(s) */
 
 
-    int nclasses;
+    int nclasses;               /* number of classes */
     int merge1, merge2;
     int merge1, merge2;
-    int iteration;
-    double percent_stable;
+    int iteration;              /* number of iterations */
+    double percent_stable;      /* percentage stable */
 };
 };
 
 
 /* c_assign.c */
 /* c_assign.c */

+ 3 - 3
include/proto_dbmi.h

@@ -53,7 +53,7 @@ int db_convert_value_datetime_into_string(dbValue * value, int sqltype,
 int db_convert_value_to_string(dbValue * value, int sqltype,
 int db_convert_value_to_string(dbValue * value, int sqltype,
 			       dbString * string);
 			       dbString * string);
 void db_copy_dbmscap_entry(dbDbmscap * dst, dbDbmscap * src);
 void db_copy_dbmscap_entry(dbDbmscap * dst, dbDbmscap * src);
-int db_copy_string(dbString * dst, dbString * src);
+int db_copy_string(dbString * dst, const dbString * src);
 int db_table_to_sql(dbTable *, dbString *);
 int db_table_to_sql(dbTable *, dbString *);
 int db_copy_table(const char *, const char *, const char *, const char *,
 int db_copy_table(const char *, const char *, const char *, const char *,
 		  const char *, const char *);
 		  const char *, const char *);
@@ -173,7 +173,7 @@ const char *db_get_index_name(dbIndex * index);
 int db_get_index_number_of_columns(dbIndex * index);
 int db_get_index_number_of_columns(dbIndex * index);
 const char *db_get_index_table_name(dbIndex * index);
 const char *db_get_index_table_name(dbIndex * index);
 int db_get_num_rows(dbCursor * cursor);
 int db_get_num_rows(dbCursor * cursor);
-char *db_get_string(dbString * x);
+char *db_get_string(const dbString * x);
 dbColumn *db_get_table_column(dbTable * table, int n);
 dbColumn *db_get_table_column(dbTable * table, int n);
 int db_get_table_delete_priv(dbTable * table);
 int db_get_table_delete_priv(dbTable * table);
 const char *db_get_table_description(dbTable * table);
 const char *db_get_table_description(dbTable * table);
@@ -398,7 +398,7 @@ int db_gversion(dbDriver * driver, dbString * client_version,
 const char *db_whoami(void);
 const char *db_whoami(void);
 void db_zero(void *s, int n);
 void db_zero(void *s, int n);
 void db_zero_string(dbString * x);
 void db_zero_string(dbString * x);
-unsigned int db_sizeof_string(dbString * x);
+unsigned int db_sizeof_string(const dbString * x);
 int db_set_login(const char *, const char *, const char *, const char *);
 int db_set_login(const char *, const char *, const char *, const char *);
 int db_get_login(const char *, const char *, const char **, const char **);
 int db_get_login(const char *, const char *, const char **, const char **);
 
 

+ 1 - 1
include/std_incs.h

@@ -16,7 +16,7 @@ extern char *realloc();
 #include <stdio.h>
 #include <stdio.h>
 #include <signal.h>
 #include <signal.h>
 #include <sys/stat.h>
 #include <sys/stat.h>
-#if defined(sparc) || defined (uts) || defined(SVR4) || defined(IGRAPH)
+#if defined(sparc) || defined (uts) || defined(SVR4) || defined(IdglGraph_s)
 #include <dirent.h>
 #include <dirent.h>
 #else
 #else
 #include <sys/dir.h>
 #include <sys/dir.h>

+ 109 - 89
include/vect/dig_defines.h

@@ -1,26 +1,58 @@
-#define GRASS_OK    0
-#define GRASS_ERR (-1)
+/*!
+  \file include/vect/dig_defines.h
 
 
+  Defines for diglib (part of vector library)
+*/
+
+/*! \brief Exit/print/return on error
+
+  \todo To be moved to gislib
+*/
 #define GV_FATAL_EXIT    0
 #define GV_FATAL_EXIT    0
 #define GV_FATAL_PRINT   1
 #define GV_FATAL_PRINT   1
 #define GV_FATAL_RETURN  2
 #define GV_FATAL_RETURN  2
 
 
-#define GRASS_VECT_DIRECTORY    "vector"	/* name of vector directory */
-#define GRASS_VECT_FRMT_ELEMENT "frmt"	/* format description, data location */
-#define GRASS_VECT_COOR_ELEMENT "coor"	/* coordinates */
-#define GRASS_VECT_HEAD_ELEMENT "head"	/* header information */
-#define GRASS_VECT_DBLN_ELEMENT "dbln"	/* link to database */
-#define GRASS_VECT_HIST_ELEMENT "hist"	/* history file */
-#define GV_TOPO_ELEMENT "topo"	/* topology */
-#define GV_SIDX_ELEMENT "sidx"	/* spatial index */
-#define GV_CIDX_ELEMENT "cidx"	/* category index */
-
+/*! \brief Vector directory layout, element names */
+/*! \brief Name of vector directory */
+#define GV_DIRECTORY    "vector"	
+/*! \brief Format description, data location (OGR) */
+#define GV_FRMT_ELEMENT "frmt"
+/*! \brief Native format, coordinates */
+#define GV_COOR_ELEMENT "coor"
+/*! \brief Native format, header information */	
+#define GV_HEAD_ELEMENT "head"
+/*! \brief Native format, link to database */
+#define GV_DBLN_ELEMENT "dbln"
+/*! \brief Native format, history file */
+#define GV_HIST_ELEMENT "hist"
+/*! \brief Native format, topology file */
+#define GV_TOPO_ELEMENT "topo"
+/*! \brief Native format, spatial index */
+#define GV_SIDX_ELEMENT "sidx"
+/*! \brief Native format, category index */
+#define GV_CIDX_ELEMENT "cidx"
+/*! \brief External format (OGR), feature index */
+#define GV_FIDX_ELEMENT "fidx"
+
+/*! \brief Endian check
+
+  \todo To be moved to gislib?
+*/
 #define ENDIAN_LITTLE 0
 #define ENDIAN_LITTLE 0
 #define ENDIAN_BIG    1
 #define ENDIAN_BIG    1
 #define ENDIAN_OTHER  2
 #define ENDIAN_OTHER  2
 
 
-/* sizes of types used in portable format (different names used in
- * Vlib/ and diglib/ for the same thing) */
+/*! \brief Sizes of types used in portable format (different names used in
+  Vlib/ and diglib/ for the same thing)
+
+  Assumptions:
+   - double =    8 byte IEEE
+   -  float =    4 byte IEEE
+   -   long =    4 byte int
+   -  short =    2 byte int
+  
+  \todo To be moved to gislib?
+*/
 #define PORT_DOUBLE 8
 #define PORT_DOUBLE 8
 #define PORT_FLOAT  4
 #define PORT_FLOAT  4
 #define PORT_LONG   4
 #define PORT_LONG   4
@@ -29,22 +61,19 @@
 #define PORT_CHAR   1
 #define PORT_CHAR   1
 #define PORT_OFF_T  8
 #define PORT_OFF_T  8
 
 
-/* replace by PORT_* in Vlib later and remove : */
+/*! \brief replace by PORT_* in Vlib later and remove :
+  
+  \todo To be removed ?
+*/
 #define DBL_SIZ  8
 #define DBL_SIZ  8
 #define FLT_SIZ  4
 #define FLT_SIZ  4
 #define LNG_SIZ  4
 #define LNG_SIZ  4
 #define SHRT_SIZ 2
 #define SHRT_SIZ 2
 
 
-/*
- ** assumptions:
- **    double =    8 byte IEEE
- **    float  =    4 byte IEEE
- **    long   =    4 byte int
- **    short  =    2 byte int
- **
- */
+/*! \brief Limits for portable types
 
 
-/* Limits for portable types - I am not sure if OK */
+  \todo To be moved to gislib?
+*/
 #define PORT_DOUBLE_MAX 1.7976931348623157e+308
 #define PORT_DOUBLE_MAX 1.7976931348623157e+308
 #define PORT_DOUBLE_MIN 2.2250738585072014e-308
 #define PORT_DOUBLE_MIN 2.2250738585072014e-308
 #define PORT_FLOAT_MAX  3.40282347e+38F
 #define PORT_FLOAT_MAX  3.40282347e+38F
@@ -58,48 +87,70 @@
 #define PORT_CHAR_MAX   127
 #define PORT_CHAR_MAX   127
 #define PORT_CHAR_MIN   (-128)
 #define PORT_CHAR_MIN   (-128)
 
 
-/* Geometry data formats supported by lib */
-/* Don't change GV_FORMAT_* values, this order is hardcoded in lib */
-#define GV_FORMAT_NATIVE   0	/* grass native format */
-#define GV_FORMAT_OGR      1	/* OGR format */
+/*! \brief Geometry data formats supported by lib
+  Don't change GV_FORMAT_* values, this order is hardcoded in lib
+*/
+/*! \brief GRASS native format */
+#define GV_FORMAT_NATIVE   0
+/*! \brief OGR format */
+#define GV_FORMAT_OGR      1
 
 
-/* How may tables linked to map */
-#define GV_1TABLE  0		/* One table */
-#define GV_MTABLE  1		/* More, many, multi */
+/*! \brief One table linked to vector map */
+#define GV_1TABLE  0
+/*! \brief More tables linked to vector map */
+#define GV_MTABLE  1		
 
 
+/*! \brief Read-only vector map open mode */
 #define GV_MODE_READ  0
 #define GV_MODE_READ  0
+/*! \brief Write vector map open mode */
 #define GV_MODE_WRITE 1
 #define GV_MODE_WRITE 1
+/*! \brief Read-write vector map open mode */
 #define GV_MODE_RW    2
 #define GV_MODE_RW    2
 
 
+/*! \brief Vector map open code */
 #define VECT_OPEN_CODE   0x5522AA22
 #define VECT_OPEN_CODE   0x5522AA22
+/*! \brief Vector map close code */
 #define VECT_CLOSED_CODE 0x22AA2255
 #define VECT_CLOSED_CODE 0x22AA2255
 
 
+/*! \brief Vector level
+
+  - 1 without topology
+  - 2 topology
+  - 3 ?
+*/
 #define LEVEL_1  1
 #define LEVEL_1  1
 #define LEVEL_2  2
 #define LEVEL_2  2
 #define LEVEL_3  3
 #define LEVEL_3  3
 
 
-/* Topology level details */
-#define GV_BUILD_NONE  0
-#define GV_BUILD_BASE  1
-#define GV_BUILD_AREAS  2
-#define GV_BUILD_ATTACH_ISLES 3	/* Attach islands to areas */
-#define GV_BUILD_CENTROIDS 4	/* Assign centroids to areas */
-#define GV_BUILD_ALL GV_BUILD_CENTROIDS
-
+/*! \brief Topology level details */
+/*! \brief Nothing to build */
+#define GV_BUILD_NONE         0
+/*! \brief Basic level */
+#define GV_BUILD_BASE         1
+/*! \brief Build areas */
+#define GV_BUILD_AREAS        2
+/*! \brief Attach islands to areas */
+#define GV_BUILD_ATTACH_ISLES 3
+/*! \brief Assign centroids to areas */
+#define GV_BUILD_CENTROIDS    4
+#define GV_BUILD_ALL          GV_BUILD_CENTROIDS
+
+/*! \brief Check if vector map is open */
 #define VECT_OPEN(Map)   (Map->open == VECT_OPEN_CODE)
 #define VECT_OPEN(Map)   (Map->open == VECT_OPEN_CODE)
 
 
-/* Memory mode */
+/*! \brief Memory mode */
 #define GV_MEMORY_ALWAYS 1
 #define GV_MEMORY_ALWAYS 1
 #define GV_MEMORY_NEVER  2
 #define GV_MEMORY_NEVER  2
 #define GV_MEMORY_AUTO   3
 #define GV_MEMORY_AUTO   3
 
 
+/*! \brief Coordinates file head size */
 #define GV_COOR_HEAD_SIZE 14
 #define GV_COOR_HEAD_SIZE 14
 
 
 #define GRASS_V_VERSION       "5.0"
 #define GRASS_V_VERSION       "5.0"
-/* The latest versions of files known by current version of the library. Used for new files */
+/*! \brief The latest versions of files known by current version of
+    the library. Used for new files */
 #define GV_COOR_VER_MAJOR  5
 #define GV_COOR_VER_MAJOR  5
 #define GV_COOR_VER_MINOR  1
 #define GV_COOR_VER_MINOR  1
-
 #define GV_TOPO_VER_MAJOR  5
 #define GV_TOPO_VER_MAJOR  5
 #define GV_TOPO_VER_MINOR  0
 #define GV_TOPO_VER_MINOR  0
 #define GV_SIDX_VER_MAJOR  5
 #define GV_SIDX_VER_MAJOR  5
@@ -107,10 +158,10 @@
 #define GV_CIDX_VER_MAJOR  5
 #define GV_CIDX_VER_MAJOR  5
 #define GV_CIDX_VER_MINOR  0
 #define GV_CIDX_VER_MINOR  0
 
 
-/* The oldest versions of the library, which are capable to read the files created by the current version */
+/*! \brief The oldest versions of the library, which are capable to
+    read the files created by the current version */
 #define GV_COOR_EARLIEST_MAJOR  5
 #define GV_COOR_EARLIEST_MAJOR  5
 #define GV_COOR_EARLIEST_MINOR	1
 #define GV_COOR_EARLIEST_MINOR	1
-
 #define GV_TOPO_EARLIEST_MAJOR  5
 #define GV_TOPO_EARLIEST_MAJOR  5
 #define GV_TOPO_EARLIEST_MINOR	0
 #define GV_TOPO_EARLIEST_MINOR	0
 #define GV_SIDX_EARLIEST_MAJOR  5
 #define GV_SIDX_EARLIEST_MAJOR  5
@@ -118,25 +169,19 @@
 #define GV_CIDX_EARLIEST_MAJOR  5
 #define GV_CIDX_EARLIEST_MAJOR  5
 #define GV_CIDX_EARLIEST_MINOR	0
 #define GV_CIDX_EARLIEST_MINOR	0
 
 
+/*! \brief 2D/3D vector data */
 #define WITHOUT_Z	0
 #define WITHOUT_Z	0
 #define WITH_Z		1
 #define WITH_Z		1
 
 
-#define DIGITIZER	0
-#define MOUSE		1
-
-#define ON	1
-#define OFF	0
-
-/* note this is changed from  3.0  which had 0.04   -dpg */
-#define THRESH_FUDGE   0.03
-
+/*! \brief Side indicator left/right */
 #define GV_LEFT	 1
 #define GV_LEFT	 1
 #define GV_RIGHT 2
 #define GV_RIGHT 2
 
 
-#define GV_FORWARD 1
+/*! \brief Direction indicator forward/backward */
+#define GV_FORWARD  1
 #define GV_BACKWARD 2
 #define GV_BACKWARD 2
 
 
-/* types used in memory on run time - may change */
+/*! \brief Types used in memory on run time (may change) */
 #define GV_POINT      0x01
 #define GV_POINT      0x01
 #define GV_LINE	      0x02
 #define GV_LINE	      0x02
 #define GV_BOUNDARY   0x04
 #define GV_BOUNDARY   0x04
@@ -149,7 +194,7 @@
 #define GV_POINTS (GV_POINT | GV_CENTROID )
 #define GV_POINTS (GV_POINT | GV_CENTROID )
 #define GV_LINES (GV_LINE | GV_BOUNDARY )
 #define GV_LINES (GV_LINE | GV_BOUNDARY )
 
 
-/* types used in store like 'coor' file or postgis type column - must not change */
+/*! \types Used in store like 'coor' file or postgis type column (must not change) */
 #define GV_STORE_POINT    1
 #define GV_STORE_POINT    1
 #define GV_STORE_LINE     2
 #define GV_STORE_LINE     2
 #define GV_STORE_BOUNDARY 3
 #define GV_STORE_BOUNDARY 3
@@ -159,7 +204,7 @@
 #define GV_STORE_AREA     7	/* used in category index file */
 #define GV_STORE_AREA     7	/* used in category index file */
 #define GV_STORE_VOLUME   8	/* used in category index file */
 #define GV_STORE_VOLUME   8	/* used in category index file */
 
 
-/* Overlay operators */
+/*! \brief Overlay operators */
 #define GV_ON_AND     "AND"	/* intersect */
 #define GV_ON_AND     "AND"	/* intersect */
 #define GV_ON_OVERLAP "OVERLAP"
 #define GV_ON_OVERLAP "OVERLAP"
 
 
@@ -171,36 +216,11 @@ enum overlay_operator
 
 
 typedef enum overlay_operator OVERLAY_OPERATOR;
 typedef enum overlay_operator OVERLAY_OPERATOR;
 
 
-#define ESC	033
-
-#ifdef FOO
-/* these have all turned into global ints.  in digit/globals.h */
-/* colors of unique items on screen */
-#define CLR_LINE	BLUE
-#define CLR_AREA	GREY
-#define CLR_DOT		GREEN
-#define CLR_SITE	GREEN
-
-#define CLR_LLINE	MAGENTA
-#define CLR_LSITE	AQUA
-#define CLR_LAREA	ORANGE
-
-#define CLR_AMARK	AQUA
-#define CLR_ALABEL	ORANGE
-#define CLR_LLABEL	MAGENTA
-
-#define CLR_HIGHLIGHT	YELLOW
-#define CLR_ERASE	BLACK
-#define CLR_UNKNOWN	WHITE
-#define CLR_OVERLAY	WHITE
-
-#define CLR_0_NODE	GREEN
-#define CLR_1_NODE	ORANGE
-#define CLR_2_NODE	RED
-#endif
-
-#define GV_NCATS_MAX PORT_INT_MAX	/* maximum number of categories for one element */
-#define GV_FIELD_MAX PORT_INT_MAX	/* maximum field */
-#define GV_CAT_MAX   PORT_INT_MAX	/* maximum category value */
+/*! \brief Maximum number of categories for one element */
+#define GV_NCATS_MAX PORT_INT_MAX
+/*! \brief Maximum field */
+#define GV_FIELD_MAX PORT_INT_MAX
+/*! \brief Maximum category value */
+#define GV_CAT_MAX   PORT_INT_MAX
 
 
-#define BUILD_PROG "v.build"
+#define HEADSTR	50

+ 6 - 0
include/vect/dig_externs.h

@@ -1,3 +1,9 @@
+/*!
+  \file include/vect/dig_externs.h
+
+  \brief Function prototypes for diglib (part of vector library)
+*/
+
 void *dig_alloc_space(int, int *, int, void *, int);	/* exits on error, calls _alloc_space () */
 void *dig_alloc_space(int, int *, int, void *, int);	/* exits on error, calls _alloc_space () */
 void *dig__alloc_space(int, int *, int, void *, int);	/* returns NULL on error, calls calloc(), _frealloc() */
 void *dig__alloc_space(int, int *, int, void *, int);	/* returns NULL on error, calls calloc(), _frealloc() */
 void *dig_falloc(int, int);	/* exits on error, calls _falloc () */
 void *dig_falloc(int, int);	/* exits on error, calls _falloc () */

+ 4 - 14
include/vect/dig_macros.h

@@ -1,14 +1,8 @@
-/* convert UTM to screen */
-#define XADJ(x)		(int)((x - U_west ) * U_to_D_xconv + D_west)
-#define YADJ(y)		(int)((y - U_south) * U_to_D_yconv + D_south)
+/*!
+  \file include/vect/dig_macros.h
 
 
-#define _TOGGLE(x) ((x) ? 0 : 1)
-#define TOGGLE(x)  ((x) = _TOGGLE (x))
-#define BEEP	   putchar ('\007')
-#define ON_OFF(x)  ((x) ? "        ON" : "       OFF")
-/*
-   #define ABS(x)          ((x) < 0 ? -(x) : (x))
- */
+  \brief Macros for diglib (part of vector library
+*/
 
 
 /* ALIVE MACROS take a pointer the the structure in question */
 /* ALIVE MACROS take a pointer the the structure in question */
 /*  and return 0 or non-zero */
 /*  and return 0 or non-zero */
@@ -22,7 +16,3 @@
 
 
 #define LESSER(x,y)  ((x) < (y) ? (x) : (y))
 #define LESSER(x,y)  ((x) < (y) ? (x) : (y))
 #define GREATER(x,y) ((x) > (y) ? (x) : (y))
 #define GREATER(x,y) ((x) > (y) ? (x) : (y))
-
-
-/* temporary till 3.0 */
-/*#define R_standard_color(x) R_color (x) */

+ 293 - 269
include/vect/dig_structs.h

@@ -1,13 +1,17 @@
-/*
- **  Written by Dave Gerdes  5/1988
- **  US Army Construction Engineering Research Lab
- */
+/*!
+  \file include/vect/dig_structs.h
+
+  \brief Structures for diglib (vector library)
+
+  \author Written by Dave Gerdes (CERL)  5/1988
+  \author Updated to GRASS 5.7 by Radim Blazek (2001)
+*/
 #include <grass/config.h>
 #include <grass/config.h>
 
 
 #ifndef  DIG___STRUCTS___
 #ifndef  DIG___STRUCTS___
 #define DIG___STRUCTS___
 #define DIG___STRUCTS___
 
 
-/*  this file depends on  <stdio.h> */
+/*  this file depends on <stdio.h> */
 #ifndef _STDIO_H
 #ifndef _STDIO_H
 #include <stdio.h>
 #include <stdio.h>
 #endif
 #endif
@@ -19,32 +23,20 @@
 #include <grass/btree.h>
 #include <grass/btree.h>
 #include <grass/rtree.h>
 #include <grass/rtree.h>
 
 
-
 #ifdef HAVE_OGR
 #ifdef HAVE_OGR
 #include "ogr_api.h"
 #include "ogr_api.h"
 #endif
 #endif
 
 
-#define HEADSTR	50
-
-/*
- **  NOTE: 3.10 changes plus_t to  ints.
- **    This assumes that any reasonable machine will use 4 bytes to
- **    store an int.  The mapdev code is not guaranteed to work if
- **    plus_t is changed to a type that is larger than an int.
- */
-/*
-   typedef short plus_t;
- */
-typedef int plus_t;
-
-typedef struct bound_box BOUND_BOX;
+/*! \brief plus_t size
 
 
-typedef struct P_node P_NODE;
-typedef struct P_area P_AREA;
-typedef struct P_line P_LINE;
-typedef struct P_isle P_ISLE;
+  3.10 changes plus_t to  ints.
+  This assumes that any reasonable machine will use 4 bytes to
+  store an int. The mapdev code is not guaranteed to work if
+  plus_t is changed to a type that is larger than an int.
+*/
+typedef int plus_t;
 
 
-/* Used by sites lib */
+/*! \brief Used by sites lib */
 struct site_att
 struct site_att
 {
 {
     int cat;			/* category */
     int cat;			/* category */
@@ -52,9 +44,8 @@ struct site_att
     char **str;			/* string attributes */
     char **str;			/* string attributes */
 };
 };
 
 
-typedef struct site_att SITE_ATT;
-
-struct bound_box		/* Bounding Box */
+/*! \brief Bounding box */
+struct bound_box		
 {
 {
     double N;			/* north */
     double N;			/* north */
     double S;			/* south */
     double S;			/* south */
@@ -64,43 +55,42 @@ struct bound_box		/* Bounding Box */
     double B;			/* bottom */
     double B;			/* bottom */
 };
 };
 
 
+/*! \brief File definition */
 struct gvfile
 struct gvfile
 {
 {
     FILE *file;
     FILE *file;
     char *start;		/* pointer to beginnig of the file in the memory */
     char *start;		/* pointer to beginnig of the file in the memory */
-    char *current;		/* current position set by dig_seek */
+    char *current;		/* current position set by dig_seek() */
     char *end;			/* end of file in the memory (pointer to first byte after) */
     char *end;			/* end of file in the memory (pointer to first byte after) */
     off_t size;			/* size of the file loaded to memory */
     off_t size;			/* size of the file loaded to memory */
     off_t alloc;		/* allocated space */
     off_t alloc;		/* allocated space */
     int loaded;			/* 0 - not loaded, 1 - loaded */
     int loaded;			/* 0 - not loaded, 1 - loaded */
 };
 };
 
 
-typedef struct gvfile GVFILE;
-
-/* category field information */
+/*! \brief Field information */
 struct field_info
 struct field_info
 {
 {
     int number;			/* field number */
     int number;			/* field number */
     char *name;			/* field name */
     char *name;			/* field name */
-    char *driver;
-    char *database;
-    char *table;
-    char *key;
+    char *driver;               /* db driver */
+    char *database;             /* db database */
+    char *table;                /* db table */
+    char *key;                  /* table key */
 };
 };
 
 
+/*! \brief Database links */
 struct dblinks
 struct dblinks
 {
 {
-    struct field_info *field;
-    int alloc_fields, n_fields;
+    struct field_info *field;   /* pointer to the first field_info structure */
+    int alloc_fields;           /* number of allocated slots */
+    int n_fields;               /* number of available fields */
 };
 };
 
 
-/* Portability info */
+/*! \brief Portability info - set in V1_open_new/old() */
 struct Port_info
 struct Port_info
 {
 {
-    /* portability stuff, set in V1_open_new/old() */
-    /* file byte order */
-    int byte_order;
-    int off_t_size;
+    int byte_order;             /* file byte order */
+    int off_t_size;             /* off_t size */
 
 
     /* conversion matrices between file and native byte order */
     /* conversion matrices between file and native byte order */
     unsigned char dbl_cnvrt[PORT_DOUBLE];
     unsigned char dbl_cnvrt[PORT_DOUBLE];
@@ -110,9 +100,8 @@ struct Port_info
     unsigned char shrt_cnvrt[PORT_SHORT];
     unsigned char shrt_cnvrt[PORT_SHORT];
     unsigned char off_t_cnvrt[PORT_OFF_T];
     unsigned char off_t_cnvrt[PORT_OFF_T];
 
 
-    /* *_quick specify if native byte order of that type 
-     * is the same as byte order of vector file (TRUE) 
-     * or not (FALSE);*/
+    /* *_quick specify if native byte order of that type is the same
+      as byte order of vector file (TRUE) or not (FALSE) */
     int dbl_quick;
     int dbl_quick;
     int flt_quick;
     int flt_quick;
     int lng_quick;
     int lng_quick;
@@ -121,68 +110,70 @@ struct Port_info
     int off_t_quick;
     int off_t_quick;
 };
 };
 
 
-/* List of dead lines in the file, the space can be reused, not yet used */
+/*! \brief List of dead lines in the file, the space can be reused,
+  not yet used
+
+  \todo Implement it
+*/
 struct recycle
 struct recycle
 {
 {
-    /* TODO */
     char dummy;
     char dummy;
 };
 };
 
 
+/*! \brief Vector map head */
 struct dig_head
 struct dig_head
 {
 {
-
-    /*** HEAD_ELEMENT ***/
-    char *organization;
-    char *date;
-    char *your_name;
-    char *map_name;
-    char *source_date;
-    long orig_scale;
-    char *line_3;
-    int plani_zone;
-    /* double W, E, S, N; */
-    double digit_thresh;
-    /* double map_thresh; *//* not used in g57 */
+    /* elements */
+    char *organization;         /* orgranization name */
+    char *date;                 /* map date */
+    char *your_name;            /* user name */
+    char *map_name;             /* map name */
+    char *source_date;          /* source date */
+    long orig_scale;            /* original scale */
+    char *line_3;               /* comments */
+    int plani_zone;             /* zone */
+    double digit_thresh;        /* threshold for digitization */
 
 
     /* Programmers should NOT touch any thing below here */
     /* Programmers should NOT touch any thing below here */
     /* Library takes care of everything for you          */
     /* Library takes care of everything for you          */
 
 
-    /*** COOR_ELEMENT ***/
-    int Version_Major;
+    /* coor elements */
+    int Version_Major;          /* backward compatibility info */
     int Version_Minor;
     int Version_Minor;
     int Back_Major;
     int Back_Major;
     int Back_Minor;
     int Back_Minor;
-    int with_z;
+    int with_z;                 /* 2D/3D vector data */
 
 
     off_t size;			/* coor file size */
     off_t size;			/* coor file size */
     long head_size;		/* coor header size */
     long head_size;		/* coor header size */
 
 
-    struct Port_info port;	/* Portability information */
+    struct Port_info port;	/* portability information */
 
 
     off_t last_offset;		/* offset of last read line */
     off_t last_offset;		/* offset of last read line */
 
 
-    struct recycle *recycle;
+    struct recycle *recycle;    /* recycle dead line, not implemented yet */
 
 
-    struct Map_info *Map;	/* X-ref to Map_info struct ?? */
+    struct Map_info *Map;	/* X-ref to Map_info struct (needed?) */
 };
 };
 
 
-/* Coor info */
+/*! \brief Coor file info */
 struct Coor_info
 struct Coor_info
 {
 {
     off_t size;			/* total size, in bytes */
     off_t size;			/* total size, in bytes */
     long mtime;			/* time of last modification */
     long mtime;			/* time of last modification */
 };
 };
 
 
-/* Non-native format inforamtion */
-/* TODO: structure size should not change depending on compilation I think, do it better */
-/* OGR */
+/*! \brief Non-native format info (OGR)
+
+  \todo Structure size should not change depending on compilation I think, do it better 
+*/
 struct Format_info_ogr
 struct Format_info_ogr
 {
 {
-    char *dsn;
-    char *layer_name;
+    char *dsn;                  /* OGR datasource name */
+    char *layer_name;           /* OGR layer name */
 #ifdef HAVE_OGR
 #ifdef HAVE_OGR
-    OGRDataSourceH ds;
-    OGRLayerH layer;
+    OGRDataSourceH ds;          /* pointer to OGRDataSourceH */
+    OGRLayerH layer;            /* pointer to OGRLayerH */
 #else
 #else
     void *ds;
     void *ds;
     void *layer;
     void *layer;
@@ -190,8 +181,8 @@ struct Format_info_ogr
 
 
     /* Level 1 (used by V*_read_next_line_ogr) */
     /* Level 1 (used by V*_read_next_line_ogr) */
     struct line_pnts **lines;	/* points cache */
     struct line_pnts **lines;	/* points cache */
-    int *lines_types;
-    int lines_alloc;
+    int *lines_types;           /* list of line types */
+    int lines_alloc;            /* number of allocated lines */
     int lines_num;		/* number of lines in cache */
     int lines_num;		/* number of lines in cache */
     int lines_next;		/* next line to be read from cache */
     int lines_next;		/* next line to be read from cache */
 
 
@@ -203,139 +194,155 @@ struct Format_info_ogr
 #endif
 #endif
     int feature_cache_id;	/* id of feature read in feature_cache */
     int feature_cache_id;	/* id of feature read in feature_cache */
 
 
-    /* Array where OGR feature/part info is stored for each line in GRASS.
-     * This is not used for GV_CENTROID.
-     * Because one feature may contain more elements (geometry collection also recursively),
-     * offset for one line may be stored in more records. 
-     * First record is FID, next records are part indexes if necessary.
-     * Example:
-     * 5. ring in 3. polygon in 7. feature (multipolygon) of geometry collection which has FID = 123
-     * 123 (feature 123: geometry colletion)
-     *   6 (7. feature in geometry collection: multiPolygon)
-     *   2 (3. polygon)
-     *   4 (5. ring in the polygon)
+    /* Array where OGR feature/part info is stored for each line in
+     * GRASS.  This is not used for GV_CENTROID.  Because one feature
+     * may contain more elements (geometry collection also
+     * recursively), offset for one line may be stored in more
+     * records.  First record is FID, next records are part indexes if
+     * necessary.  Example: 5. ring in 3. polygon in 7. feature
+     * (multipolygon) of geometry collection which has FID = 123 123
+     * (feature 123: geometry colletion) 6 (7. feature in geometry
+     * collection: multiPolygon) 2 (3. polygon) 4 (5. ring in the
+     * polygon)
      */
      */
-    int *offset;
+    int *offset;                /* offset list */
     int offset_num;		/* number of items in offset */
     int offset_num;		/* number of items in offset */
     int offset_alloc;		/* space allocated for offset */
     int offset_alloc;		/* space allocated for offset */
 
 
     int next_line;		/* used by V2_read_next_line_ogr */
     int next_line;		/* used by V2_read_next_line_ogr */
 };
 };
 
 
+/*! \brief Non-native format info */
 struct Format_info
 struct Format_info
 {
 {
-    int i;
-    struct Format_info_ogr ogr;
+    int i;                      /* id? */
+    struct Format_info_ogr ogr; /* OGR info */
 };
 };
 
 
-/* Category index */
+/*! \brief Category index */
 struct Cat_index
 struct Cat_index
 {
 {
     int field;			/* field number */
     int field;			/* field number */
     int n_cats;			/* number of items in cat array */
     int n_cats;			/* number of items in cat array */
     int a_cats;			/* allocated space in cat array */
     int a_cats;			/* allocated space in cat array */
-    int (*cat)[3];		/* array of cats (cat,type, lines/area) */
+    int (*cat)[3];		/* array of cats (cat, type, lines/area) */
     int n_ucats;		/* number of unique cats (not updated) */
     int n_ucats;		/* number of unique cats (not updated) */
     int n_types;		/* number of types in type */
     int n_types;		/* number of types in type */
-    int type[7][2];		/* number of elements for each type (point, line, boundary, centroid, area, face, kernel) */
-    off_t offset;		/* offset of the beginning of this index in cidx file */
+    int type[7][2];		/* number of elements for each type
+				 * (point, line, boundary, centroid,
+				 * area, face, kernel) */
+    off_t offset;		/* offset of the beginning of this
+				 * index in cidx file */
 };
 };
 
 
+/*! \brief Plus head info */
 struct Plus_head
 struct Plus_head
 {
 {
-    int Version_Major;		/* version codes */
+    /*** version info ***/
+    int Version_Major;		 /* version codes */
     int Version_Minor;
     int Version_Minor;
-    int Back_Major;		/* earliest version that can use this data format */
+    int Back_Major;		 /* earliest version that can use this data format */
     int Back_Minor;
     int Back_Minor;
 
 
-    int spidx_Version_Major;	/* version codes for spatial index */
+    int spidx_Version_Major;	 /* version codes for spatial index */
     int spidx_Version_Minor;
     int spidx_Version_Minor;
-    int spidx_Back_Major;	/* earliest version that can use this data format */
+    int spidx_Back_Major;	 /* earliest version that can use this data format */
     int spidx_Back_Minor;
     int spidx_Back_Minor;
 
 
-    int cidx_Version_Major;	/* version codes for category index */
+    int cidx_Version_Major;	 /* version codes for category index */
     int cidx_Version_Minor;
     int cidx_Version_Minor;
-    int cidx_Back_Major;	/* earliest version that can use this data format */
+    int cidx_Back_Major;	 /* earliest version that can use this data format */
     int cidx_Back_Minor;
     int cidx_Back_Minor;
 
 
-    int with_z;
-    int spidx_with_z;
-
-    int off_t_size;        /* offset size here because Plus_head is available to all releveant functions */
-
-    long head_size;		/* topo header size */
-    long spidx_head_size;	/* spatial index header size */
-    long cidx_head_size;	/* category index header size */
-
-    int release_support;	/* release memory occupied by support (topo, spatial, category) */
-
-    struct Port_info port;	/* Portability information */
-    struct Port_info spidx_port;	/* Portability information for spatial index */
-    struct Port_info cidx_port;	/* Portability information for category index */
-    int mode;			/* Read, Write, RW */
-
-    int built;			/* the highest level of topology currently available (GV_BUILD_*) */
-
-    struct bound_box box;	/* box */
-
-    P_NODE **Node;		/* P_NODE array of pointers *//* 1st item is 1 for  */
-    P_LINE **Line;		/* P_LINE array of pointers *//* all these (not 0) */
-    P_AREA **Area;
-    P_ISLE **Isle;
-    /* add here P_FACE, P_VOLUME, P_HOLE */
-
-    plus_t n_nodes;		/* current Number of nodes */
-    plus_t n_edges;		/* current Number of edges */
-    plus_t n_lines;		/* current Number of lines */
-    plus_t n_areas;		/* current Number of areas */
-    plus_t n_isles;		/* current Number of isles */
-    plus_t n_faces;		/* current Number of faces */
-    plus_t n_volumes;	/* current Number of volumes */
-    plus_t n_holes;		/* current Number of holes */
-
-    plus_t n_plines;		/* Current Number of point    lines */
-    plus_t n_llines;		/* Current Number of line     lines */
-    plus_t n_blines;		/* Current Number of boundary lines */
-    plus_t n_clines;		/* Current Number of centroid lines */
-    plus_t n_flines;		/* Current Number of face lines */
-    plus_t n_klines;		/* Current Number of kernel lines */
-    plus_t n_vfaces;		/* Current Number of volume faces */
-    plus_t n_hfaces;		/* Current Number of hole faces */
-
-    plus_t alloc_nodes;		/* # of nodes we have alloc'ed space for 
-				   i.e. array size - 1 */
-    plus_t alloc_edges;
-    plus_t alloc_lines;		/* # of lines we have alloc'ed space for */
-    plus_t alloc_areas;		/* # of areas we have alloc'ed space for */
-    plus_t alloc_isles;		/* # of isles we have alloc'ed space for */
-    plus_t alloc_faces;		/* # of faces we have alloc'ed space for */
-    plus_t alloc_volumes;	/* # of volumes we have alloc'ed space for */
-    plus_t alloc_holes;		/* # of holes we have alloc'ed space for */
-
-    off_t Node_offset;		/* offset of array of nodes in topo file */
-    off_t Edge_offset;
-    off_t Line_offset;
-    off_t Area_offset;
-    off_t Isle_offset;
-    off_t Volume_offset;
-    off_t Hole_offset;
-
-    /* Spatial index is always saved */
-
-    int Spidx_built;		/* set to 1 if spatial index is available */
-    int Spidx_new;          /* set to 1 if new spatial index will be generated */
-
-    GVFILE spidx_fp;		    /* spatial index file pointer */
+    int with_z;                  /* 2D/3D vector data */
+    int spidx_with_z;            /* 2D/3D spatial index */
+
+    int off_t_size;              /* offset size here because Plus_head
+				    is available to all releveant
+				    functions */
+
+    /*** file header size ***/
+    long head_size;		 /* topo header size */
+    long spidx_head_size;	 /* spatial index header size */
+    long cidx_head_size;	 /* category index header size */
+
+    int release_support;	 /* release memory occupied by support
+				    (topo, spatial, category) */
+
+    /*** portability info */
+    struct Port_info port;	 /* portability information */
+    struct Port_info spidx_port; /* portability information for
+				    spatial index */
+    struct Port_info cidx_port;	 /* portability information for
+				    category index */
+    int mode;			 /* read, write, RW */
+
+    int built;			 /* the highest level of topology
+				    currently available
+				    (GV_BUILD_*) */
+
+    struct bound_box box;	 /* vector map bounding box */
+
+    /*** topology ***/
+    struct P_node **Node;	 /* struct P_node array of pointers 
+				    1st item is 1 for  */
+    struct P_line **Line;	 /* struct P_line array of pointers 
+				    all these (not 0) */
+    struct P_area **Area;
+    struct P_isle **Isle;
+                                 /* add here P_FACE, P_VOLUME, P_HOLE */
+
+    plus_t n_nodes;		 /* current number of nodes */
+    plus_t n_edges;		 /* current number of edges */
+    plus_t n_lines;	 	 /* current number of lines */
+    plus_t n_areas;		 /* current number of areas */
+    plus_t n_isles;		 /* current number of isles */
+    plus_t n_faces;		 /* current number of faces */
+    plus_t n_volumes;	         /* current number of volumes */
+    plus_t n_holes;		 /* current number of holes */
+
+    plus_t n_plines;		 /* current number of points */
+    plus_t n_llines;		 /* current number of lines */
+    plus_t n_blines;		 /* current number of boundaries */
+    plus_t n_clines;		 /* current number of centroids */
+    plus_t n_flines;		 /* current number of faces */
+    plus_t n_klines;		 /* current number of kernels*/
+    plus_t n_vfaces;		 /* current number of volumes */
+    plus_t n_hfaces;		 /* current number of hole faces */
+
+    plus_t alloc_nodes;		 /* number of nodes we have alloc'ed
+				    space for i.e. array size - 1 */
+    plus_t alloc_edges;          /* number of edges we have alloc'ed space for */
+    plus_t alloc_lines;		 /* number of lines we have alloc'ed space for */
+    plus_t alloc_areas;		 /* number of areas we have alloc'ed space for */
+    plus_t alloc_isles;		 /* number of isles we have alloc'ed space for */
+    plus_t alloc_faces;		 /* number of faces we have alloc'ed space for */
+    plus_t alloc_volumes;	 /* number of volumes we have alloc'ed space for */
+    plus_t alloc_holes;		 /* number of holes we have alloc'ed space for */
+
+    off_t Node_offset;		 /* offset of array of nodes in topo file */
+    off_t Edge_offset;           /* offset of array of edges in topo file */
+    off_t Line_offset;           /* offset of array of lines in topo file */
+    off_t Area_offset;           /* offset of array of areas in topo file */
+    off_t Isle_offset;           /* offset of array of isles in topo file */
+    off_t Volume_offset;         /* offset of array of volumes in topo file */
+    off_t Hole_offset;           /* offset of array of holes in topo file */
+
+    /*** spatial index ***/
+    int Spidx_built;		 /* set to 1 if spatial index is available */
+    int Spidx_new;               /* set to 1 if new spatial index will be generated */
+
+    struct gvfile spidx_fp;	 /* spatial index file pointer */
     
     
-    char *spidx_node_fname;     /* node spatial index file name */
+    char *spidx_node_fname;      /* node spatial index file name */
 
 
-    off_t Node_spidx_offset;	/* offset of spatial index in sidx file */
-    off_t Line_spidx_offset;
-    off_t Area_spidx_offset;
-    off_t Isle_spidx_offset;
-    off_t Face_spidx_offset;
-    off_t Volume_spidx_offset;
-    off_t Hole_spidx_offset;
+    off_t Node_spidx_offset;	 /* offset of nodes in sidx file */
+    off_t Line_spidx_offset;     /* offset of lines in sidx file */
+    off_t Area_spidx_offset;     /* offset of areas in sidx file */
+    off_t Isle_spidx_offset;     /* offset of isles in sidx file */
+    off_t Face_spidx_offset;     /* offset of faces in sidx file */
+    off_t Volume_spidx_offset;   /* offset of volumes in sidx file */
+    off_t Hole_spidx_offset;     /* offset of holes in sidx file */
 
 
     struct RTree *Node_spidx;     /* node spatial index */
     struct RTree *Node_spidx;     /* node spatial index */
     struct RTree *Line_spidx;     /* line spatial index */
     struct RTree *Line_spidx;     /* line spatial index */
@@ -345,70 +352,75 @@ struct Plus_head
     struct RTree *Volume_spidx;   /* volume spatial index */
     struct RTree *Volume_spidx;   /* volume spatial index */
     struct RTree *Hole_spidx;     /* hole spatial index */
     struct RTree *Hole_spidx;     /* hole spatial index */
 
 
-    /* Category index */
+    /*** category index ***/
     /* By default, category index is not updated */
     /* By default, category index is not updated */
-    int update_cidx;		/* update category index if vector is modified */
-
-    int n_cidx;			/* number of cat indexes (one for each field) */
-    int a_cidx;			/* allocated space for cat indexes */
-    struct Cat_index *cidx;	/* Array of category indexes */
-    int cidx_up_to_date;	/* set to 1 when cidx is created and reset to 0 whenever any line is changed */
-
-    off_t coor_size;		/* size of coor file */
-    long coor_mtime;		/* time of last coor modification */
-
-    /* Level2 update: list of lines and nodes updated (topo info for the line was changed) 
-     *                 by last write/rewrite/delete operation.
-     *                 Lines/nodes in the list may be deleted (e.g. delete boundary: first added for
-     *                 delete area and then delete */
-    int do_uplist;		/* used internaly in diglib to know if list is maintained */
-
-    int *uplines;		/* array of updated lines */
-    int alloc_uplines;		/* allocated array */
-    int n_uplines;		/* number of updated lines */
-    int *upnodes;		/* array of updated nodes */
-    int alloc_upnodes;		/* allocated array */
-    int n_upnodes;		/* number of updated nodes */
+    int update_cidx;		  /* update category index if vector is modified */
+
+    int n_cidx;			  /* number of cat indexes (one for each field) */
+    int a_cidx;			  /* allocated space for cat indexes */
+    struct Cat_index *cidx;	  /* array of category indexes */
+    int cidx_up_to_date;	  /* set to 1 when cidx is created and reset to 0 whenever any line is changed */
+
+    off_t coor_size;		  /* size of coor file */
+    long coor_mtime;		  /* time of last coor modification */
+
+    /*** level 2 ***/
+    /* update: list of lines and nodes updated (topo info for the line
+       was changed) by last write/rewrite/delete operation.
+       Lines/nodes in the list may be deleted (e.g. delete boundary:
+       first added for delete area and then delete */
+    int do_uplist;		  /* used internaly in diglib to know if list is maintained */
+
+    int *uplines;		  /* array of updated lines */
+    int alloc_uplines;		  /* allocated array */
+    int n_uplines;		  /* number of updated lines */
+    int *upnodes;		  /* array of updated nodes */
+    int alloc_upnodes;		  /* allocated array */
+    int n_upnodes;		  /* number of updated nodes */
 };
 };
 
 
+/*! \brief Vector map info */
 struct Map_info
 struct Map_info
 {
 {
-    /* Common info for all formats */
-    int format;			/* format */
+    /* common info for all formats */
+    int format;			/* format (native, ogr) */
     int temporary;		/* temporary file flag, not yet used */
     int temporary;		/* temporary file flag, not yet used */
 
 
-    struct dblinks *dblnk;	/* info about tables */
+    struct dblinks *dblnk;	/* info about db links */
 
 
-    struct Plus_head plus;	/* topo file *head; */
+    struct Plus_head plus;	/* topo file head info */
 
 
+    /* graph-related section */
     int graph_line_type;	/* line type used to build the graph */
     int graph_line_type;	/* line type used to build the graph */
     dglGraph_s graph;		/* graph structure */
     dglGraph_s graph;		/* graph structure */
-    dglSPCache_s spCache;	/* Shortest path cache */
-    double *edge_fcosts;	/* costs used for graph, (dglGetEdge() is not supported for _DGL_V1) */
+    dglSPCache_s spCache;	/* shortest path cache */
+    double *edge_fcosts;	/* costs used for graph, (dglGetEdge()
+				   is not supported for _DGL_V1) */
     double *edge_bcosts;
     double *edge_bcosts;
     double *node_costs;		/* node costs */
     double *node_costs;		/* node costs */
-    int cost_multip;		/* edge and node costs multiplicator */
-
-    /*  All of these apply only to runtime, and none get written out
-     **  to the dig_plus file 
-     */
-    int open;			/* should be 0x5522AA22 if opened correctly */
-    /* or        0x22AA2255 if closed           */
-    /* anything else implies that structure has */
-    /* never been initialized                   */
-    int mode;			/*  Read, Write, RW                         */
-    int level;			/*  1, 2, (3)                               */
-    int head_only;		/* Only header is opened */
-    int support_updated;	/* Support files were updated */
-    plus_t next_line;		/* for Level II sequential reads */
+    int cost_multip;		/* edge and node costs
+				   multiplicator */
+    
+    int open;			/* should be 0x5522AA22 (VECT_OPEN_CODE) if opened correctly
+				   or        0x22AA2255 (VECT_CLOSED_CODE) if closed          
+				   anything else implies that structure has
+				   never been initialized
+				*/
+    int mode;			/* Open mode - read (GV_MODE_READ),
+				   write (GV_MODE_WRITE),
+				   rw (GV_MODE_RW) */
+    int level;			/* Topology level - 1, 2, (3) */
+    int head_only;		/* only header is opened */
+    int support_updated;	/* support files were updated */
+    plus_t next_line;		/* for level 2 sequential reads */
 
 
     char *name;			/* for 4.0  just name, and mapset */
     char *name;			/* for 4.0  just name, and mapset */
-    char *mapset;
+    char *mapset;               /* mapset name */
     /* location and gisdbase is usefull if changed (v.proj or external apps) */
     /* location and gisdbase is usefull if changed (v.proj or external apps) */
     char *location;		/* location name */
     char *location;		/* location name */
     char *gisdbase;		/* gisdbase path */
     char *gisdbase;		/* gisdbase path */
 
 
-    /* Constraints for reading in lines  (not polys yet) */
+    /* constraints for reading in lines  (not polys yet) */
     int Constraint_region_flag;
     int Constraint_region_flag;
     int Constraint_type_flag;
     int Constraint_type_flag;
     double Constraint_N;
     double Constraint_N;
@@ -422,7 +434,7 @@ struct Map_info
 
 
     /* format specific */
     /* format specific */
     /* native */
     /* native */
-    GVFILE dig_fp;		/* Dig file pointer */
+    struct gvfile dig_fp;	/* dig file pointer */
     struct dig_head head;	/* coor file head */
     struct dig_head head;	/* coor file head */
 
 
     /* non native */
     /* non native */
@@ -431,37 +443,46 @@ struct Map_info
     /* history file */
     /* history file */
     FILE *hist_fp;
     FILE *hist_fp;
 
 
-    /* Temporary solution for sites */
-    SITE_ATT *site_att;		/* array of attributes loaded from db */
+    /* temporary solution for sites - to be removed ?*/
+    struct site_att *site_att;	/* array of attributes loaded from db */
     int n_site_att;		/* number of attributes in site_att array */
     int n_site_att;		/* number of attributes in site_att array */
     int n_site_dbl;		/* number of double attributes for one site */
     int n_site_dbl;		/* number of double attributes for one site */
     int n_site_str;		/* number of string attributes for one site */
     int n_site_str;		/* number of string attributes for one site */
 };
 };
 
 
+/*! \brief Node (topology) info */
 struct P_node
 struct P_node
 {
 {
     double x;			/* X coordinate */
     double x;			/* X coordinate */
     double y;			/* Y coordinate */
     double y;			/* Y coordinate */
     double z;			/* Z coordinate */
     double z;			/* Z coordinate */
-    plus_t alloc_lines;
-    plus_t n_lines;		/* Number of attached lines (size of lines, angle) */
-    /*  If 0, then is degenerate node, for snappingi ??? */
-    plus_t *lines;		/* Connected lines */
-    float *angles;		/* Respected angles. Angles for lines/boundaries are in radians between
-				 * -PI and PI. Value for points or lines with identical points (degenerated)
-				 * is set to -9. */
+    plus_t alloc_lines;         /* allocated space for lines */
+    plus_t n_lines;		/* number of attached lines (size of
+				   lines, angle). If 0, then is
+				   degenerate node, for snappingi ???
+				*/
+    plus_t *lines;		/* list of connected lines */
+    float *angles;		/* respected angles; angles for
+				   lines/boundaries are in radians
+				   between -PI and PI. Value for
+				   points or lines with identical
+				   points (degenerated) is set to
+				   -9. */
 };
 };
 
 
+/*! \brief Line (topology) info */
 struct P_line
 struct P_line
 {
 {
     plus_t N1;			/* start node */
     plus_t N1;			/* start node */
     plus_t N2;			/* end node   */
     plus_t N2;			/* end node   */
-    plus_t left;		/* area/isle number to left, negative for isle  */
-    /* !!! area number for centroid, negative for   */
-    /* duplicate centroid                           */
-    plus_t right;		/* area/isle number to right, negative for isle */
-
-    double N;			/* Bounding Box */
+    plus_t left;		/* area/isle number to left, negative
+				   for isle area number for centroid,
+				   negative for duplicate centroid 
+				*/
+    plus_t right;		/* area/isle number to right, negative
+				 * for isle */
+
+    double N;			/* line bounding Box */
     double S;
     double S;
     double E;
     double E;
     double W;
     double W;
@@ -469,58 +490,62 @@ struct P_line
     double B;			/* bottom */
     double B;			/* bottom */
 
 
     off_t offset;		/* offset in coor file for line */
     off_t offset;		/* offset in coor file for line */
-    int type;
+    int type;                   /* line type */
 };
 };
 
 
+/*! \brief Area (topology) info */
 struct P_area
 struct P_area
 {
 {
-    double N;			/* Bounding Box */
+    double N;			/* area bounding Box */
     double S;
     double S;
     double E;
     double E;
     double W;
     double W;
     double T;			/* top */
     double T;			/* top */
     double B;			/* bottom */
     double B;			/* bottom */
-    plus_t n_lines;		/* Number of boundary lines */
-    plus_t alloc_lines;
-    plus_t *lines;		/* Boundary Lines, negative means direction N2 to N1,
-				   lines are in  clockwise order */
+    plus_t n_lines;		/* number of boundary lines */
+    plus_t alloc_lines;         /* allocated space */
+    plus_t *lines;		/* list of boundary lines, negative
+				   means direction N2 to N1, lines are
+				   in clockwise order */
 
 
     /*********  Above this line is compatible with P_isle **********/
     /*********  Above this line is compatible with P_isle **********/
+    plus_t centroid;		/* number of first centroid within area */
 
 
-    plus_t centroid;		/* Number of first centroid within area */
-
-    plus_t n_isles;		/* Number of islands inside */
+    plus_t n_isles;		/* number of islands inside */
     plus_t alloc_isles;
     plus_t alloc_isles;
     plus_t *isles;		/* 1st generation interior islands */
     plus_t *isles;		/* 1st generation interior islands */
 };
 };
 
 
+/*! \brief Isle (topology) info */
 struct P_isle
 struct P_isle
 {
 {
-    double N;			/* Bounding Box */
+    double N;			/* isle bounding Box */
     double S;
     double S;
     double E;
     double E;
     double W;
     double W;
     double T;			/* top */
     double T;			/* top */
     double B;			/* bottom */
     double B;			/* bottom */
-    plus_t n_lines;		/* Number of boundary lines */
+    plus_t n_lines;		/* number of boundary lines */
     plus_t alloc_lines;
     plus_t alloc_lines;
-    plus_t *lines;		/* Boundary Lines, negative means direction N2 to N1,
-				   lines are in counter clockwise order */
+    plus_t *lines;		/* list of boundary lines, negative
+				   means direction N2 to N1, lines are
+				   in counter clockwise order */
 
 
     /*********  Above this line is compatible with P_area **********/
     /*********  Above this line is compatible with P_area **********/
-
     plus_t area;		/* area it exists w/in, if any */
     plus_t area;		/* area it exists w/in, if any */
 };
 };
 
 
+/*! \brief Line points (feature geometry info */
 struct line_pnts
 struct line_pnts
 {
 {
-    double *x;
-    double *y;
-    double *z;
-    int n_points;
-    int alloc_points;
+    double *x;                  /* pointer to 1st x coordinate */
+    double *y;                  /* pointer to 1st y coordinate */
+    double *z;                  /* pointer to 1st z coordinate */
+    int n_points;               /* number of points */
+    int alloc_points;           /* allocated space */
 };
 };
 
 
+/*! \brief Line categories (feature category info */
 struct line_cats
 struct line_cats
 {
 {
     int *field;			/* pointer to array of fields */
     int *field;			/* pointer to array of fields */
@@ -529,6 +554,7 @@ struct line_cats
     int alloc_cats;		/* allocated space */
     int alloc_cats;		/* allocated space */
 };
 };
 
 
+/*! \brief Category list */
 struct cat_list
 struct cat_list
 {
 {
     int field;			/* category field */
     int field;			/* category field */
@@ -538,7 +564,10 @@ struct cat_list
     int alloc_ranges;		/* allocated space */
     int alloc_ranges;		/* allocated space */
 };
 };
 
 
-/* list of integers */
+/*! \brief List of integers
+
+  \todo To be moved to gislib?
+*/
 struct ilist
 struct ilist
 {
 {
     int *value;			/* items */
     int *value;			/* items */
@@ -546,24 +575,19 @@ struct ilist
     int alloc_values;		/* allocated space */
     int alloc_values;		/* allocated space */
 };
 };
 
 
-/* Vector array. Space allocated is size + 1. */
+/*! \brief Vector array. Space allocated is size + 1. */
 struct varray
 struct varray
 {
 {
     int size;			/* array size */
     int size;			/* array size */
-    int *c;			/* array where 'class' or new category or something like that is stored */
+    int *c;			/* array where 'class' or new category
+				   or something like that is stored */
 };
 };
 
 
-typedef struct varray VARRAY;
-
-/* Spatial index for use in modules. */
+/*! \brief Spatial index for use in modules. */
 struct spatial_index
 struct spatial_index
 {
 {
-    struct RTree *si_tree;
-    char *name;
+    struct RTree *si_tree;      /* pointer to the tree */
+    char *name;                 /* sidx name */
 };
 };
 
 
-typedef struct spatial_index SPATIAL_INDEX;
-
-typedef dglGraph_s GRAPH;	/* graph structure */
-
 #endif /* DIG___STRUCTS___ */
 #endif /* DIG___STRUCTS___ */

+ 34 - 33
include/vector.h

@@ -36,7 +36,7 @@ double Vect_line_geodesic_length(const struct line_pnts *);
 int Vect_line_distance(const struct line_pnts *, double, double, double, int,
 int Vect_line_distance(const struct line_pnts *, double, double, double, int,
 		       double *, double *, double *, double *, double *,
 		       double *, double *, double *, double *, double *,
 		       double *);
 		       double *);
-int Vect_line_box(const struct line_pnts *, BOUND_BOX *);
+int Vect_line_box(const struct line_pnts *, struct bound_box *);
 void Vect_line_parallel(struct line_pnts *, double, double, int,
 void Vect_line_parallel(struct line_pnts *, double, double, int,
 			struct line_pnts *);
 			struct line_pnts *);
 void Vect_line_parallel2(struct line_pnts *, double, double,
 void Vect_line_parallel2(struct line_pnts *, double, double,
@@ -78,13 +78,13 @@ int Vect_cat_in_cat_list(int, const struct cat_list *);
 int Vect_destroy_cat_list(struct cat_list *);
 int Vect_destroy_cat_list(struct cat_list *);
 
 
 /* Vector array */
 /* Vector array */
-VARRAY *Vect_new_varray(int);
+struct varray *Vect_new_varray(int);
 int Vect_set_varray_from_cat_string(const struct Map_info *, int, const char *, int,
 int Vect_set_varray_from_cat_string(const struct Map_info *, int, const char *, int,
-				    int, VARRAY *);
+				    int, struct varray *);
 int Vect_set_varray_from_cat_list(const struct Map_info *, int, struct cat_list *,
 int Vect_set_varray_from_cat_list(const struct Map_info *, int, struct cat_list *,
-				  int, int, VARRAY *);
+				  int, int, struct varray *);
 int Vect_set_varray_from_db(const struct Map_info *, int, const char *, int, int,
 int Vect_set_varray_from_db(const struct Map_info *, int, const char *, int, int,
-			    VARRAY *);
+			    struct varray *);
 
 
 /* DB connection - field info */
 /* DB connection - field info */
 struct dblinks *Vect_new_dblinks_struct(void);
 struct dblinks *Vect_new_dblinks_struct(void);
@@ -103,6 +103,7 @@ struct field_info *Vect_default_field_info(struct Map_info *, int,
 					   const char *, int);
 					   const char *, int);
 struct field_info *Vect_get_dblink(const struct Map_info *, int);
 struct field_info *Vect_get_dblink(const struct Map_info *, int);
 struct field_info *Vect_get_field(const struct Map_info *, int);
 struct field_info *Vect_get_field(const struct Map_info *, int);
+struct field_info *Vect_get_field_by_name(const struct Map_info *, const char *);
 void Vect_set_db_updated(struct Map_info *);
 void Vect_set_db_updated(struct Map_info *);
 const char *Vect_get_column_names(const struct Map_info *, int);
 const char *Vect_get_column_names(const struct Map_info *, int);
 const char *Vect_get_column_types(const struct Map_info *, int);
 const char *Vect_get_column_types(const struct Map_info *, int);
@@ -119,12 +120,12 @@ int Vect_reset_list(struct ilist *);
 int Vect_destroy_list(struct ilist *);
 int Vect_destroy_list(struct ilist *);
 
 
 /* Bounding box (MBR) */
 /* Bounding box (MBR) */
-int Vect_point_in_box(double, double, double, const BOUND_BOX *);
-int Vect_box_overlap(const BOUND_BOX *, const BOUND_BOX *);
-int Vect_box_copy(BOUND_BOX *, const BOUND_BOX *);
-int Vect_box_extend(BOUND_BOX *, const BOUND_BOX *);
-int Vect_box_clip(double *, double *, double *, double *, const BOUND_BOX *);
-int Vect_region_box(const struct Cell_head *, BOUND_BOX *);
+int Vect_point_in_box(double, double, double, const struct bound_box *);
+int Vect_box_overlap(const struct bound_box *, const struct bound_box *);
+int Vect_box_copy(struct bound_box *, const struct bound_box *);
+int Vect_box_extend(struct bound_box *, const struct bound_box *);
+int Vect_box_clip(double *, double *, double *, double *, const struct bound_box *);
+int Vect_region_box(const struct Cell_head *, struct bound_box *);
 
 
 /* Category index */
 /* Category index */
 int Vect_cidx_get_num_fields(const struct Map_info *);
 int Vect_cidx_get_num_fields(const struct Map_info *);
@@ -172,7 +173,7 @@ int Vect_get_proj(const struct Map_info *);
 const char *Vect_get_proj_name(const struct Map_info *);
 const char *Vect_get_proj_name(const struct Map_info *);
 int Vect_set_thresh(struct Map_info *, double);
 int Vect_set_thresh(struct Map_info *, double);
 double Vect_get_thresh(const struct Map_info *);
 double Vect_get_thresh(const struct Map_info *);
-int Vect_get_constraint_box(const struct Map_info *, BOUND_BOX *);
+int Vect_get_constraint_box(const struct Map_info *, struct bound_box *);
 
 
 
 
 /* Get map level 2 informations */
 /* Get map level 2 informations */
@@ -183,10 +184,10 @@ int Vect_get_num_lines(const struct Map_info *);
 int Vect_get_num_areas(const struct Map_info *);
 int Vect_get_num_areas(const struct Map_info *);
 int Vect_get_num_faces(const struct Map_info *);
 int Vect_get_num_faces(const struct Map_info *);
 int Vect_get_num_islands(const struct Map_info *);
 int Vect_get_num_islands(const struct Map_info *);
-int Vect_get_line_box(const struct Map_info *, int, BOUND_BOX *);
-int Vect_get_area_box(const struct Map_info *, int, BOUND_BOX *);
-int Vect_get_isle_box(const struct Map_info *, int, BOUND_BOX *);
-int Vect_get_map_box(const struct Map_info *, BOUND_BOX *);
+int Vect_get_line_box(const struct Map_info *, int, struct bound_box *);
+int Vect_get_area_box(const struct Map_info *, int, struct bound_box *);
+int Vect_get_isle_box(const struct Map_info *, int, struct bound_box *);
+int Vect_get_map_box(const struct Map_info *, struct bound_box *);
 int V__map_overlap(struct Map_info *, double, double, double, double);
 int V__map_overlap(struct Map_info *, double, double, double, double);
 void Vect_set_release_support(struct Map_info *);
 void Vect_set_release_support(struct Map_info *);
 void Vect_set_category_index_update(struct Map_info *);
 void Vect_set_category_index_update(struct Map_info *);
@@ -272,11 +273,11 @@ void Vect_hist_rewind(struct Map_info *);
 char *Vect_hist_read(char *, int, const struct Map_info *);
 char *Vect_hist_read(char *, int, const struct Map_info *);
 
 
 /* Selecting features */
 /* Selecting features */
-int Vect_select_lines_by_box(struct Map_info *, const BOUND_BOX *, int,
+int Vect_select_lines_by_box(struct Map_info *, const struct bound_box *, int,
 			     struct ilist *);
 			     struct ilist *);
-int Vect_select_areas_by_box(struct Map_info *, const BOUND_BOX *, struct ilist *);
-int Vect_select_isles_by_box(struct Map_info *, const BOUND_BOX *, struct ilist *);
-int Vect_select_nodes_by_box(struct Map_info *, const BOUND_BOX *, struct ilist *);
+int Vect_select_areas_by_box(struct Map_info *, const struct bound_box *, struct ilist *);
+int Vect_select_isles_by_box(struct Map_info *, const struct bound_box *, struct ilist *);
+int Vect_select_nodes_by_box(struct Map_info *, const struct bound_box *, struct ilist *);
 int Vect_find_node(struct Map_info *, double, double, double, double, int);
 int Vect_find_node(struct Map_info *, double, double, double, double, int);
 int Vect_find_line(struct Map_info *, double, double, double, int, double,
 int Vect_find_line(struct Map_info *, double, double, double, int, double,
 		   int, int);
 		   int, int);
@@ -338,11 +339,11 @@ int Vect_overlay_and(struct Map_info *, int, struct ilist *,
 		     struct ilist *, struct ilist *, struct Map_info *);
 		     struct ilist *, struct ilist *, struct Map_info *);
 
 
 /* Graph */
 /* Graph */
-void Vect_graph_init(GRAPH *, int);
-void Vect_graph_build(GRAPH *);
-void Vect_graph_add_edge(GRAPH *, int, int, double, int);
-void Vect_graph_set_node_costs(GRAPH *, int, double);
-int Vect_graph_shortest_path(GRAPH *, int, int, struct ilist *, double *);
+void Vect_graph_init(dglGraph_s *, int);
+void Vect_graph_build(dglGraph_s *);
+void Vect_graph_add_edge(dglGraph_s *, int, int, double, int);
+void Vect_graph_set_node_costs(dglGraph_s *, int, double);
+int Vect_graph_shortest_path(dglGraph_s *, int, int, struct ilist *, double *);
 
 
 /* Network (graph) */
 /* Network (graph) */
 int Vect_net_build_graph(struct Map_info *, int, int, int, const char *,
 int Vect_net_build_graph(struct Map_info *, int, int, int, const char *,
@@ -387,17 +388,17 @@ int Vect_line_get_intersections(struct line_pnts *, struct line_pnts *,
 char *Vect_subst_var(const char *, const struct Map_info *);
 char *Vect_subst_var(const char *, const struct Map_info *);
 
 
 /* Custom spatial index */
 /* Custom spatial index */
-void Vect_spatial_index_init(SPATIAL_INDEX *, int);
-void Vect_spatial_index_destroy(SPATIAL_INDEX *);
-void Vect_spatial_index_add_item(SPATIAL_INDEX *, int, const BOUND_BOX *);
-void Vect_spatial_index_del_item(SPATIAL_INDEX *, int, const BOUND_BOX *);
-int Vect_spatial_index_select(const SPATIAL_INDEX *, const BOUND_BOX *, struct ilist *);
+void Vect_spatial_index_init(struct spatial_index *, int);
+void Vect_spatial_index_destroy(struct spatial_index *);
+void Vect_spatial_index_add_item(struct spatial_index *, int, const struct bound_box *);
+void Vect_spatial_index_del_item(struct spatial_index *, int, const struct bound_box *);
+int Vect_spatial_index_select(const struct spatial_index *, const struct bound_box *, struct ilist *);
 
 
 /*
 /*
  * Internal functions, MUST NOT be used in modules
  * Internal functions, MUST NOT be used in modules
  */
  */
 int Vect_print_header(const struct Map_info *);
 int Vect_print_header(const struct Map_info *);
-int Vect__init_head(struct Map_info *);
+void Vect__init_head(struct Map_info *);
 
 
 /* Open/close/rewind map */
 /* Open/close/rewind map */
 int Vect_coor_info(const struct Map_info *, struct Coor_info *);
 int Vect_coor_info(const struct Map_info *, struct Coor_info *);
@@ -466,8 +467,8 @@ int Vect_build_ogr(struct Map_info *, int);
 int Vect_build_line_area(struct Map_info *, int, int);
 int Vect_build_line_area(struct Map_info *, int, int);
 int Vect_isle_find_area(struct Map_info *, int);
 int Vect_isle_find_area(struct Map_info *, int);
 int Vect_attach_isle(struct Map_info *, int);
 int Vect_attach_isle(struct Map_info *, int);
-int Vect_attach_isles(struct Map_info *, const BOUND_BOX *);
-int Vect_attach_centroids(struct Map_info *, const BOUND_BOX *);
+int Vect_attach_isles(struct Map_info *, const struct bound_box *);
+int Vect_attach_centroids(struct Map_info *, const struct bound_box *);
 
 
     /* GEOS support */
     /* GEOS support */
 #ifdef HAVE_GEOS
 #ifdef HAVE_GEOS

+ 1 - 1
lib/gis/Makefile

@@ -3,7 +3,7 @@ MODULE_TOPDIR = ../..
 LIB_NAME = $(GIS_LIBNAME)
 LIB_NAME = $(GIS_LIBNAME)
 
 
 EXTRA_LIBS = $(DATETIMELIB) $(PTHREADLIBPATH) $(PTHREADLIB) \
 EXTRA_LIBS = $(DATETIMELIB) $(PTHREADLIBPATH) $(PTHREADLIB) \
-	$(INTLLIB) $(MATHLIB) $(ZLIBLIBPATH) $(ZLIB)
+	$(INTLLIB) $(MATHLIB) $(ZLIBLIBPATH) $(ZLIB) $(GDALLIBS)
 EXTRA_INC = $(ZLIBINCPATH) $(PTHREADINCPATH)
 EXTRA_INC = $(ZLIBINCPATH) $(PTHREADINCPATH)
 
 
 DATASRC = ellipse.table datum.table datumtransform.table FIPS.code state27 state83 projections
 DATASRC = ellipse.table datum.table datumtransform.table FIPS.code state27 state83 projections

+ 2 - 1
lib/gis/find_file.c

@@ -16,6 +16,7 @@
 #include <string.h>
 #include <string.h>
 #include <unistd.h>
 #include <unistd.h>
 #include <grass/gis.h>
 #include <grass/gis.h>
+#include <grass/vect/dig_defines.h>
 #include <grass/glocale.h>
 #include <grass/glocale.h>
 
 
 static const char *find_file(
 static const char *find_file(
@@ -50,7 +51,7 @@ static const char *find_file(
      */
      */
     if (G_legal_filename(pname) == -1)
     if (G_legal_filename(pname) == -1)
 	return NULL;
 	return NULL;
-
+    
     if (pmapset && *pmapset && G_legal_filename(pmapset) == -1)
     if (pmapset && *pmapset && G_legal_filename(pmapset) == -1)
 	return NULL;
 	return NULL;
 
 

+ 96 - 58
lib/gis/find_vect.c

@@ -1,78 +1,116 @@
-/*
- **********************************************************************
- *  char *
- *  G_find_vector (name, mapset)
- *        char *name       file name to look for
- *        char *mapset     mapset to search. if mapset is ""
- *                         will search in mapset search list
- *
- *      searches for a vector map from the mapset search list
- *      or in a specified mapset.
- *      returns the mapset name where the vector map was found.
- *
- * NOTE: If the user specifies a fully qualified vector map which exists,
- *       then <i>G_find_vector()</i> modifies <b>name</b> by removing the
- *      "@<i>mapset</i>" part.
- *
- *  returns:
- *      char *  pointer to a string with name of mapset
- *              where vector map was found, or NULL if not found
- *  note:
- *      rejects all names that begin with .
- *
- *      if name is of the form nnn in ppp then 
- *      name = nnn and mapset = ppp
- **********************************************************************/
+/*!
+  \file gis/find_vect.c
+  
+  \brief GIS library - Find a vector map
+  
+  (C) 2001-2009 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 for details.
+
+  \author Original author CERL
+*/
+
+#include <string.h>
 
 
+#include <grass/config.h>
 #include <grass/gis.h>
 #include <grass/gis.h>
 #include <grass/vect/dig_defines.h>
 #include <grass/vect/dig_defines.h>
+#include <grass/glocale.h>
 
 
+#ifdef HAVE_OGR
+#include <ogr_api.h>
+#endif
 
 
-/* \brief searches for a vector map
- *
- *      searches for a vector map from the mapset search list
- *      or in a specified mapset.
- *      returns the mapset name where the vector map was found.
- *
- *  returns:
- *      char *  pointer to a string with name of mapset
- *              where vector map was found, or NULL if not found
- *  NOTES:
- *      If the user specifies a fully qualified vector map which exists,
- *      then <i>G_find_vector()</i> modifies <b>name</b> by removing the
- *      "@<i>mapset</i>" part.
- *
- *      Rejects all names that begin with "."
- *
- *      If name is of the form nnn in ppp then 
- *      name = nnn and mapset = ppp
- *
- *  \param name
- *  \param mapset
- *  \return char *
- *
- */
+static const char *find_ogr(const char *, const char *);
+
+/*!
+  \brief Finds a vector map
+ 
+  Searches for a vector map from the mapset search list or in a
+  specified mapset. Returns the mapset name where the vector map was
+  found.
+  
+  NOTES:
+  If the user specifies a fully qualified vector map which exists,
+  then G_find_vector() modifies <i>name</i> by removing the
+  "@<i>mapset</i>" part.
+ 
+  Rejects all names that begin with "."
+  
+  \param name vector map name
+  \param mapset mapset name or "" for search path
+
+  \return pointer to a string with name of mapset where vector map was found
+  \return NULL if not found
+*/
 const char *G_find_vector(char *name, const char *mapset)
 const char *G_find_vector(char *name, const char *mapset)
 {
 {
-    return G_find_file(GRASS_VECT_DIRECTORY, name, mapset);
+    return G_find_file(GV_DIRECTORY, name, mapset);
 }
 }
 
 
-
-
 /*!
 /*!
- * \brief find a vector map (look but don't touch)
+ * \brief Find a vector map (look but don't touch)
  *
  *
  * The same as G_find_vector() but doesn't remove the "@<i>mapset</i>"
  * The same as G_find_vector() but doesn't remove the "@<i>mapset</i>"
- * qualification from <b>name</b>, if present.
+ * qualification from <i>name</i>, if present.
  *
  *
  * Returns NULL if the map wasn't found, or the mapset the vector was
  * Returns NULL if the map wasn't found, or the mapset the vector was
  * found in if it was.
  * found in if it was.
  *
  *
- *  \param name
- *  \param mapset
- *  \return char *
+ * \param name vector map name
+ * \param mapset mapset name where to search
+ *
+ * \return pointer to buffer containing mapset name
+ * \return NULL when vector map not found
  */
  */
 const char *G_find_vector2(const char *name, const char *mapset)
 const char *G_find_vector2(const char *name, const char *mapset)
 {
 {
-    return G_find_file2(GRASS_VECT_DIRECTORY, name, mapset);
+    const char *ogr_mapset;
+
+    /* check OGR mapset first */
+    ogr_mapset = find_ogr(name, mapset);
+    if (ogr_mapset)
+	return ogr_mapset;
+    
+    return G_find_file2(GV_DIRECTORY, name, mapset);
+}
+
+const char *find_ogr(const char *name, const char *mapset)
+{
+    const char *pname, *pmapset;
+    char xname[GNAME_MAX], xmapset[GMAPSET_MAX];
+    
+    if(G__name_is_fully_qualified(name, xname, xmapset)) {
+	pname = xname;
+	pmapset = xmapset;
+    }
+    else {
+	pname = name;
+	pmapset = mapset;
+    }
+    
+    if(pmapset && strcmp(pmapset, "OGR") == 0) {
+	/* unique mapset "OGR", check OGR datasource instead */
+#ifdef HAVE_OGR
+	OGRDataSourceH Ogr_ds;
+	
+	G_debug(1, "OGR mapset detected");
+
+	OGRRegisterAll();
+
+	/* datasource handle */
+	Ogr_ds = OGROpen(pname, FALSE, NULL);
+	if (Ogr_ds == NULL)
+	    G_fatal_error(_("Unable to open OGR data source '%s'"),
+			  pname);
+	
+	return "OGR";
+#else
+	G_fatal_error(_("Unique OGR mapset detected, OGR support is missing"));
+#endif
+    }
+
+    /* OGR mapset not detected */
+    return NULL;
 }
 }

+ 21 - 24
lib/gis/legal_name.c

@@ -1,17 +1,14 @@
-
-/**
- * \file legal_name.c
+/*!
+ * \file gis/legal_name.c
  *
  *
  * \brief GIS Library - Functions to handle file name legality.
  * \brief GIS Library - Functions to handle file name legality.
  *
  *
- * (C) 2001-2008 by the GRASS Development Team
+ * (C) 2001-2009 by the GRASS Development Team
  *
  *
  * This program is free software under the GNU General Public License
  * This program is free software under the GNU General Public License
  * (>=v2). Read the file COPYING that comes with GRASS for details.
  * (>=v2). Read the file COPYING that comes with GRASS for details.
  *
  *
- * \author GRASS GIS Development Team
- *
- * \date 1999-2006
+ * \author Original author CERL
  */
  */
 
 
 #include <stdio.h>
 #include <stdio.h>
@@ -20,51 +17,51 @@
 #include <grass/glocale.h>
 #include <grass/glocale.h>
 
 
 
 
-/**
+/*!
  * \brief Check for legal database file name.
  * \brief Check for legal database file name.
  *
  *
- * Legal file names will <b>not</b> begin with '.' or NULL and must 
- * not contain the characters, ' ' (space), '/', '"'. '\'' (single 
+ * Legal file names will <b>not</b> begin with '.' or NULL and must
+ * not contain the characters, ' ' (space), '/', '"'. '\'' (single
  * quote), '@', ',', '=', '*', and all other non-alphanumeric
  * quote), '@', ',', '=', '*', and all other non-alphanumeric
  * characters within.
  * characters within.
  *
  *
- * \param[in] s file name to check
+ * \param s file name to check
+ *
  * \return 1 success
  * \return 1 success
  * \return -1 failure
  * \return -1 failure
  */
  */
-
 int G_legal_filename(const char *s)
 int G_legal_filename(const char *s)
 {
 {
+    const char *name = s;
+    
     if (*s == '.' || *s == 0) {
     if (*s == '.' || *s == 0) {
-	fprintf(stderr, _("Illegal filename.  Cannot be '.' or 'NULL'\n"));
+	G_warning(_("Illegal filename <%s>. Cannot be '.' or 'NULL'."), name);
 	return -1;
 	return -1;
     }
     }
 
 
     for (; *s; s++)
     for (; *s; s++)
 	if (*s == '/' || *s == '"' || *s == '\'' || *s <= ' ' ||
 	if (*s == '/' || *s == '"' || *s == '\'' || *s <= ' ' ||
 	    *s == '@' || *s == ',' || *s == '=' || *s == '*' || *s > 0176) {
 	    *s == '@' || *s == ',' || *s == '=' || *s == '*' || *s > 0176) {
-	    fprintf(stderr,
-		    _("Illegal filename. Character <%c> not allowed.\n"), *s);
+	    G_warning(_("Illegal filename <%s>. Character <%c> not allowed.\n"), name, *s);
 	    return -1;
 	    return -1;
 	}
 	}
-
+    
     return 1;
     return 1;
 }
 }
 
 
-
-/**
+/*!
  * \brief Check input and output file names.
  * \brief Check input and output file names.
  *
  *
- * Check: 1) output is legal map name, 2) if can find input map, and 3) 
- * if input was found in current mapset, check if input != output.
+ * Check: 1) output is legal map name, 2) if can find input map, and
+ * 3) if input was found in current mapset, check if input != output.
+ *
+ * \param input input map name
+ * \param output output map name
+ * \param error error type: GR_FATAL_EXIT, GR_FATAL_PRINT, GR_FATAL_RETURN
  *
  *
- * \param[in] input name
- * \param[out] output name
- * \param[in] error error type: GR_FATAL_EXIT, GR_FATAL_PRINT, GR_FATAL_RETURN
  * \return 0 OK
  * \return 0 OK
  * \return 1 error
  * \return 1 error
  */
  */
-
 int G_check_input_output_name(const char *input, const char *output,
 int G_check_input_output_name(const char *input, const char *output,
 			      int error)
 			      int error)
 {
 {

+ 1 - 1
lib/gis/open.c

@@ -229,7 +229,7 @@ FILE *G_fopen_old(const char *element, const char *name, const char *mapset)
 
 
     fd = G__open(element, name, mapset, 0);
     fd = G__open(element, name, mapset, 0);
     if (fd < 0)
     if (fd < 0)
-	return (FILE *) 0;
+	return (FILE *) NULL;
 
 
     return fdopen(fd, "r");
     return fdopen(fd, "r");
 }
 }

+ 7 - 13
lib/gis/zero.c

@@ -1,31 +1,25 @@
-
-/**
- * \file zero.c
+/*!
+ * \file gis/zero.c
  *
  *
  * \brief GIS Library - Zeroing functions.
  * \brief GIS Library - Zeroing functions.
  *
  *
- * (C) 2001-2008 by the GRASS Development Team
+ * (C) 2001-2009 by the GRASS Development Team
  *
  *
  * This program is free software under the GNU General Public License
  * This program is free software under the GNU General Public License
  * (>=v2). Read the file COPYING that comes with GRASS for details.
  * (>=v2). Read the file COPYING that comes with GRASS for details.
  *
  *
- * \author GRASS GIS Development Team
- *
- * \date 1999-2008
+ * \author Original author CERL
  */
  */
 
 
 #include <string.h>
 #include <string.h>
 #include <grass/gis.h>
 #include <grass/gis.h>
 
 
-
-/**
+/*!
  * \brief Zero out a buffer, <b>buf</b>, of length <b>i</b>.
  * \brief Zero out a buffer, <b>buf</b>, of length <b>i</b>.
  *
  *
- * \param[in,out] buf
- * \param[in] i number of bytes to be zeroed
- * \return
+ * \param[out] buf
+ * \param i number of bytes to be zeroed
  */
  */
-
 void G_zero(void *buf, int i)
 void G_zero(void *buf, int i)
 {
 {
     memset(buf, 0, i);
     memset(buf, 0, i);

+ 5 - 3
lib/nviz/nvizlib.dox

@@ -1,8 +1,6 @@
 /*! \page nvizlib GRASS Nviz Library
 /*! \page nvizlib GRASS Nviz Library
 
 
-by GRASS Development Team
-
-http://grass.osgeo.org
+by GRASS Development Team (http://grass.osgeo.org)
 
 
 \section nvizintro Introduction to Nviz Library
 \section nvizintro Introduction to Nviz Library
 
 
@@ -101,4 +99,8 @@ wxGUI Nviz extension and CLI-based Nviz module.
 
 
  - Nviz_new_render_window()
  - Nviz_new_render_window()
 
 
+\section authors Authors
+
+ Martin Landa <landa.martin gmail.com>
+
 */
 */

+ 11 - 11
lib/sites/sites.c

@@ -40,7 +40,7 @@ static int cleanse_string(char *);
 
 
 static int site_att_cmp(const void *pa, const void *pb)
 static int site_att_cmp(const void *pa, const void *pb)
 {
 {
-    const SITE_ATT *a = pa, *b = pb;
+    const struct site_att *a = pa, *b = pb;
 
 
     return a->cat - b->cat;
     return a->cat - b->cat;
 }
 }
@@ -57,7 +57,7 @@ int G_site_get(struct Map_info *Map, Site * s)
     int i, type, cat;
     int i, type, cat;
     static struct line_pnts *Points = NULL;
     static struct line_pnts *Points = NULL;
     static struct line_cats *Cats = NULL;
     static struct line_cats *Cats = NULL;
-    SITE_ATT *sa;
+    struct site_att *sa;
 
 
     if (Points == NULL)
     if (Points == NULL)
 	Points = Vect_new_line_struct();
 	Points = Vect_new_line_struct();
@@ -89,8 +89,8 @@ int G_site_get(struct Map_info *Map, Site * s)
 	/* find att */
 	/* find att */
 
 
 	if (Map->n_site_att > 0) {
 	if (Map->n_site_att > 0) {
-	    sa = (SITE_ATT *) bsearch((void *)&cat, (void *)Map->site_att,
-				      Map->n_site_att, sizeof(SITE_ATT),
+	    sa = (struct site_att *) bsearch((void *)&cat, (void *)Map->site_att,
+				      Map->n_site_att, sizeof(struct site_att),
 				      site_att_cmp);
 				      site_att_cmp);
 
 
 	    if (sa == NULL) {
 	    if (sa == NULL) {
@@ -283,7 +283,7 @@ struct Map_info *G_sites_open_old(const char *name, const char *mapset)
     struct Map_info *Map;
     struct Map_info *Map;
     struct field_info *fi;
     struct field_info *fi;
     int more, nrows, row, ncols, col, ndbl, nstr, adbl, astr, ctype;
     int more, nrows, row, ncols, col, ndbl, nstr, adbl, astr, ctype;
-    SITE_ATT *sa;
+    struct site_att *sa;
 
 
     dbDriver *driver;
     dbDriver *driver;
     dbString stmt;
     dbString stmt;
@@ -332,7 +332,7 @@ struct Map_info *G_sites_open_old(const char *name, const char *mapset)
     nrows = db_get_num_rows(&cursor);
     nrows = db_get_num_rows(&cursor);
     G_debug(1, "%d rows selected from vector attribute table", nrows);
     G_debug(1, "%d rows selected from vector attribute table", nrows);
 
 
-    Map->site_att = (SITE_ATT *) malloc(nrows * sizeof(SITE_ATT));
+    Map->site_att = (struct site_att *) malloc(nrows * sizeof(struct site_att));
     Map->n_site_att = nrows;
     Map->n_site_att = nrows;
 
 
     table = db_get_cursor_table(&cursor);
     table = db_get_cursor_table(&cursor);
@@ -411,7 +411,7 @@ struct Map_info *G_sites_open_old(const char *name, const char *mapset)
     db_close_database_shutdown_driver(driver);
     db_close_database_shutdown_driver(driver);
 
 
     /* sort attributes */
     /* sort attributes */
-    qsort((void *)Map->site_att, Map->n_site_att, sizeof(SITE_ATT),
+    qsort((void *)Map->site_att, Map->n_site_att, sizeof(struct site_att),
 	  site_att_cmp);
 	  site_att_cmp);
 
 
     return Map;
     return Map;
@@ -1149,12 +1149,12 @@ char *G_site_format(const Site * s, const char *fs, int id)
  */
  */
 
 
 /*
 /*
-   Returns a pointer to the SITE_ATT in Map_info *ptr and with category cat
+   Returns a pointer to the struct site_att in Map_info *ptr and with category cat
  */
  */
-SITE_ATT *G_sites_get_atts(struct Map_info * Map, int *cat)
+struct site_att *G_sites_get_atts(struct Map_info * Map, int *cat)
 {
 {
-    return (SITE_ATT *) bsearch((void *)cat, (void *)Map->site_att,
-				Map->n_site_att, sizeof(SITE_ATT),
+    return (struct site_att *) bsearch((void *)cat, (void *)Map->site_att,
+				Map->n_site_att, sizeof(struct site_att),
 				site_att_cmp);
 				site_att_cmp);
 }
 }
 
 

+ 10 - 10
lib/vector/Vlib/area.c

@@ -38,7 +38,7 @@ Vect_get_area_points(const struct Map_info *Map,
 {
 {
     int i, line, aline, dir;
     int i, line, aline, dir;
     const struct Plus_head *Plus;
     const struct Plus_head *Plus;
-    P_AREA *Area;
+    struct P_area *Area;
     static int first_time = 1;
     static int first_time = 1;
     static struct line_pnts *Points;
     static struct line_pnts *Points;
 
 
@@ -100,7 +100,7 @@ Vect_get_isle_points(const struct Map_info *Map,
 {
 {
     int i, line, aline, dir;
     int i, line, aline, dir;
     const struct Plus_head *Plus;
     const struct Plus_head *Plus;
-    P_ISLE *Isle;
+    struct P_isle *Isle;
     static int first_time = 1;
     static int first_time = 1;
     static struct line_pnts *Points;
     static struct line_pnts *Points;
 
 
@@ -153,7 +153,7 @@ Vect_get_isle_points(const struct Map_info *Map,
 int Vect_get_area_centroid(const struct Map_info *Map, int area)
 int Vect_get_area_centroid(const struct Map_info *Map, int area)
 {
 {
     const struct Plus_head *Plus;
     const struct Plus_head *Plus;
-    P_AREA *Area;
+    struct P_area *Area;
 
 
     G_debug(3, "Vect_get_area_centroid(): area = %d", area);
     G_debug(3, "Vect_get_area_centroid(): area = %d", area);
 
 
@@ -180,7 +180,7 @@ Vect_get_area_boundaries(const struct Map_info *Map, int area, struct ilist *Lis
 {
 {
     int i, line;
     int i, line;
     const struct Plus_head *Plus;
     const struct Plus_head *Plus;
-    P_AREA *Area;
+    struct P_area *Area;
 
 
     G_debug(3, "Vect_get_area_boundaries(): area = %d", area);
     G_debug(3, "Vect_get_area_boundaries(): area = %d", area);
 
 
@@ -214,7 +214,7 @@ Vect_get_isle_boundaries(const struct Map_info *Map, int isle, struct ilist *Lis
 {
 {
     int i, line;
     int i, line;
     const struct Plus_head *Plus;
     const struct Plus_head *Plus;
-    P_ISLE *Isle;
+    struct P_isle *Isle;
 
 
     G_debug(3, "Vect_get_isle_boundaries(): isle = %d", isle);
     G_debug(3, "Vect_get_isle_boundaries(): isle = %d", isle);
 
 
@@ -246,7 +246,7 @@ Vect_get_isle_boundaries(const struct Map_info *Map, int isle, struct ilist *Lis
 int Vect_get_area_num_isles(const struct Map_info *Map, int area)
 int Vect_get_area_num_isles(const struct Map_info *Map, int area)
 {
 {
     const struct Plus_head *Plus;
     const struct Plus_head *Plus;
-    P_AREA *Area;
+    struct P_area *Area;
 
 
     G_debug(3, "Vect_get_area_num_isles(): area = %d", area);
     G_debug(3, "Vect_get_area_num_isles(): area = %d", area);
 
 
@@ -275,7 +275,7 @@ int Vect_get_area_num_isles(const struct Map_info *Map, int area)
 int Vect_get_area_isle(const struct Map_info *Map, int area, int isle)
 int Vect_get_area_isle(const struct Map_info *Map, int area, int isle)
 {
 {
     const struct Plus_head *Plus;
     const struct Plus_head *Plus;
-    P_AREA *Area;
+    struct P_area *Area;
 
 
     G_debug(3, "Vect_get_area_isle(): area = %d isle = %d", area, isle);
     G_debug(3, "Vect_get_area_isle(): area = %d isle = %d", area, isle);
 
 
@@ -302,7 +302,7 @@ int Vect_get_area_isle(const struct Map_info *Map, int area, int isle)
 int Vect_get_isle_area(const struct Map_info *Map, int isle)
 int Vect_get_isle_area(const struct Map_info *Map, int isle)
 {
 {
     const struct Plus_head *Plus;
     const struct Plus_head *Plus;
-    P_ISLE *Isle;
+    struct P_isle *Isle;
 
 
     G_debug(3, "Vect_get_isle_area(): isle = %d", isle);
     G_debug(3, "Vect_get_isle_area(): isle = %d", isle);
 
 
@@ -345,7 +345,7 @@ int Vect_point_in_area(const struct Map_info *Map, int area, double x, double y)
 {
 {
     int i, isle;
     int i, isle;
     const struct Plus_head *Plus;
     const struct Plus_head *Plus;
-    P_AREA *Area;
+    struct P_area *Area;
     int poly;
     int poly;
 
 
     Plus = &(Map->plus);
     Plus = &(Map->plus);
@@ -379,7 +379,7 @@ int Vect_point_in_area(const struct Map_info *Map, int area, double x, double y)
 double Vect_get_area_area(const struct Map_info *Map, int area)
 double Vect_get_area_area(const struct Map_info *Map, int area)
 {
 {
     const struct Plus_head *Plus;
     const struct Plus_head *Plus;
-    P_AREA *Area;
+    struct P_area *Area;
     struct line_pnts *Points;
     struct line_pnts *Points;
     double size;
     double size;
     int i;
     int i;

+ 8 - 8
lib/vector/Vlib/array.c

@@ -29,22 +29,22 @@ static int in_array(int *cats, size_t ncats, int cat);
 
 
 
 
 /*!
 /*!
-   \brief Create new VARRAY and allocate space for given number of items.
+   \brief Create new struct varray and allocate space for given number of items.
 
 
    Space allocated is 'size + 1' so that lines are accessed by line id.
    Space allocated is 'size + 1' so that lines are accessed by line id.
    Array values are set to 0.
    Array values are set to 0.
 
 
    \param size size of array
    \param size size of array
 
 
-   \return pointer to new VARRAY
+   \return pointer to new struct varray
    \return NULL if failed
    \return NULL if failed
  */
  */
 
 
-VARRAY *Vect_new_varray(int size)
+struct varray *Vect_new_varray(int size)
 {
 {
-    VARRAY *p;
+    struct varray *p;
 
 
-    p = (VARRAY *) G_malloc(sizeof(VARRAY));
+    p = (struct varray *) G_malloc(sizeof(struct varray));
 
 
     if (p == NULL)
     if (p == NULL)
 	return NULL;
 	return NULL;
@@ -83,7 +83,7 @@ VARRAY *Vect_new_varray(int size)
 int
 int
 Vect_set_varray_from_cat_string(const struct Map_info *Map, int field,
 Vect_set_varray_from_cat_string(const struct Map_info *Map, int field,
 				const char *cstring, int type, int value,
 				const char *cstring, int type, int value,
-				VARRAY * varray)
+				struct varray * varray)
 {
 {
     int ret;
     int ret;
     struct cat_list *Clist;
     struct cat_list *Clist;
@@ -130,7 +130,7 @@ Vect_set_varray_from_cat_string(const struct Map_info *Map, int field,
 int
 int
 Vect_set_varray_from_cat_list(const struct Map_info *Map, int field,
 Vect_set_varray_from_cat_list(const struct Map_info *Map, int field,
 			      struct cat_list *clist, int type, int value,
 			      struct cat_list *clist, int type, int value,
-			      VARRAY * varray)
+			      struct varray * varray)
 {
 {
     int i, n, centr, cat;
     int i, n, centr, cat;
     int ni = 0;			/* number of items set */
     int ni = 0;			/* number of items set */
@@ -249,7 +249,7 @@ static int in_array(int *cats, size_t ncats, int cat)
  */
  */
 int
 int
 Vect_set_varray_from_db(const struct Map_info *Map, int field, const char *where,
 Vect_set_varray_from_db(const struct Map_info *Map, int field, const char *where,
-			int type, int value, VARRAY * varray)
+			int type, int value, struct varray * varray)
 {
 {
     int i, n, c, centr, cat, *cats;
     int i, n, c, centr, cat, *cats;
     int ncats;
     int ncats;

+ 13 - 13
lib/vector/Vlib/box.c

@@ -29,7 +29,7 @@
    \return 1 point is in box
    \return 1 point is in box
    \return 0 point is not in box
    \return 0 point is not in box
  */
  */
-int Vect_point_in_box(double x, double y, double z, const BOUND_BOX * Box)
+int Vect_point_in_box(double x, double y, double z, const struct bound_box * Box)
 {
 {
 
 
     if (x >= Box->W && x <= Box->E &&
     if (x >= Box->W && x <= Box->E &&
@@ -49,7 +49,7 @@ int Vect_point_in_box(double x, double y, double z, const BOUND_BOX * Box)
    \return 1 boxes overlap
    \return 1 boxes overlap
    \return 0 boxes do not overlap
    \return 0 boxes do not overlap
  */
  */
-int Vect_box_overlap(const BOUND_BOX * A, const BOUND_BOX * B)
+int Vect_box_overlap(const struct bound_box * A, const struct bound_box * B)
 {
 {
 
 
     if (A->E < B->W || A->W > B->E ||
     if (A->E < B->W || A->W > B->E ||
@@ -68,7 +68,7 @@ int Vect_box_overlap(const BOUND_BOX * A, const BOUND_BOX * B)
 
 
    \return 1
    \return 1
  */
  */
-int Vect_box_copy(BOUND_BOX * A, const BOUND_BOX * B)
+int Vect_box_copy(struct bound_box * A, const struct bound_box * B)
 {
 {
 
 
     A->N = B->N;
     A->N = B->N;
@@ -89,7 +89,7 @@ int Vect_box_copy(BOUND_BOX * A, const BOUND_BOX * B)
 
 
    \return 1
    \return 1
  */
  */
-int Vect_box_extend(BOUND_BOX * A, const BOUND_BOX * B)
+int Vect_box_extend(struct bound_box * A, const struct bound_box * B)
 {
 {
 
 
     if (B->N > A->N)
     if (B->N > A->N)
@@ -134,7 +134,7 @@ int Vect_box_extend(BOUND_BOX * A, const BOUND_BOX * B)
  */
  */
 
 
 int
 int
-Vect_box_clip(double *x, double *y, double *c_x, double *c_y, const BOUND_BOX * Box)
+Vect_box_clip(double *x, double *y, double *c_x, double *c_y, const struct bound_box * Box)
 {
 {
     int mod;
     int mod;
 
 
@@ -204,10 +204,10 @@ Vect_box_clip(double *x, double *y, double *c_x, double *c_y, const BOUND_BOX *
    \return 1 on success
    \return 1 on success
    \return 0 line is dead
    \return 0 line is dead
  */
  */
-int Vect_get_line_box(const struct Map_info *Map, int line, BOUND_BOX * Box)
+int Vect_get_line_box(const struct Map_info *Map, int line, struct bound_box * Box)
 {
 {
     const struct Plus_head *Plus;
     const struct Plus_head *Plus;
-    P_LINE *Line;
+    struct P_line *Line;
 
 
     Plus = &(Map->plus);
     Plus = &(Map->plus);
     Line = Plus->Line[line];
     Line = Plus->Line[line];
@@ -243,10 +243,10 @@ int Vect_get_line_box(const struct Map_info *Map, int line, BOUND_BOX * Box)
    \return 1 on success
    \return 1 on success
    \return 0 area is dead
    \return 0 area is dead
  */
  */
-int Vect_get_area_box(const struct Map_info *Map, int area, BOUND_BOX * Box)
+int Vect_get_area_box(const struct Map_info *Map, int area, struct bound_box * Box)
 {
 {
     const struct Plus_head *Plus;
     const struct Plus_head *Plus;
-    P_AREA *Area;
+    struct P_area *Area;
 
 
     Plus = &(Map->plus);
     Plus = &(Map->plus);
     Area = Plus->Area[area];
     Area = Plus->Area[area];
@@ -282,10 +282,10 @@ int Vect_get_area_box(const struct Map_info *Map, int area, BOUND_BOX * Box)
    \return 1 on success
    \return 1 on success
    \return 0 isle is dead
    \return 0 isle is dead
  */
  */
-int Vect_get_isle_box(const struct Map_info *Map, int isle, BOUND_BOX * Box)
+int Vect_get_isle_box(const struct Map_info *Map, int isle, struct bound_box * Box)
 {
 {
     const struct Plus_head *Plus;
     const struct Plus_head *Plus;
-    P_ISLE *Isle;
+    struct P_isle *Isle;
 
 
     Plus = &(Map->plus);
     Plus = &(Map->plus);
     Isle = Plus->Isle[isle];
     Isle = Plus->Isle[isle];
@@ -320,7 +320,7 @@ int Vect_get_isle_box(const struct Map_info *Map, int isle, BOUND_BOX * Box)
    \return 1 on success
    \return 1 on success
    \return 0 on error
    \return 0 on error
  */
  */
-int Vect_get_map_box(const struct Map_info *Map, BOUND_BOX * Box)
+int Vect_get_map_box(const struct Map_info *Map, struct bound_box * Box)
 {
 {
     const struct Plus_head *Plus;
     const struct Plus_head *Plus;
 
 
@@ -346,7 +346,7 @@ int Vect_get_map_box(const struct Map_info *Map, BOUND_BOX * Box)
    \return 1 on success
    \return 1 on success
    \return 0 on error
    \return 0 on error
  */
  */
-int Vect_region_box(const struct Cell_head *Window, BOUND_BOX * Box)
+int Vect_region_box(const struct Cell_head *Window, struct bound_box * Box)
 {
 {
 
 
     Box->N = Window->north;
     Box->N = Window->north;

+ 1 - 1
lib/vector/Vlib/break_lines.c

@@ -71,7 +71,7 @@ Vect_break_lines_list(struct Map_info *Map, struct ilist *List_break,
     int j, k, l, ret, atype, btype, aline, bline, found, iline, nlines;
     int j, k, l, ret, atype, btype, aline, bline, found, iline, nlines;
     int naxlines, nbxlines, nx;
     int naxlines, nbxlines, nx;
     double *xx = NULL, *yx = NULL, *zx = NULL;
     double *xx = NULL, *yx = NULL, *zx = NULL;
-    BOUND_BOX ABox, BBox;
+    struct bound_box ABox, BBox;
     struct ilist *List;
     struct ilist *List;
     int nbreaks;
     int nbreaks;
     int touch1_n = 0, touch1_s = 0, touch1_e = 0, touch1_w = 0;	/* other vertices except node1 touching box */
     int touch1_n = 0, touch1_s = 0, touch1_e = 0, touch1_w = 0;	/* other vertices except node1 touching box */

+ 14 - 14
lib/vector/Vlib/build.c

@@ -171,7 +171,7 @@ int Vect_build_partial(struct Map_info *Map, int build)
     if (plus->built >= GV_BUILD_AREAS) {
     if (plus->built >= GV_BUILD_AREAS) {
 	int line, nlines, area, nareas, err_boundaries, err_centr_out,
 	int line, nlines, area, nareas, err_boundaries, err_centr_out,
 	    err_centr_dupl, err_nocentr;
 	    err_centr_dupl, err_nocentr;
-	P_LINE *Line;
+	struct P_line *Line;
 	struct Plus_head *Plus;
 	struct Plus_head *Plus;
 
 
 	/* Count errors (it does not take much time comparing to build process) */
 	/* Count errors (it does not take much time comparing to build process) */
@@ -243,14 +243,14 @@ int Vect_save_topo(struct Map_info *Map)
 {
 {
     struct Plus_head *plus;
     struct Plus_head *plus;
     char fname[GPATH_MAX], buf[GPATH_MAX];
     char fname[GPATH_MAX], buf[GPATH_MAX];
-    GVFILE fp;
+    struct gvfile fp;
 
 
     G_debug(1, "Vect_save_topo()");
     G_debug(1, "Vect_save_topo()");
 
 
     plus = &(Map->plus);
     plus = &(Map->plus);
 
 
     /*  write out all the accumulated info to the plus file  */
     /*  write out all the accumulated info to the plus file  */
-    sprintf(buf, "%s/%s", GRASS_VECT_DIRECTORY, Map->name);
+    sprintf(buf, "%s/%s", GV_DIRECTORY, Map->name);
     G__file_name(fname, buf, GV_TOPO_ELEMENT, Map->mapset);
     G__file_name(fname, buf, GV_TOPO_ELEMENT, Map->mapset);
     G_debug(1, "Open topo: %s", fname);
     G_debug(1, "Open topo: %s", fname);
     dig_file_init(&fp);
     dig_file_init(&fp);
@@ -285,11 +285,11 @@ int Vect_save_topo(struct Map_info *Map)
 int Vect_topo_dump(const struct Map_info *Map, FILE * out)
 int Vect_topo_dump(const struct Map_info *Map, FILE * out)
 {
 {
     int i, j, line, isle;
     int i, j, line, isle;
-    P_NODE *Node;
-    P_LINE *Line;
-    P_AREA *Area;
-    P_ISLE *Isle;
-    BOUND_BOX box;
+    struct P_node *Node;
+    struct P_line *Line;
+    struct P_area *Area;
+    struct P_isle *Isle;
+    struct bound_box box;
     const struct Plus_head *plus;
     const struct Plus_head *plus;
 
 
     plus = &(Map->plus);
     plus = &(Map->plus);
@@ -417,11 +417,11 @@ int Vect_build_sidx_from_topo(struct Map_info *Map)
 {
 {
     int i, total, done;
     int i, total, done;
     struct Plus_head *plus;
     struct Plus_head *plus;
-    BOUND_BOX box;
-    P_LINE *Line;
-    P_NODE *Node;
-    P_AREA *Area;
-    P_ISLE *Isle;
+    struct bound_box box;
+    struct P_line *Line;
+    struct P_node *Node;
+    struct P_area *Area;
+    struct P_isle *Isle;
 
 
     G_debug(3, "Vect_build_sidx_from_topo()");
     G_debug(3, "Vect_build_sidx_from_topo()");
 
 
@@ -532,7 +532,7 @@ int Vect_save_sidx(struct Map_info *Map)
     if (Map->plus.Spidx_new == 1) {
     if (Map->plus.Spidx_new == 1) {
 
 
 	/*  write out rtrees to sidx file  */
 	/*  write out rtrees to sidx file  */
-	sprintf(buf, "%s/%s", GRASS_VECT_DIRECTORY, Map->name);
+	sprintf(buf, "%s/%s", GV_DIRECTORY, Map->name);
 	G__file_name(fname, buf, GV_SIDX_ELEMENT, Map->mapset);
 	G__file_name(fname, buf, GV_SIDX_ELEMENT, Map->mapset);
 	G_debug(1, "Open sidx: %s", fname);
 	G_debug(1, "Open sidx: %s", fname);
 	dig_file_init(&(Map->plus.spidx_fp));
 	dig_file_init(&(Map->plus.spidx_fp));

+ 14 - 14
lib/vector/Vlib/build_nat.c

@@ -40,7 +40,7 @@ int Vect_build_line_area(struct Map_info *Map, int iline, int side)
     static int first = 1;
     static int first = 1;
     off_t offset;
     off_t offset;
     struct Plus_head *plus;
     struct Plus_head *plus;
-    P_LINE *BLine;
+    struct P_line *BLine;
     static struct line_pnts *Points, *APoints;
     static struct line_pnts *Points, *APoints;
     plus_t *lines;
     plus_t *lines;
     double area_size;
     double area_size;
@@ -135,12 +135,12 @@ int Vect_isle_find_area(struct Map_info *Map, int isle)
     int j, line, node, sel_area, first, area, poly;
     int j, line, node, sel_area, first, area, poly;
     static int first_call = 1;
     static int first_call = 1;
     const struct Plus_head *plus;
     const struct Plus_head *plus;
-    P_LINE *Line;
-    P_NODE *Node;
-    P_ISLE *Isle;
-    P_AREA *Area;
+    struct P_line *Line;
+    struct P_node *Node;
+    struct P_isle *Isle;
+    struct P_area *Area;
     double size, cur_size;
     double size, cur_size;
-    BOUND_BOX box, abox;
+    struct bound_box box, abox;
     static struct ilist *List;
     static struct ilist *List;
     static struct line_pnts *APoints;
     static struct line_pnts *APoints;
 
 
@@ -269,7 +269,7 @@ int Vect_isle_find_area(struct Map_info *Map, int isle)
 int Vect_attach_isle(struct Map_info *Map, int isle)
 int Vect_attach_isle(struct Map_info *Map, int isle)
 {
 {
     int sel_area;
     int sel_area;
-    P_ISLE *Isle;
+    struct P_isle *Isle;
     struct Plus_head *plus;
     struct Plus_head *plus;
 
 
     /* Note!: If topology is not clean and areas overlap, one island may fall to more areas
     /* Note!: If topology is not clean and areas overlap, one island may fall to more areas
@@ -303,7 +303,7 @@ int Vect_attach_isle(struct Map_info *Map, int isle)
 
 
    \return 0
    \return 0
  */
  */
-int Vect_attach_isles(struct Map_info *Map, const BOUND_BOX * box)
+int Vect_attach_isles(struct Map_info *Map, const struct bound_box * box)
 {
 {
     int i, isle;
     int i, isle;
     static int first = 1;
     static int first = 1;
@@ -337,13 +337,13 @@ int Vect_attach_isles(struct Map_info *Map, const BOUND_BOX * box)
 
 
    \return 0
    \return 0
  */
  */
-int Vect_attach_centroids(struct Map_info *Map, const BOUND_BOX * box)
+int Vect_attach_centroids(struct Map_info *Map, const struct bound_box * box)
 {
 {
     int i, sel_area, centr;
     int i, sel_area, centr;
     static int first = 1;
     static int first = 1;
     static struct ilist *List;
     static struct ilist *List;
-    P_AREA *Area;
-    P_LINE *Line;
+    struct P_area *Area;
+    struct P_line *Line;
     struct Plus_head *plus;
     struct Plus_head *plus;
 
 
     G_debug(3, "Vect_attach_centroids ()");
     G_debug(3, "Vect_attach_centroids ()");
@@ -443,9 +443,9 @@ int Vect_build_nat(struct Map_info *Map, int build)
     int side, line, area;
     int side, line, area;
     struct line_pnts *Points, *APoints;
     struct line_pnts *Points, *APoints;
     struct line_cats *Cats;
     struct line_cats *Cats;
-    P_LINE *Line;
-    P_AREA *Area;
-    BOUND_BOX box;
+    struct P_line *Line;
+    struct P_area *Area;
+    struct bound_box box;
     struct ilist *List;
     struct ilist *List;
 
 
     G_debug(3, "Vect_build_nat() build = %d", build);
     G_debug(3, "Vect_build_nat() build = %d", build);

+ 5 - 5
lib/vector/Vlib/build_ogr.c

@@ -113,7 +113,7 @@ static int add_line(struct Map_info *Map, int type, struct line_pnts *Points,
     int line;
     int line;
     struct Plus_head *plus;
     struct Plus_head *plus;
     long offset;
     long offset;
-    BOUND_BOX box;
+    struct bound_box box;
 
 
     plus = &(Map->plus);
     plus = &(Map->plus);
 
 
@@ -159,8 +159,8 @@ static int add_geometry(struct Map_info *Map, OGRGeometryH hGeom, int FID,
     int lines[1];
     int lines[1];
     static struct line_pnts **Points = NULL;
     static struct line_pnts **Points = NULL;
     static int alloc_points = 0;
     static int alloc_points = 0;
-    BOUND_BOX box;
-    P_LINE *Line;
+    struct bound_box box;
+    struct P_line *Line;
     double area_size, x, y;
     double area_size, x, y;
     int eType, nRings, iPart, nParts, nPoints;
     int eType, nRings, iPart, nParts, nPoints;
     OGRGeometryH hGeom2, hRing;
     OGRGeometryH hGeom2, hRing;
@@ -254,7 +254,7 @@ static int add_geometry(struct Map_info *Map, OGRGeometryH hGeom, int FID,
 		outer_area = area;
 		outer_area = area;
 	    }
 	    }
 	    else {		/* inner ring */
 	    else {		/* inner ring */
-		P_ISLE *Isle;
+		struct P_isle *Isle;
 
 
 		Isle = plus->Isle[isle];
 		Isle = plus->Isle[isle];
 		Isle->area = outer_area;
 		Isle->area = outer_area;
@@ -273,7 +273,7 @@ static int add_geometry(struct Map_info *Map, OGRGeometryH hGeom, int FID,
 		      outer_area);
 		      outer_area);
 	}
 	}
 	else {
 	else {
-	    P_AREA *Area;
+	    struct P_area *Area;
 
 
 	    G_debug(4, "  Centroid: %f, %f", x, y);
 	    G_debug(4, "  Centroid: %f, %f", x, y);
 	    Vect_reset_line(Points[0]);
 	    Vect_reset_line(Points[0]);

+ 6 - 6
lib/vector/Vlib/cindex.c

@@ -444,14 +444,14 @@ int Vect_cidx_save(struct Map_info *Map)
 {
 {
     struct Plus_head *plus;
     struct Plus_head *plus;
     char fname[1024], buf[1024];
     char fname[1024], buf[1024];
-    GVFILE fp;
+    struct gvfile fp;
 
 
     G_debug(2, "Vect_cidx_save()");
     G_debug(2, "Vect_cidx_save()");
     check_status(Map);
     check_status(Map);
 
 
     plus = &(Map->plus);
     plus = &(Map->plus);
 
 
-    sprintf(buf, "%s/%s", GRASS_VECT_DIRECTORY, Map->name);
+    sprintf(buf, "%s/%s", GV_DIRECTORY, Map->name);
     G__file_name(fname, buf, GV_CIDX_ELEMENT, Map->mapset);
     G__file_name(fname, buf, GV_CIDX_ELEMENT, Map->mapset);
     G_debug(2, "Open cidx: %s", fname);
     G_debug(2, "Open cidx: %s", fname);
     dig_file_init(&fp);
     dig_file_init(&fp);
@@ -477,8 +477,8 @@ int Vect_cidx_save(struct Map_info *Map)
 /*!
 /*!
    \brief Read category index from file if exists
    \brief Read category index from file if exists
 
 
-   \param Map vector map
-   \param head_only Read only header
+   \param Map pointer to Map_info structure
+   \param head_only read only header
 
 
    \return 0 on success 
    \return 0 on success 
    \return 1 if file does not exist
    \return 1 if file does not exist
@@ -488,7 +488,7 @@ int Vect_cidx_open(struct Map_info *Map, int head_only)
 {
 {
     int ret;
     int ret;
     char buf[500], file_path[2000];
     char buf[500], file_path[2000];
-    GVFILE fp;
+    struct gvfile fp;
     struct Plus_head *Plus;
     struct Plus_head *Plus;
     struct stat info;
     struct stat info;
 
 
@@ -497,7 +497,7 @@ int Vect_cidx_open(struct Map_info *Map, int head_only)
 
 
     Plus = &(Map->plus);
     Plus = &(Map->plus);
 
 
-    sprintf(buf, "%s/%s", GRASS_VECT_DIRECTORY, Map->name);
+    sprintf(buf, "%s/%s", GV_DIRECTORY, Map->name);
     G__file_name(file_path, buf, GV_CIDX_ELEMENT, Map->mapset);
     G__file_name(file_path, buf, GV_CIDX_ELEMENT, Map->mapset);
 
 
     if (stat(file_path, &info) != 0)	/* does not exist */
     if (stat(file_path, &info) != 0)	/* does not exist */

+ 1 - 1
lib/vector/Vlib/clean_nodes.c

@@ -66,7 +66,7 @@ Vect_clean_small_angles_at_nodes(struct Map_info *Map, int otype,
 	    G_debug(3, "nlines = %d", nlines);
 	    G_debug(3, "nlines = %d", nlines);
 
 
 	    for (i = 0; i < nlines; i++) {
 	    for (i = 0; i < nlines; i++) {
-		P_LINE *Line;
+		struct P_line *Line;
 		int line2;
 		int line2;
 		float angle2;
 		float angle2;
 
 

+ 1 - 1
lib/vector/Vlib/close.c

@@ -74,7 +74,7 @@ int Vect_close(struct Map_info *Map)
 	struct stat info;
 	struct stat info;
 
 
 	/* Delete old support files if available */
 	/* Delete old support files if available */
-	sprintf(buf, "%s/%s", GRASS_VECT_DIRECTORY, Map->name);
+	sprintf(buf, "%s/%s", GV_DIRECTORY, Map->name);
 
 
 	G__file_name(file_path, buf, GV_TOPO_ELEMENT, G_mapset());
 	G__file_name(file_path, buf, GV_TOPO_ELEMENT, G_mapset());
 	if (stat(file_path, &info) == 0)	/* file exists? */
 	if (stat(file_path, &info) == 0)	/* file exists? */

+ 2 - 2
lib/vector/Vlib/close_ogr.c

@@ -71,7 +71,7 @@ int V2_close_ogr(struct Map_info *Map)
     char fname[1000], elem[1000];
     char fname[1000], elem[1000];
     char buf[5];
     char buf[5];
     long length = 9;
     long length = 9;
-    GVFILE fp;
+    struct gvfile fp;
     struct Port_info port;
     struct Port_info port;
 
 
     G_debug(3, "V2_close_ogr()");
     G_debug(3, "V2_close_ogr()");
@@ -81,7 +81,7 @@ int V2_close_ogr(struct Map_info *Map)
 
 
     if (strcmp(Map->mapset, G_mapset()) == 0 && Map->support_updated &&
     if (strcmp(Map->mapset, G_mapset()) == 0 && Map->support_updated &&
 	Map->plus.built == GV_BUILD_ALL) {
 	Map->plus.built == GV_BUILD_ALL) {
-	sprintf(elem, "%s/%s", GRASS_VECT_DIRECTORY, Map->name);
+	sprintf(elem, "%s/%s", GV_DIRECTORY, Map->name);
 	G__file_name(fname, elem, "fidx", Map->mapset);
 	G__file_name(fname, elem, "fidx", Map->mapset);
 	G_debug(4, "Open fidx: %s", fname);
 	G_debug(4, "Open fidx: %s", fname);
 	dig_file_init(&fp);
 	dig_file_init(&fp);

+ 1 - 1
lib/vector/Vlib/constraint.c

@@ -75,7 +75,7 @@ Vect_set_constraint_region(struct Map_info *Map,
 
 
    \return 0
    \return 0
  */
  */
-int Vect_get_constraint_box(const struct Map_info *Map, BOUND_BOX * Box)
+int Vect_get_constraint_box(const struct Map_info *Map, struct bound_box * Box)
 {
 {
     Box->N = Map->Constraint_N;
     Box->N = Map->Constraint_N;
     Box->S = Map->Constraint_S;
     Box->S = Map->Constraint_S;

+ 2 - 2
lib/vector/Vlib/dgraph.h

@@ -1,5 +1,5 @@
-#ifndef GRASS_DGRAPH_H
-#define GRASS_DGRAPH_H
+#ifndef GRASS_DdglGraph_s_H
+#define GRASS_DdglGraph_s_H
 
 
 /* pg comes from "planar graph" */
 /* pg comes from "planar graph" */
 /* every edge is directed. Nevertheless, we can visit it on both sides */
 /* every edge is directed. Nevertheless, we can visit it on both sides */

+ 1 - 1
lib/vector/Vlib/error.c

@@ -41,7 +41,7 @@ int Vect_set_fatal_error(int err)
 /*!
 /*!
    \brief Get behaviour for fatal error
    \brief Get behaviour for fatal error
 
 
-   \param 
+   \todo Remove or move to GIS Library?
 
 
    \return GV_FATAL_EXIT(default): print error message and exit,
    \return GV_FATAL_EXIT(default): print error message and exit,
    \return GV_FATAL_PRINT: print error message and return error,
    \return GV_FATAL_PRINT: print error message and return error,

+ 4 - 4
lib/vector/Vlib/find.c

@@ -40,7 +40,7 @@ Vect_find_node(struct Map_info *Map,
 	       double ux, double uy, double uz, double maxdist, int with_z)
 	       double ux, double uy, double uz, double maxdist, int with_z)
 {
 {
     int i, nnodes, node;
     int i, nnodes, node;
-    BOUND_BOX box;
+    struct bound_box box;
     struct ilist *NList;
     struct ilist *NList;
     double x, y, z;
     double x, y, z;
     double cur_dist, dist;
     double cur_dist, dist;
@@ -155,7 +155,7 @@ Vect_find_line_list(struct Map_info *map,
     static struct line_pnts *Points;
     static struct line_pnts *Points;
     static int first_time = 1;
     static int first_time = 1;
     const struct Plus_head *Plus;
     const struct Plus_head *Plus;
-    BOUND_BOX box;
+    struct bound_box box;
     struct ilist *List;
     struct ilist *List;
 
 
     G_debug(3, "Vect_find_line_list() for %f %f %f type = %d maxdist = %f",
     G_debug(3, "Vect_find_line_list() for %f %f %f type = %d maxdist = %f",
@@ -248,7 +248,7 @@ int Vect_find_area(struct Map_info *Map, double x, double y)
 {
 {
     int i, ret, area;
     int i, ret, area;
     static int first = 1;
     static int first = 1;
-    BOUND_BOX box;
+    struct bound_box box;
     static struct ilist *List;
     static struct ilist *List;
 
 
     G_debug(3, "Vect_find_area() x = %f y = %f", x, y);
     G_debug(3, "Vect_find_area() x = %f y = %f", x, y);
@@ -294,7 +294,7 @@ int Vect_find_island(struct Map_info *Map, double x, double y)
 {
 {
     int i, ret, island, current, current_size, size;
     int i, ret, island, current, current_size, size;
     static int first = 1;
     static int first = 1;
-    BOUND_BOX box;
+    struct bound_box box;
     static struct ilist *List;
     static struct ilist *List;
     static struct line_pnts *Points;
     static struct line_pnts *Points;
 
 

+ 6 - 6
lib/vector/Vlib/geos.c

@@ -1,5 +1,5 @@
 /*!
 /*!
-  \file geos.c
+  \file lib/vector/Vlib/geos.c
   
   
   \brief Vector library - GEOS support
   \brief Vector library - GEOS support
   
   
@@ -46,7 +46,7 @@ static GEOSCoordSequence *read_polygon_points(struct Map_info *, int, int*);
  */
  */
 GEOSGeometry *Vect_read_line_geos(struct Map_info *Map, int line, int *type)
 GEOSGeometry *Vect_read_line_geos(struct Map_info *Map, int line, int *type)
 {
 {
-    P_LINE *Line;
+    struct P_line *Line;
     
     
     G_debug(3, "Vect_read_line_geos(): line = %d", line);
     G_debug(3, "Vect_read_line_geos(): line = %d", line);
     
     
@@ -246,7 +246,7 @@ GEOSGeometry *Vect__read_line_geos(struct Map_info *Map, long offset, int *type)
 GEOSCoordSequence *V2_read_line_geos(struct Map_info *Map, int line)
 GEOSCoordSequence *V2_read_line_geos(struct Map_info *Map, int line)
 {
 {
     int ftype;
     int ftype;
-    P_LINE *Line;
+    struct P_line *Line;
     
     
     G_debug(3, "V2_read_line_geos(): line = %d", line);
     G_debug(3, "V2_read_line_geos(): line = %d", line);
     
     
@@ -373,7 +373,7 @@ GEOSCoordSequence *V1_read_line_geos(struct Map_info *Map, long offset, int *typ
 	    GEOSCoordSeq_setZ(pseq, i, z[i]);
 	    GEOSCoordSeq_setZ(pseq, i, z[i]);
     }
     }
     
     
-    G_debug(3, "    off = %ld", dig_ftell(&(Map->dig_fp)));
+    G_debug(3, "    off = %ld", (long) dig_ftell(&(Map->dig_fp)));
     
     
     G_free((void *) x);
     G_free((void *) x);
     G_free((void *) y);
     G_free((void *) y);
@@ -400,7 +400,7 @@ GEOSCoordSequence *V1_read_line_geos(struct Map_info *Map, long offset, int *typ
 GEOSCoordSequence *Vect_get_area_points_geos(struct Map_info *Map, int area)
 GEOSCoordSequence *Vect_get_area_points_geos(struct Map_info *Map, int area)
 {
 {
     struct Plus_head *Plus;
     struct Plus_head *Plus;
-    P_AREA *Area;
+    struct P_area *Area;
     
     
     G_debug(3, "Vect_get_area_points_geos(): area = %d", area);
     G_debug(3, "Vect_get_area_points_geos(): area = %d", area);
     
     
@@ -431,7 +431,7 @@ GEOSCoordSequence *Vect_get_area_points_geos(struct Map_info *Map, int area)
 GEOSCoordSequence *Vect_get_isle_points_geos(struct Map_info *Map, int isle)
 GEOSCoordSequence *Vect_get_isle_points_geos(struct Map_info *Map, int isle)
 {
 {
     struct Plus_head *Plus;
     struct Plus_head *Plus;
-    P_ISLE *Isle;
+    struct P_isle *Isle;
     
     
     G_debug(3, "Vect_get_isle_points_geos(): isle = %d", isle);
     G_debug(3, "Vect_get_isle_points_geos(): isle = %d", isle);
 
 

+ 6 - 6
lib/vector/Vlib/graph.c

@@ -5,7 +5,7 @@
 
 
    Higher level functions for reading/writing/manipulating vectors.
    Higher level functions for reading/writing/manipulating vectors.
 
 
-   \todo Vect_graph_free ( GRAPH *graph )
+   \todo Vect_graph_free ( dglGraph_s *graph )
 
 
    (C) 2001-2009 by the GRASS Development Team
    (C) 2001-2009 by the GRASS Development Team
 
 
@@ -70,7 +70,7 @@ static int clipper(dglGraph_s * pgraph,
 
 
    \return void
    \return void
  */
  */
-void Vect_graph_init(GRAPH * graph, int nodes_costs)
+void Vect_graph_init(dglGraph_s * graph, int nodes_costs)
 {
 {
     dglInt32_t opaqueset[16] =
     dglInt32_t opaqueset[16] =
 	{ 360000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
 	{ 360000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
@@ -96,7 +96,7 @@ void Vect_graph_init(GRAPH * graph, int nodes_costs)
 
 
    \return void
    \return void
  */
  */
-void Vect_graph_build(GRAPH * graph)
+void Vect_graph_build(dglGraph_s * graph)
 {
 {
     int ret;
     int ret;
 
 
@@ -123,7 +123,7 @@ void Vect_graph_build(GRAPH * graph)
    \return void
    \return void
  */
  */
 void
 void
-Vect_graph_add_edge(GRAPH * graph, int from, int to, double costs, int id)
+Vect_graph_add_edge(dglGraph_s * graph, int from, int to, double costs, int id)
 {
 {
     int ret;
     int ret;
     dglInt32_t dglcosts;
     dglInt32_t dglcosts;
@@ -153,7 +153,7 @@ Vect_graph_add_edge(GRAPH * graph, int from, int to, double costs, int id)
 
 
    \return void
    \return void
  */
  */
-void Vect_graph_set_node_costs(GRAPH * graph, int node, double costs)
+void Vect_graph_set_node_costs(dglGraph_s * graph, int node, double costs)
 {
 {
     dglInt32_t dglcosts;
     dglInt32_t dglcosts;
 
 
@@ -183,7 +183,7 @@ void Vect_graph_set_node_costs(GRAPH * graph, int node, double costs)
    \return -1 destination unreachable
    \return -1 destination unreachable
  */
  */
 int
 int
-Vect_graph_shortest_path(GRAPH * graph, int from, int to, struct ilist *List,
+Vect_graph_shortest_path(dglGraph_s * graph, int from, int to, struct ilist *List,
 			 double *cost)
 			 double *cost)
 {
 {
     int i, line, *pclip, cArc, nRet;
     int i, line, *pclip, cArc, nRet;

+ 14 - 14
lib/vector/Vlib/header.c

@@ -77,21 +77,21 @@ int Vect_write_header(const struct Map_info *Map)
 
 
    \param Map vector map
    \param Map vector map
 
 
-   \return GRASS_OK on success
-   \return GRASS_ERR on error
+   \return 0 on success
+   \return -1 on error
  */
  */
 int Vect__write_head(const struct Map_info *Map)
 int Vect__write_head(const struct Map_info *Map)
 {
 {
     char buf[GPATH_MAX];
     char buf[GPATH_MAX];
     FILE *head_fp;
     FILE *head_fp;
 
 
-    sprintf(buf, "%s/%s", GRASS_VECT_DIRECTORY, Map->name);
+    sprintf(buf, "%s/%s", GV_DIRECTORY, Map->name);
 
 
-    head_fp = G_fopen_new(buf, GRASS_VECT_HEAD_ELEMENT);
+    head_fp = G_fopen_new(buf, GV_HEAD_ELEMENT);
     if (head_fp == NULL) {
     if (head_fp == NULL) {
 	G_warning(_("Unable to open header file of vector <%s>"),
 	G_warning(_("Unable to open header file of vector <%s>"),
 		  Vect_get_full_name(Map));
 		  Vect_get_full_name(Map));
-	return (GRASS_ERR);
+	return (-1);
     }
     }
 
 
     fprintf(head_fp, "ORGANIZATION: %s\n", Vect_get_organization(Map));
     fprintf(head_fp, "ORGANIZATION: %s\n", Vect_get_organization(Map));
@@ -105,16 +105,16 @@ int Vect__write_head(const struct Map_info *Map)
     fprintf(head_fp, "MAP THRESH:   %f\n", Vect_get_thresh(Map));
     fprintf(head_fp, "MAP THRESH:   %f\n", Vect_get_thresh(Map));
 
 
     fclose(head_fp);
     fclose(head_fp);
-    return (GRASS_OK);
+    return (0);
 }
 }
 
 
 /*!
 /*!
-   \brief Reads head information from text file (GRASS_VECT_HEAD_ELEMENT).
+   \brief Reads head information from text file (GV_HEAD_ELEMENT).
 
 
-   \param Map vector map
+   \param Map pointer to Map_info structure
 
 
-   \return GRASS_OK on success
-   \return GRASS_ERR on error
+   \return 0 on success
+   \return -1 on error
  */
  */
 int Vect__read_head(struct Map_info *Map)
 int Vect__read_head(struct Map_info *Map)
 {
 {
@@ -134,12 +134,12 @@ int Vect__read_head(struct Map_info *Map)
     Vect_set_thresh(Map, 0.);
     Vect_set_thresh(Map, 0.);
 
 
     G_debug(1, "Vect__read_head(): vector = %s@%s", Map->name, Map->mapset);
     G_debug(1, "Vect__read_head(): vector = %s@%s", Map->name, Map->mapset);
-    sprintf(buff, "%s/%s", GRASS_VECT_DIRECTORY, Map->name);
-    head_fp = G_fopen_old(buff, GRASS_VECT_HEAD_ELEMENT, Map->mapset);
+    sprintf(buff, "%s/%s", GV_DIRECTORY, Map->name);
+    head_fp = G_fopen_old(buff, GV_HEAD_ELEMENT, Map->mapset);
     if (head_fp == NULL) {
     if (head_fp == NULL) {
 	G_warning(_("Unable to open header file of vector <%s>"),
 	G_warning(_("Unable to open header file of vector <%s>"),
 		  Vect_get_full_name(Map));
 		  Vect_get_full_name(Map));
-	return (GRASS_ERR);
+	return (-1);
     }
     }
 
 
     while (G_getl2(buff, 2000, head_fp)) {
     while (G_getl2(buff, 2000, head_fp)) {
@@ -185,7 +185,7 @@ int Vect__read_head(struct Map_info *Map)
     }
     }
 
 
     fclose(head_fp);
     fclose(head_fp);
-    return (GRASS_OK);
+    return (0);
 }
 }
 
 
 /*!
 /*!

+ 2 - 2
lib/vector/Vlib/hist.c

@@ -22,7 +22,7 @@
 /*!
 /*!
    \brief Write command info to history file
    \brief Write command info to history file
 
 
-   \param Map vector map
+   \param Map pointer to Map_info structure
 
 
    \return 0 on success
    \return 0 on success
    \return -1 error
    \return -1 error
@@ -52,7 +52,7 @@ int Vect_hist_command(struct Map_info *Map)
 /*!
 /*!
    \brief Write string to history file
    \brief Write string to history file
 
 
-   \param Map vector map
+   \param Map pointer to Map_info structure
    \param str string to write
    \param str string to write
 
 
    \return the number of characters printed
    \return the number of characters printed

+ 20 - 10
lib/vector/Vlib/init_head.c

@@ -1,8 +1,8 @@
 /*!
 /*!
-   \file init_head.c
-
-   \brief Vector library - init header of vector map
+   \file vector/Vlib/init_head.c
 
 
+   \brief Vector library - init header of vector maps
+   
    Higher level functions for reading/writing/manipulating vectors.
    Higher level functions for reading/writing/manipulating vectors.
 
 
    Initialize Head structure. To make sure that we are not writing out
    Initialize Head structure. To make sure that we are not writing out
@@ -15,6 +15,7 @@
 
 
    \author Original author CERL, probably Dave Gerdes or Mike Higgins.
    \author Original author CERL, probably Dave Gerdes or Mike Higgins.
    \author Update to GRASS 5.7 Radim Blazek and David D. Gray.
    \author Update to GRASS 5.7 Radim Blazek and David D. Gray.
+   \author Various updates by Martin Landa <landa.martin gmail.com>, 2009
 */
 */
 
 
 #include <grass/config.h>
 #include <grass/config.h>
@@ -23,40 +24,49 @@
 #include <grass/vector.h>
 #include <grass/vector.h>
 
 
 /*!
 /*!
-   \brief Initialize head structure
-
-   \param Map vector map
+   \brief Initialize Map_info head structure (dig_head)
 
 
-   \return 0
+   \param[in,out] Map pointer to Map_info structure
  */
  */
-int Vect__init_head(struct Map_info *Map)
+void Vect__init_head(struct Map_info *Map)
 {
 {
     char buf[64];
     char buf[64];
 
 
+    /* organization */
     Map->head.organization = NULL;
     Map->head.organization = NULL;
     Vect_set_organization(Map, "");
     Vect_set_organization(Map, "");
+    
+    /* date */
     Map->head.date = NULL;
     Map->head.date = NULL;
     Vect_set_date(Map, "");
     Vect_set_date(Map, "");
+
+    /* user name */
     Map->head.your_name = NULL;
     Map->head.your_name = NULL;
     sprintf(buf, "%s", G_whoami());
     sprintf(buf, "%s", G_whoami());
     Vect_set_person(Map, buf);
     Vect_set_person(Map, buf);
+
+    /* map name */
     Map->head.map_name = NULL;
     Map->head.map_name = NULL;
     Vect_set_map_name(Map, "");
     Vect_set_map_name(Map, "");
+
+    /* source date */
     Map->head.source_date = NULL;
     Map->head.source_date = NULL;
     sprintf(buf, "%s", G_date());
     sprintf(buf, "%s", G_date());
     Vect_set_map_date(Map, buf);
     Vect_set_map_date(Map, buf);
+
+    /* comments */
     Map->head.line_3 = NULL;
     Map->head.line_3 = NULL;
     Vect_set_comment(Map, "");
     Vect_set_comment(Map, "");
 
 
+    /* scale, zone, threshold */
     Vect_set_scale(Map, 1);
     Vect_set_scale(Map, 1);
     Vect_set_zone(Map, 0);
     Vect_set_zone(Map, 0);
     Vect_set_thresh(Map, 0.0);
     Vect_set_thresh(Map, 0.0);
 
 
+    /* support variables */
     Map->plus.Spidx_built = 0;
     Map->plus.Spidx_built = 0;
     Map->plus.release_support = 0;
     Map->plus.release_support = 0;
     Map->plus.update_cidx = 0;
     Map->plus.update_cidx = 0;
-
-    return 0;
 }
 }
 
 
 /*!
 /*!

+ 1 - 1
lib/vector/Vlib/level_two.c

@@ -181,7 +181,7 @@ int
 Vect_get_node_coor(const struct Map_info *map, int num, double *x, double *y,
 Vect_get_node_coor(const struct Map_info *map, int num, double *x, double *y,
 		   double *z)
 		   double *z)
 {
 {
-    P_NODE *Node;
+    struct P_node *Node;
 
 
     Node = map->plus.Node[num];
     Node = map->plus.Node[num];
     *x = Node->x;
     *x = Node->x;

+ 1 - 1
lib/vector/Vlib/line.c

@@ -762,7 +762,7 @@ double Vect_points_distance(double x1, double y1, double z1,	/* point 1 */
 
 
    \return 0
    \return 0
  */
  */
-int Vect_line_box(const struct line_pnts *Points, BOUND_BOX * Box)
+int Vect_line_box(const struct line_pnts *Points, struct bound_box * Box)
 {
 {
     dig_line_box(Points, Box);
     dig_line_box(Points, Box);
     return 0;
     return 0;

+ 10 - 10
lib/vector/Vlib/map.c

@@ -161,8 +161,8 @@ Vect_copy(const char *in, const char *mapset, const char *out)
     struct field_info *Fi, *Fin;
     struct field_info *Fi, *Fin;
     char old_path[GPATH_MAX], new_path[GPATH_MAX], buf[GPATH_MAX];
     char old_path[GPATH_MAX], new_path[GPATH_MAX], buf[GPATH_MAX];
     struct stat info;
     struct stat info;
-    const char *files[] = { GRASS_VECT_FRMT_ELEMENT, GRASS_VECT_COOR_ELEMENT,
-	GRASS_VECT_HEAD_ELEMENT, GRASS_VECT_HIST_ELEMENT,
+    const char *files[] = { GV_FRMT_ELEMENT, GV_COOR_ELEMENT,
+	GV_HEAD_ELEMENT, GV_HIST_ELEMENT,
 	GV_TOPO_ELEMENT, GV_SIDX_ELEMENT, GV_CIDX_ELEMENT,
 	GV_TOPO_ELEMENT, GV_SIDX_ELEMENT, GV_CIDX_ELEMENT,
 	NULL
 	NULL
     };
     };
@@ -200,16 +200,16 @@ Vect_copy(const char *in, const char *mapset, const char *out)
     }
     }
 
 
     /* Copy the directory */
     /* Copy the directory */
-    G__make_mapset_element(GRASS_VECT_DIRECTORY);
-    sprintf(buf, "%s/%s", GRASS_VECT_DIRECTORY, out);
+    G__make_mapset_element(GV_DIRECTORY);
+    sprintf(buf, "%s/%s", GV_DIRECTORY, out);
     G__make_mapset_element(buf);
     G__make_mapset_element(buf);
 
 
     i = 0;
     i = 0;
     while (files[i]) {
     while (files[i]) {
 	sprintf(buf, "%s/%s", in, files[i]);
 	sprintf(buf, "%s/%s", in, files[i]);
-	G__file_name(old_path, GRASS_VECT_DIRECTORY, buf, mapset);
+	G__file_name(old_path, GV_DIRECTORY, buf, mapset);
 	sprintf(buf, "%s/%s", out, files[i]);
 	sprintf(buf, "%s/%s", out, files[i]);
-	G__file_name(new_path, GRASS_VECT_DIRECTORY, buf, G_mapset());
+	G__file_name(new_path, GV_DIRECTORY, buf, G_mapset());
 
 
 	if (stat(old_path, &info) == 0) {	/* file exists? */
 	if (stat(old_path, &info) == 0) {	/* file exists? */
 	    G_debug(2, "copy %s to %s", old_path, new_path);
 	    G_debug(2, "copy %s to %s", old_path, new_path);
@@ -221,8 +221,8 @@ Vect_copy(const char *in, const char *mapset, const char *out)
 	i++;
 	i++;
     }
     }
 
 
-    G__file_name(old_path, GRASS_VECT_DIRECTORY, in, mapset);
-    G__file_name(new_path, GRASS_VECT_DIRECTORY, out, G_mapset());
+    G__file_name(old_path, GV_DIRECTORY, in, mapset);
+    G__file_name(new_path, GV_DIRECTORY, out, G_mapset());
 
 
     /* Open input */
     /* Open input */
     Vect_set_open_level(1);
     Vect_set_open_level(1);
@@ -331,7 +331,7 @@ int Vect_rename(const char *in, const char *out)
     }
     }
 
 
     /* Move the directory */
     /* Move the directory */
-    ret = G_rename(GRASS_VECT_DIRECTORY, in, out);
+    ret = G_rename(GV_DIRECTORY, in, out);
 
 
     if (ret == 0) {
     if (ret == 0) {
 	G_warning(_("Vector map <%s> not found"), in);
 	G_warning(_("Vector map <%s> not found"), in);
@@ -462,7 +462,7 @@ int Vect_delete(const char *map)
     }
     }
 
 
     sprintf(buf, "%s/%s/%s/%s/%s/%s", G_gisdbase(), G_location(),
     sprintf(buf, "%s/%s/%s/%s/%s/%s", G_gisdbase(), G_location(),
-	    G_mapset(), GRASS_VECT_DIRECTORY, map, GRASS_VECT_DBLN_ELEMENT);
+	    G_mapset(), GV_DIRECTORY, map, GV_DBLN_ELEMENT);
 
 
     G_debug(1, "dbln file: %s", buf);
     G_debug(1, "dbln file: %s", buf);
 
 

+ 1 - 1
lib/vector/Vlib/merge_lines.c

@@ -51,7 +51,7 @@ int Vect_merge_lines(struct Map_info *Map, int type, int *new_lines,
     struct ilist *List;
     struct ilist *List;
     struct line_pnts *MPoints, *Points;
     struct line_pnts *MPoints, *Points;
     struct line_cats *MCats, *Cats;
     struct line_cats *MCats, *Cats;
-    P_LINE *Line;
+    struct P_line *Line;
 
 
     if ((type & GV_BOUNDARY) && (type & GV_LINE)) {
     if ((type & GV_BOUNDARY) && (type & GV_LINE)) {
 	G_warning
 	G_warning

+ 95 - 70
lib/vector/Vlib/open.c

@@ -1,5 +1,5 @@
 /*!
 /*!
- * \file open.c
+ * \file vector/Vlib/open.c
  *
  *
  * \brief Vector library - Open vector map
  * \brief Vector library - Open vector map
  *
  *
@@ -70,20 +70,20 @@ static void fatal_error(int ferror, char *errmsg)
 
 
 
 
 /*!
 /*!
- * \brief Predetermine level at which a map will be opened for
+ * \brief Predetermine level at which a vector map will be opened for
  * reading.
  * reading.
  *
  *
  * If it can't open that level, the open will fail. The specified
  * If it can't open that level, the open will fail. The specified
- * level must be set before any call to open.  The default is to try
- * to open the highest level possible, and keep stepping down until
+ * level must be set before any call to open. The default is to try to
+ * open the highest level possible, and keep stepping down until
  * success.
  * success.
  *
  *
- * NOTE!!  This should only be used to set when you wish to force
- * a lower level open.  If you require a higher level, then just
- * check the return to verify the level instead of forcing it.
- * This is because future releases will have higher levels which
- * will be downward compatible and which your programs should 
- * support by default.
+ * NOTE: This should only be used to set when you wish to force a
+ * lower level open. If you require a higher level, then just check
+ * the return to verify the level instead of forcing it.  This is
+ * because future releases will have higher levels which will be
+ * downward compatible and which your programs should support by
+ * default.
  *
  *
  * \param level vector (topo) level
  * \param level vector (topo) level
  *
  *
@@ -104,7 +104,6 @@ int Vect_set_open_level(int level)
     return 0;
     return 0;
 }
 }
 
 
-
 /*! 
 /*! 
  * \brief Open old vector for reading.
  * \brief Open old vector for reading.
  *
  *
@@ -128,11 +127,15 @@ Vect__open_old(struct Map_info *Map, const char *name, const char *mapset,
     FILE *fp;
     FILE *fp;
     int level, level_request, ferror;
     int level, level_request, ferror;
     int format, ret;
     int format, ret;
+    int ogr_mapset;
     const char *fmapset;
     const char *fmapset;
 
 
-    G_debug(1, "Vect_open_old(): name = %s mapset= %s update = %d", name,
+    G_debug(1, "Vect__open_old(): name = %s mapset= %s update = %d", name,
 	    mapset, update);
 	    mapset, update);
 
 
+    /* zero Map_info structure */
+    G_zero(Map, sizeof(struct Map_info));
+
     /* TODO: Open header for update ('dbln') */
     /* TODO: Open header for update ('dbln') */
 
 
     ferror = Vect_get_fatal_error();
     ferror = Vect_get_fatal_error();
@@ -140,19 +143,31 @@ Vect__open_old(struct Map_info *Map, const char *name, const char *mapset,
 
 
     level_request = Open_level;
     level_request = Open_level;
     Open_level = 0;
     Open_level = 0;
+
+    /* initialize Map->head */
     Vect__init_head(Map);
     Vect__init_head(Map);
+    /* initialize Map->plus */
     dig_init_plus(&(Map->plus));
     dig_init_plus(&(Map->plus));
 
 
+    ogr_mapset = 0;
     if (G__name_is_fully_qualified(name, xname, xmapset)) {
     if (G__name_is_fully_qualified(name, xname, xmapset)) {
-	sprintf(buf, "%s/%s", GRASS_VECT_DIRECTORY, xname);
-	sprintf(buf2, "%s@%s", GRASS_VECT_COOR_ELEMENT, xmapset);
-
+	if (strcmp(xmapset, "OGR") == 0) {
+	    /* unique OGR mapset detected */
+	    G_debug(1, "OGR mapset detected");
+	    ogr_mapset = 1;
+	    Map->fInfo.ogr.dsn = xname;
+	    Map->fInfo.ogr.layer_name = NULL; /* no layer to be open */
+	}
+	else {
+	    sprintf(buf, "%s/%s", GV_DIRECTORY, xname);
+	    sprintf(buf2, "%s@%s", GV_COOR_ELEMENT, xmapset);
+	}
 	Map->name = G_store(xname);
 	Map->name = G_store(xname);
 	Map->mapset = G_store(xmapset);
 	Map->mapset = G_store(xmapset);
     }
     }
     else {
     else {
-	sprintf(buf, "%s/%s", GRASS_VECT_DIRECTORY, name);
-	sprintf(buf2, "%s", GRASS_VECT_COOR_ELEMENT);
+	sprintf(buf, "%s/%s", GV_DIRECTORY, name);
+	sprintf(buf2, "%s", GV_COOR_ELEMENT);
 	Map->name = G_store(name);
 	Map->name = G_store(name);
 
 
 	if (mapset)
 	if (mapset)
@@ -172,7 +187,7 @@ Vect__open_old(struct Map_info *Map, const char *name, const char *mapset,
 
 
     Map->location = G_store(G_location());
     Map->location = G_store(G_location());
     Map->gisdbase = G_store(G_gisdbase());
     Map->gisdbase = G_store(G_gisdbase());
-
+    
     if (update && (0 != strcmp(Map->mapset, G_mapset()))) {
     if (update && (0 != strcmp(Map->mapset, G_mapset()))) {
 	G_warning(_("Vector map which is not in the current mapset cannot be opened for update"));
 	G_warning(_("Vector map which is not in the current mapset cannot be opened for update"));
 	return -1;
 	return -1;
@@ -182,32 +197,36 @@ Vect__open_old(struct Map_info *Map, const char *name, const char *mapset,
     G_debug(1, "Map mapset: %s", Map->mapset);
     G_debug(1, "Map mapset: %s", Map->mapset);
 
 
     /* Read vector format information */
     /* Read vector format information */
-    format = 0;
-    sprintf(buf, "%s/%s", GRASS_VECT_DIRECTORY, Map->name);
-    G_debug(1, "open format file: '%s/%s/%s'", Map->mapset, buf,
-	    GRASS_VECT_FRMT_ELEMENT);
-    fp = G_fopen_old(buf, GRASS_VECT_FRMT_ELEMENT, Map->mapset);
-    if (fp == NULL) {
-	G_debug(1, "Vector format: %d (native)", format);
-	format = GV_FORMAT_NATIVE;
+    if (ogr_mapset) {
+	format = GV_FORMAT_OGR;
     }
     }
     else {
     else {
-	format = dig_read_frmt_ascii(fp, &(Map->fInfo));
-	fclose(fp);
-
-	G_debug(1, "Vector format: %d (non-native)", format);
-	if (format < 0) {
-	    sprintf(errmsg, _("Unable to open vector map <%s>"),
-		    Vect_get_full_name(Map));
-	    fatal_error(ferror, errmsg);
-	    return -1;
+	format = 0;
+	sprintf(buf, "%s/%s", GV_DIRECTORY, Map->name);
+	G_debug(1, "open format file: '%s/%s/%s'", Map->mapset, buf,
+		GV_FRMT_ELEMENT);
+	fp = G_fopen_old(buf, GV_FRMT_ELEMENT, Map->mapset);
+	if (fp == NULL) {
+	    G_debug(1, "Vector format: %d (native)", format);
+	    format = GV_FORMAT_NATIVE;
+	}
+	else {
+	    format = dig_read_frmt_ascii(fp, &(Map->fInfo));
+	    fclose(fp);
+	    
+	    G_debug(1, "Vector format: %d (non-native)", format);
+	    if (format < 0) {
+		sprintf(errmsg, _("Unable to open vector map <%s>"),
+			Vect_get_full_name(Map));
+		fatal_error(ferror, errmsg);
+		return -1;
+	    }
 	}
 	}
     }
     }
-
     Map->format = format;
     Map->format = format;
-
+    
     /* Read vector head */
     /* Read vector head */
-    if (Vect__read_head(Map) != GRASS_OK) {
+    if (!ogr_mapset && Vect__read_head(Map) != 0) {
 	sprintf(errmsg,
 	sprintf(errmsg,
 		_("Unable to open vector map <%s> on level %d. "
 		_("Unable to open vector map <%s> on level %d. "
 		  "Try to rebuild vector topology by v.build."),
 		  "Try to rebuild vector topology by v.build."),
@@ -215,7 +234,7 @@ Vect__open_old(struct Map_info *Map, const char *name, const char *mapset,
 	G_warning(_("Unable to read head file of vector <%s>"),
 	G_warning(_("Unable to read head file of vector <%s>"),
 		  Vect_get_full_name(Map));
 		  Vect_get_full_name(Map));
     }
     }
-
+    
     G_debug(1, "Level request = %d", level_request);
     G_debug(1, "Level request = %d", level_request);
 
 
     /* There are only 2 possible open levels, 1 and 2. Try first to open 'support' files
     /* There are only 2 possible open levels, 1 and 2. Try first to open 'support' files
@@ -279,12 +298,19 @@ Vect__open_old(struct Map_info *Map, const char *name, const char *mapset,
 	}
 	}
 #endif
 #endif
 	if (level_request == 2 && level < 2) {
 	if (level_request == 2 && level < 2) {
-	    sprintf(errmsg,
-		    _("Unable to open vector map <%s> on level %d. "
-		      "Try to rebuild vector topology by v.build."),
-		    Vect_get_full_name(Map), level_request);
-	    fatal_error(ferror, errmsg);
-	    return -1;
+	    if (ogr_mapset) {
+		G_warning(_("Topology level (2) is not supported when reading "
+			    "OGR layers directly. For topology level "
+			    "is required link to OGR layer via v.external command."));
+	    }
+	    else {
+		sprintf(errmsg,
+			_("Unable to open vector map <%s> on level %d. "
+			  "Try to rebuild vector topology by v.build."),
+			Vect_get_full_name(Map), level_request);
+		fatal_error(ferror, errmsg);
+		return -1;
+	    }
 	}
 	}
     }
     }
     else {
     else {
@@ -348,10 +374,10 @@ Vect__open_old(struct Map_info *Map, const char *name, const char *mapset,
     Vect_read_dblinks(Map);
     Vect_read_dblinks(Map);
 
 
     /* Open history file */
     /* Open history file */
-    sprintf(buf, "%s/%s", GRASS_VECT_DIRECTORY, Map->name);
+    sprintf(buf, "%s/%s", GV_DIRECTORY, Map->name);
 
 
     if (update) {		/* native only */
     if (update) {		/* native only */
-	Map->hist_fp = G_fopen_modify(buf, GRASS_VECT_HIST_ELEMENT);
+	Map->hist_fp = G_fopen_modify(buf, GV_HIST_ELEMENT);
 	if (Map->hist_fp == NULL) {
 	if (Map->hist_fp == NULL) {
 	    sprintf(errmsg,
 	    sprintf(errmsg,
 		    _("Unable to open history file for vector map <%s>"),
 		    _("Unable to open history file for vector map <%s>"),
@@ -367,7 +393,7 @@ Vect__open_old(struct Map_info *Map, const char *name, const char *mapset,
     else {
     else {
 	if (Map->format == GV_FORMAT_NATIVE || Map->format == GV_FORMAT_OGR) {
 	if (Map->format == GV_FORMAT_NATIVE || Map->format == GV_FORMAT_OGR) {
 	    Map->hist_fp =
 	    Map->hist_fp =
-		G_fopen_old(buf, GRASS_VECT_HIST_ELEMENT, Map->mapset);
+		G_fopen_old(buf, GV_HIST_ELEMENT, Map->mapset);
 	    /* If NULL (does not exist) then Vect_hist_read() handle that */
 	    /* If NULL (does not exist) then Vect_hist_read() handle that */
 	}
 	}
 	else {
 	else {
@@ -384,7 +410,7 @@ Vect__open_old(struct Map_info *Map, const char *name, const char *mapset,
 	char file_path[2000];
 	char file_path[2000];
 	struct stat info;
 	struct stat info;
 
 
-	sprintf(buf, "%s/%s", GRASS_VECT_DIRECTORY, name);
+	sprintf(buf, "%s/%s", GV_DIRECTORY, name);
 
 
 	G__file_name(file_path, buf, GV_TOPO_ELEMENT, G_mapset());
 	G__file_name(file_path, buf, GV_TOPO_ELEMENT, G_mapset());
 	if (stat(file_path, &info) == 0)	/* file exists? */
 	if (stat(file_path, &info) == 0)	/* file exists? */
@@ -458,20 +484,19 @@ Vect_open_update(struct Map_info *Map, const char *name, const char *mapset)
 }
 }
 
 
 /*! 
 /*! 
- * \brief Reads only info about vector from headers of 'head', 'dbln',
- * 'topo' and 'cidx' file.
+ * \brief Reads only info about vector map from headers of 'head',
+ * 'dbln', 'topo' and 'cidx' file.
  *
  *
  * In case of error, the functions respect fatal error settings.
  * In case of error, the functions respect fatal error settings.
  * 
  * 
- * \param[out] Map vector map
+ * \param[out] Map pointer to Map_info structure
  * \param name name of vector map to read
  * \param name name of vector map to read
  * \param mapset mapset name
  * \param mapset mapset name
  *
  *
  * \return level of openness [1, 2, (3)]
  * \return level of openness [1, 2, (3)]
  * \return -1 on error
  * \return -1 on error
  */
  */
-int
-Vect_open_old_head(struct Map_info *Map, const char *name, const char *mapset)
+int Vect_open_old_head(struct Map_info *Map, const char *name, const char *mapset)
 {
 {
     return (Vect__open_old(Map, name, mapset, 0, 1));
     return (Vect__open_old(Map, name, mapset, 0, 1));
 }
 }
@@ -513,9 +538,9 @@ Vect_open_update_head(struct Map_info *Map, const char *name,
 /*!
 /*!
  * \brief Open new vector for reading/writing
  * \brief Open new vector for reading/writing
  *
  *
- * \param[out] Map vector map
+ * \param[in,out] Map pointer to Map_info structure
  * \param name name of vector map
  * \param name name of vector map
- * \param with_z 2D/3D vector map
+ * \param with_z non-zero value for 3D vector data
  *
  *
  * \return 1 on success
  * \return 1 on success
  * \return -1 on error
  * \return -1 on error
@@ -576,8 +601,8 @@ int Vect_open_new(struct Map_info *Map, const char *name, int with_z)
     }
     }
 
 
     /* Open history file */
     /* Open history file */
-    sprintf(buf, "%s/%s", GRASS_VECT_DIRECTORY, Map->name);
-    Map->hist_fp = G_fopen_new(buf, GRASS_VECT_HIST_ELEMENT);
+    sprintf(buf, "%s/%s", GV_DIRECTORY, Map->name);
+    Map->hist_fp = G_fopen_new(buf, GV_HIST_ELEMENT);
     if (Map->hist_fp == NULL) {
     if (Map->hist_fp == NULL) {
 	sprintf(errmsg, _("Unable to open history file for vector map <%s>"),
 	sprintf(errmsg, _("Unable to open history file for vector map <%s>"),
 		Vect_get_full_name(Map));
 		Vect_get_full_name(Map));
@@ -612,8 +637,8 @@ int Vect_open_new(struct Map_info *Map, const char *name, int with_z)
 /*!
 /*!
  * \brief Update Coor_info structure
  * \brief Update Coor_info structure
  *
  *
- * \param Map vector map
- * \param[out] Info Coor_info structure
+ * \param Map pointer to Map_info structure
+ * \param[out] Info pointer to Coor_info structure
  *
  *
  * \return 1 on success
  * \return 1 on success
  * \return 0 on error
  * \return 0 on error
@@ -625,8 +650,8 @@ int Vect_coor_info(const struct Map_info *Map, struct Coor_info *Info)
 
 
     switch (Map->format) {
     switch (Map->format) {
     case GV_FORMAT_NATIVE:
     case GV_FORMAT_NATIVE:
-	sprintf(buf, "%s/%s", GRASS_VECT_DIRECTORY, Map->name);
-	G__file_name(path, buf, GRASS_VECT_COOR_ELEMENT, Map->mapset);
+	sprintf(buf, "%s/%s", GV_DIRECTORY, Map->name);
+	G__file_name(path, buf, GV_COOR_ELEMENT, Map->mapset);
 	G_debug(1, "get coor info: %s", path);
 	G_debug(1, "get coor info: %s", path);
 	if (0 != stat(path, &stat_buf)) {
 	if (0 != stat(path, &stat_buf)) {
 	    G_warning(_("Unable to stat file <%s>"), path);
 	    G_warning(_("Unable to stat file <%s>"), path);
@@ -692,7 +717,7 @@ const char *Vect_maptype_info(const struct Map_info *Map)
 /*!
 /*!
  * \brief Open topo file
  * \brief Open topo file
  *
  *
- * \param[in,out] Map vector map
+ * \param[in,out] Map pointer to Map_info structure
  * \param head_only open only head
  * \param head_only open only head
  *
  *
  * \return 0 on success
  * \return 0 on success
@@ -703,7 +728,7 @@ int Vect_open_topo(struct Map_info *Map, int head_only)
 {
 {
     int err, ret;
     int err, ret;
     char buf[500], file_path[2000];
     char buf[500], file_path[2000];
-    GVFILE fp;
+    struct gvfile fp;
     struct Coor_info CInfo;
     struct Coor_info CInfo;
     struct Plus_head *Plus;
     struct Plus_head *Plus;
     struct stat info;
     struct stat info;
@@ -713,7 +738,7 @@ int Vect_open_topo(struct Map_info *Map, int head_only)
 
 
     Plus = &(Map->plus);
     Plus = &(Map->plus);
 
 
-    sprintf(buf, "%s/%s", GRASS_VECT_DIRECTORY, Map->name);
+    sprintf(buf, "%s/%s", GV_DIRECTORY, Map->name);
     G__file_name(file_path, buf, GV_TOPO_ELEMENT, Map->mapset);
     G__file_name(file_path, buf, GV_TOPO_ELEMENT, Map->mapset);
 
 
     if (stat(file_path, &info) != 0)	/* does not exist */
     if (stat(file_path, &info) != 0)	/* does not exist */
@@ -773,9 +798,9 @@ int Vect_open_topo(struct Map_info *Map, int head_only)
 }
 }
 
 
 /*!
 /*!
- * \brief Open spatial index file
+ * \brief Open spatial index file ('sidx')
  *
  *
- * \param[in,out] Map vector map
+ * \param[in,out] Map pointer to Map_info
  * \param mode 0 old, 1 update, 2 new
  * \param mode 0 old, 1 update, 2 new
  *
  *
  * \return 0 on success
  * \return 0 on success
@@ -783,7 +808,7 @@ int Vect_open_topo(struct Map_info *Map, int head_only)
  */
  */
 int Vect_open_sidx(struct Map_info *Map, int mode)
 int Vect_open_sidx(struct Map_info *Map, int mode)
 {
 {
-    char buf[500], spidxbuf[500], file_path[2000];
+    char buf[500], file_path[2000];
     int err;
     int err;
     struct Coor_info CInfo;
     struct Coor_info CInfo;
     struct Plus_head *Plus;
     struct Plus_head *Plus;
@@ -793,7 +818,7 @@ int Vect_open_sidx(struct Map_info *Map, int mode)
 	    Map->mapset, mode == 0 ? "old" : (mode == 1 ? "update" : "new"));
 	    Map->mapset, mode == 0 ? "old" : (mode == 1 ? "update" : "new"));
 
 
     if (Map->plus.Spidx_built == 1) {
     if (Map->plus.Spidx_built == 1) {
-	G_warning("spatial index already opened");
+	G_warning("Spatial index already opened");
 	return 0;
 	return 0;
     }
     }
 
 
@@ -802,7 +827,7 @@ int Vect_open_sidx(struct Map_info *Map, int mode)
     dig_file_init(&(Map->plus.spidx_fp));
     dig_file_init(&(Map->plus.spidx_fp));
 
 
     if (mode < 2) {
     if (mode < 2) {
-	sprintf(buf, "%s/%s", GRASS_VECT_DIRECTORY, Map->name);
+	sprintf(buf, "%s/%s", GV_DIRECTORY, Map->name);
 	G__file_name(file_path, buf, GV_SIDX_ELEMENT, Map->mapset);
 	G__file_name(file_path, buf, GV_SIDX_ELEMENT, Map->mapset);
 
 
 	if (stat(file_path, &info) != 0)	/* does not exist */
 	if (stat(file_path, &info) != 0)	/* does not exist */

+ 11 - 12
lib/vector/Vlib/open_nat.c

@@ -26,7 +26,7 @@
 static char name_buf[GPATH_MAX];
 static char name_buf[GPATH_MAX];
 static int check_coor(struct Map_info *Map);
 static int check_coor(struct Map_info *Map);
 
 
-/**
+/*!
    \brief Open existing vector map
    \brief Open existing vector map
 
 
    Map->name and Map->mapset must be set before.
    Map->name and Map->mapset must be set before.
@@ -45,13 +45,13 @@ int V1_open_old_nat(struct Map_info *Map, int update)
     G_debug(1, "V1_open_old_nat(): name = %s mapset = %s", Map->name,
     G_debug(1, "V1_open_old_nat(): name = %s mapset = %s", Map->name,
 	    Map->mapset);
 	    Map->mapset);
 
 
-    sprintf(buf, "%s/%s", GRASS_VECT_DIRECTORY, Map->name);
+    sprintf(buf, "%s/%s", GV_DIRECTORY, Map->name);
     dig_file_init(&(Map->dig_fp));
     dig_file_init(&(Map->dig_fp));
     if (update)
     if (update)
-	Map->dig_fp.file = G_fopen_modify(buf, GRASS_VECT_COOR_ELEMENT);
+	Map->dig_fp.file = G_fopen_modify(buf, GV_COOR_ELEMENT);
     else
     else
 	Map->dig_fp.file =
 	Map->dig_fp.file =
-	    G_fopen_old(buf, GRASS_VECT_COOR_ELEMENT, Map->mapset);
+	    G_fopen_old(buf, GV_COOR_ELEMENT, Map->mapset);
 
 
     if (Map->dig_fp.file == NULL) {
     if (Map->dig_fp.file == NULL) {
         G_warning(_("Unable to open coor file for vector map <%s>"), Map->name);
         G_warning(_("Unable to open coor file for vector map <%s>"), Map->name);
@@ -77,14 +77,13 @@ int V1_open_old_nat(struct Map_info *Map, int update)
     return 0;
     return 0;
 }
 }
 
 
-/**
-   \brief Open/Create new vector map.
+/*!
+   \brief Open/Create new vector map (level 1)
 
 
-   \param[out] Map pointer to vector map
+   \param[out] Map pointer to Map_info structure
    \param name map name
    \param name map name
    \param with_z 2D or 3D (unused?)
    \param with_z 2D or 3D (unused?)
 
 
-
    \return 0 success
    \return 0 success
    \return -1 error 
    \return -1 error 
 */
 */
@@ -95,7 +94,7 @@ int V1_open_new_nat(struct Map_info *Map, const char *name, int with_z)
 
 
     G_debug(1, "V1_open_new_nat(): name = %s", name);
     G_debug(1, "V1_open_new_nat(): name = %s", name);
 
 
-    sprintf(buf, "%s/%s", GRASS_VECT_DIRECTORY, name);
+    sprintf(buf, "%s/%s", GV_DIRECTORY, name);
 
 
     /* Set the 'coor' file version */
     /* Set the 'coor' file version */
     Map->head.Version_Major = GV_COOR_VER_MAJOR;
     Map->head.Version_Major = GV_COOR_VER_MAJOR;
@@ -105,13 +104,13 @@ int V1_open_new_nat(struct Map_info *Map, const char *name, int with_z)
 
 
     /* TODO open better */
     /* TODO open better */
     dig_file_init(&(Map->dig_fp));
     dig_file_init(&(Map->dig_fp));
-    Map->dig_fp.file = G_fopen_new(buf, GRASS_VECT_COOR_ELEMENT);
+    Map->dig_fp.file = G_fopen_new(buf, GV_COOR_ELEMENT);
     if (Map->dig_fp.file == NULL)
     if (Map->dig_fp.file == NULL)
 	return (-1);
 	return (-1);
     fclose(Map->dig_fp.file);
     fclose(Map->dig_fp.file);
 
 
     dig_file_init(&(Map->dig_fp));
     dig_file_init(&(Map->dig_fp));
-    Map->dig_fp.file = G_fopen_modify(buf, GRASS_VECT_COOR_ELEMENT);
+    Map->dig_fp.file = G_fopen_modify(buf, GV_COOR_ELEMENT);
     if (Map->dig_fp.file == NULL)
     if (Map->dig_fp.file == NULL)
 	return (-1);
 	return (-1);
 
 
@@ -120,7 +119,7 @@ int V1_open_new_nat(struct Map_info *Map, const char *name, int with_z)
     if (stat(name_buf, &info) == 0)	/* file exists? */
     if (stat(name_buf, &info) == 0)	/* file exists? */
 	unlink(name_buf);
 	unlink(name_buf);
 
 
-    G__file_name(name_buf, buf, GRASS_VECT_COOR_ELEMENT, G_mapset());
+    G__file_name(name_buf, buf, GV_COOR_ELEMENT, G_mapset());
 
 
     Map->head.size = 0;
     Map->head.size = 0;
     Map->head.head_size = GV_COOR_HEAD_SIZE + 4;
     Map->head.head_size = GV_COOR_HEAD_SIZE + 4;

+ 6 - 6
lib/vector/Vlib/open_ogr.c

@@ -27,7 +27,7 @@
 #ifdef HAVE_OGR
 #ifdef HAVE_OGR
 #include <ogr_api.h>
 #include <ogr_api.h>
 
 
-/**
+/*!
    \brief Open existing vector map
    \brief Open existing vector map
 
 
    Map->name and Map->mapset must be set before.
    Map->name and Map->mapset must be set before.
@@ -100,10 +100,10 @@ int V1_open_old_ogr(struct Map_info *Map, int update)
     return (0);
     return (0);
 }
 }
 
 
-/**
+/*!
    \brief Open OGR specific level 2 files (feature index)
    \brief Open OGR specific level 2 files (feature index)
 
 
-   \param[out] Map pointer to vector map
+   \param[out] Map pointer to Map_info structure
 
 
    \return 0 success
    \return 0 success
    \return -1 error
    \return -1 error
@@ -113,15 +113,15 @@ int V2_open_old_ogr(struct Map_info *Map)
     char elem[GPATH_MAX];
     char elem[GPATH_MAX];
     char buf[5];		/* used for format version */
     char buf[5];		/* used for format version */
     long length;
     long length;
-    GVFILE fp;
+    struct gvfile fp;
     struct Port_info port;
     struct Port_info port;
     int Version_Major, Version_Minor, Back_Major, Back_Minor, byte_order;
     int Version_Major, Version_Minor, Back_Major, Back_Minor, byte_order;
 
 
     G_debug(3, "V2_open_old_ogr()");
     G_debug(3, "V2_open_old_ogr()");
 
 
-    sprintf(elem, "%s/%s", GRASS_VECT_DIRECTORY, Map->name);
+    sprintf(elem, "%s/%s", GV_DIRECTORY, Map->name);
     dig_file_init(&fp);
     dig_file_init(&fp);
-    fp.file = G_fopen_old(elem, "fidx", Map->mapset);
+    fp.file = G_fopen_old(elem, GV_FIDX_ELEMENT, Map->mapset);
     if (fp.file == NULL) {
     if (fp.file == NULL) {
 	G_warning(_("Unable to open fidx file for vector map <%s@%s>"),
 	G_warning(_("Unable to open fidx file for vector map <%s@%s>"),
 		  Map->name, Map->mapset);
 		  Map->name, Map->mapset);

+ 5 - 5
lib/vector/Vlib/poly.c

@@ -370,7 +370,7 @@ Vect_find_poly_centroid(const struct line_pnts *points,
    int area,
    int area,
    double cent_x, double cent_y)
    double cent_x, double cent_y)
    {
    {
-   P_AREA *Area;
+   struct P_area *Area;
    static struct line_pnts *TPoints;
    static struct line_pnts *TPoints;
    static int first_time = 1;
    static int first_time = 1;
    int isle;
    int isle;
@@ -698,8 +698,8 @@ Vect_point_in_area_outer_ring(double X, double Y, const struct Map_info *Map,
     int i, line;
     int i, line;
     static struct line_pnts *Points;
     static struct line_pnts *Points;
     const struct Plus_head *Plus;
     const struct Plus_head *Plus;
-    P_LINE *Line;
-    P_AREA *Area;
+    struct P_line *Line;
+    struct P_area *Area;
 
 
     G_debug(3, "Vect_point_in_area_outer_ring(): x = %f y = %f area = %d", X,
     G_debug(3, "Vect_point_in_area_outer_ring(): x = %f y = %f area = %d", X,
 	    Y, area);
 	    Y, area);
@@ -762,8 +762,8 @@ int Vect_point_in_island(double X, double Y, const struct Map_info *Map, int isl
     int i, line;
     int i, line;
     static struct line_pnts *Points;
     static struct line_pnts *Points;
     const struct Plus_head *Plus;
     const struct Plus_head *Plus;
-    P_LINE *Line;
-    P_ISLE *Isle;
+    struct P_line *Line;
+    struct P_isle *Isle;
 
 
     G_debug(3, "Vect_point_in_island(): x = %f y = %f isle = %d", X, Y, isle);
     G_debug(3, "Vect_point_in_island(): x = %f y = %f isle = %d", X, Y, isle);
 
 

+ 4 - 4
lib/vector/Vlib/read_nat.c

@@ -68,7 +68,7 @@ V1_read_next_line_nat(struct Map_info *Map,
 {
 {
     int itype;
     int itype;
     off_t offset;
     off_t offset;
-    BOUND_BOX lbox, mbox;
+    struct bound_box lbox, mbox;
 
 
     G_debug(3, "V1_read_next_line_nat()");
     G_debug(3, "V1_read_next_line_nat()");
 
 
@@ -122,7 +122,7 @@ int
 V2_read_line_nat(struct Map_info *Map,
 V2_read_line_nat(struct Map_info *Map,
 		 struct line_pnts *line_p, struct line_cats *line_c, int line)
 		 struct line_pnts *line_p, struct line_cats *line_c, int line)
 {
 {
-    P_LINE *Line;
+    struct P_line *Line;
 
 
     G_debug(3, "V2_read_line_nat(): line = %d", line);
     G_debug(3, "V2_read_line_nat(): line = %d", line);
 
 
@@ -153,8 +153,8 @@ V2_read_next_line_nat(struct Map_info *Map,
 		      struct line_pnts *line_p, struct line_cats *line_c)
 		      struct line_pnts *line_p, struct line_cats *line_c)
 {
 {
     register int line;
     register int line;
-    register P_LINE *Line;
-    BOUND_BOX lbox, mbox;
+    register struct P_line *Line;
+    struct bound_box lbox, mbox;
 
 
     G_debug(3, "V2_read_next_line_nat()");
     G_debug(3, "V2_read_next_line_nat()");
 
 

+ 3 - 3
lib/vector/Vlib/read_ogr.c

@@ -141,7 +141,7 @@ V1_read_next_line_ogr(struct Map_info *Map, struct line_pnts *line_p,
 		      struct line_cats *line_c)
 		      struct line_cats *line_c)
 {
 {
     int itype;
     int itype;
-    BOUND_BOX lbox, mbox;
+    struct bound_box lbox, mbox;
     OGRFeatureH hFeature;
     OGRFeatureH hFeature;
     OGRGeometryH hGeom;
     OGRGeometryH hGeom;
 
 
@@ -325,8 +325,8 @@ V2_read_line_ogr(struct Map_info *Map, struct line_pnts *line_p,
     int node;
     int node;
     int offset;
     int offset;
     long FID;
     long FID;
-    P_LINE *Line;
-    P_NODE *Node;
+    struct P_line *Line;
+    struct P_node *Node;
     OGRGeometryH hGeom;
     OGRGeometryH hGeom;
 
 
     G_debug(4, "V2_read_line_ogr() line = %d", line);
     G_debug(4, "V2_read_line_ogr() line = %d", line);

+ 1 - 1
lib/vector/Vlib/remove_duplicates.c

@@ -39,7 +39,7 @@ Vect_remove_duplicates(struct Map_info *Map, int type, struct Map_info *Err)
     struct line_cats *ACats, *BCats, *Cats;
     struct line_cats *ACats, *BCats, *Cats;
     int i, j, c, atype, btype, bline;
     int i, j, c, atype, btype, bline;
     int nlines, nbcats_orig;
     int nlines, nbcats_orig;
-    BOUND_BOX ABox;
+    struct bound_box ABox;
     struct ilist *List;
     struct ilist *List;
     int ndupl;
     int ndupl;
 
 

+ 7 - 7
lib/vector/Vlib/select.c

@@ -30,7 +30,7 @@
 
 
    \return void
    \return void
  */
  */
-void Vect_spatial_index_init(SPATIAL_INDEX * si, int with_z)
+void Vect_spatial_index_init(struct spatial_index * si, int with_z)
 {
 {
     G_debug(1, "Vect_spatial_index_init()");
     G_debug(1, "Vect_spatial_index_init()");
 
 
@@ -46,7 +46,7 @@ void Vect_spatial_index_init(SPATIAL_INDEX * si, int with_z)
 
 
    \return void
    \return void
  */
  */
-void Vect_spatial_index_destroy(SPATIAL_INDEX * si)
+void Vect_spatial_index_destroy(struct spatial_index * si)
 {
 {
     G_debug(1, "Vect_spatial_index_destroy()");
     G_debug(1, "Vect_spatial_index_destroy()");
 
 
@@ -62,8 +62,8 @@ void Vect_spatial_index_destroy(SPATIAL_INDEX * si)
 
 
    \return void
    \return void
  */
  */
-void Vect_spatial_index_add_item(SPATIAL_INDEX * si, int id,
-				 const BOUND_BOX * box)
+void Vect_spatial_index_add_item(struct spatial_index * si, int id,
+				 const struct bound_box * box)
 {
 {
     struct Rect rect;
     struct Rect rect;
 
 
@@ -86,8 +86,8 @@ void Vect_spatial_index_add_item(SPATIAL_INDEX * si, int id,
 
 
    \return void
    \return void
  */
  */
-void Vect_spatial_index_del_item(SPATIAL_INDEX * si, int id,
-				 const BOUND_BOX * box)
+void Vect_spatial_index_del_item(struct spatial_index * si, int id,
+				 const struct bound_box * box)
 {
 {
     int ret;
     int ret;
     struct Rect rect;
     struct Rect rect;
@@ -125,7 +125,7 @@ static int _add_item(int id, struct ilist *list)
    \return number of selected items
    \return number of selected items
  */
  */
 int
 int
-Vect_spatial_index_select(const SPATIAL_INDEX * si, const BOUND_BOX * box,
+Vect_spatial_index_select(const struct spatial_index * si, const struct bound_box * box,
 			  struct ilist *list)
 			  struct ilist *list)
 {
 {
     struct Rect rect;
     struct Rect rect;

+ 6 - 6
lib/vector/Vlib/sindex.c

@@ -32,12 +32,12 @@
    \return number of lines
    \return number of lines
  */
  */
 int
 int
-Vect_select_lines_by_box(struct Map_info *Map, const BOUND_BOX * Box,
+Vect_select_lines_by_box(struct Map_info *Map, const struct bound_box * Box,
 			 int type, struct ilist *list)
 			 int type, struct ilist *list)
 {
 {
     int i, line, nlines;
     int i, line, nlines;
     struct Plus_head *plus;
     struct Plus_head *plus;
-    P_LINE *Line;
+    struct P_line *Line;
     static struct ilist *LocList = NULL;
     static struct ilist *LocList = NULL;
 
 
     G_debug(3, "Vect_select_lines_by_box()");
     G_debug(3, "Vect_select_lines_by_box()");
@@ -86,7 +86,7 @@ Vect_select_lines_by_box(struct Map_info *Map, const BOUND_BOX * Box,
    \return number of areas
    \return number of areas
  */
  */
 int
 int
-Vect_select_areas_by_box(struct Map_info *Map, const BOUND_BOX * Box,
+Vect_select_areas_by_box(struct Map_info *Map, const struct bound_box * Box,
 			 struct ilist *list)
 			 struct ilist *list)
 {
 {
     int i;
     int i;
@@ -137,7 +137,7 @@ Vect_select_areas_by_box(struct Map_info *Map, const BOUND_BOX * Box,
    \return number of isles
    \return number of isles
  */
  */
 int
 int
-Vect_select_isles_by_box(struct Map_info *Map, const BOUND_BOX * Box,
+Vect_select_isles_by_box(struct Map_info *Map, const struct bound_box * Box,
 			 struct ilist *list)
 			 struct ilist *list)
 {
 {
     G_debug(3, "Vect_select_isles_by_box()");
     G_debug(3, "Vect_select_isles_by_box()");
@@ -165,7 +165,7 @@ Vect_select_isles_by_box(struct Map_info *Map, const BOUND_BOX * Box,
    \return number of nodes
    \return number of nodes
  */
  */
 int
 int
-Vect_select_nodes_by_box(struct Map_info *Map, const BOUND_BOX * Box,
+Vect_select_nodes_by_box(struct Map_info *Map, const struct bound_box * Box,
 			 struct ilist *list)
 			 struct ilist *list)
 {
 {
     struct Plus_head *plus;
     struct Plus_head *plus;
@@ -209,7 +209,7 @@ Vect_select_lines_by_polygon(struct Map_info *Map, struct line_pnts *Polygon,
 			     struct ilist *List)
 			     struct ilist *List)
 {
 {
     int i;
     int i;
-    BOUND_BOX box;
+    struct bound_box box;
     static struct line_pnts *LPoints = NULL;
     static struct line_pnts *LPoints = NULL;
     static struct ilist *LocList = NULL;
     static struct ilist *LocList = NULL;
 
 

+ 1 - 1
lib/vector/Vlib/tin.c

@@ -34,7 +34,7 @@ Vect_tin_get_z(struct Map_info *Map,
 {
 {
     int i, area, n_points;
     int i, area, n_points;
     struct Plus_head *Plus;
     struct Plus_head *Plus;
-    P_AREA *Area;
+    struct P_area *Area;
     static struct line_pnts *Points;
     static struct line_pnts *Points;
     static int first_time = 1;
     static int first_time = 1;
     double *x, *y, *z;
     double *x, *y, *z;

+ 15 - 15
lib/vector/Vlib/write_nat.c

@@ -39,7 +39,7 @@
 static void delete_area_cats_from_cidx(struct Map_info *Map, int area)
 static void delete_area_cats_from_cidx(struct Map_info *Map, int area)
 {
 {
     int i;
     int i;
-    P_AREA *Area;
+    struct P_area *Area;
     static struct line_cats *Cats = NULL;
     static struct line_cats *Cats = NULL;
 
 
     G_debug(3, "delete_area_cats_from_cidx() area = %d", area);
     G_debug(3, "delete_area_cats_from_cidx() area = %d", area);
@@ -72,7 +72,7 @@ static void delete_area_cats_from_cidx(struct Map_info *Map, int area)
 static void add_area_cats_to_cidx(struct Map_info *Map, int area)
 static void add_area_cats_to_cidx(struct Map_info *Map, int area)
 {
 {
     int i;
     int i;
-    P_AREA *Area;
+    struct P_area *Area;
     static struct line_cats *Cats = NULL;
     static struct line_cats *Cats = NULL;
 
 
     G_debug(3, "add_area_cats_to_cidx() area = %d", area);
     G_debug(3, "add_area_cats_to_cidx() area = %d", area);
@@ -134,11 +134,11 @@ static void add_line_to_topo(struct Map_info *Map, int line,
     int type, node, next_line, area, side, sel_area, new_area[2];
     int type, node, next_line, area, side, sel_area, new_area[2];
 
 
     struct Plus_head *plus;
     struct Plus_head *plus;
-    P_LINE *Line, *NLine;
-    P_NODE *Node;
-    P_AREA *Area;
+    struct P_line *Line, *NLine;
+    struct P_node *Node;
+    struct P_area *Area;
     
     
-    BOUND_BOX box, abox;
+    struct bound_box box, abox;
     
     
     plus = &(Map->plus);
     plus = &(Map->plus);
     Line = plus->Line[line];
     Line = plus->Line[line];
@@ -342,7 +342,7 @@ off_t V2_write_line_nat(struct Map_info *Map,
     int line;
     int line;
     off_t offset;
     off_t offset;
     struct Plus_head *plus;
     struct Plus_head *plus;
-    BOUND_BOX box;
+    struct bound_box box;
 
 
     line = 0;
     line = 0;
     
     
@@ -491,7 +491,7 @@ off_t V1__rewrite_line_nat(struct Map_info *Map,
     int i, n_points;
     int i, n_points;
     char rhead, nc;
     char rhead, nc;
     short field;
     short field;
-    GVFILE *dig_fp;
+    struct gvfile *dig_fp;
 
 
     dig_set_cur_port(&(Map->head.port));
     dig_set_cur_port(&(Map->head.port));
     dig_fp = &(Map->dig_fp);
     dig_fp = &(Map->dig_fp);
@@ -583,7 +583,7 @@ off_t V1__rewrite_line_nat(struct Map_info *Map,
 int V1_delete_line_nat(struct Map_info *Map, off_t offset)
 int V1_delete_line_nat(struct Map_info *Map, off_t offset)
 {
 {
     char rhead;
     char rhead;
-    GVFILE *dig_fp;
+    struct gvfile *dig_fp;
 
 
     G_debug(3, "V1_delete_line_nat(), offset = %lu", (unsigned long) offset);
     G_debug(3, "V1_delete_line_nat(), offset = %lu", (unsigned long) offset);
 
 
@@ -623,10 +623,10 @@ int V1_delete_line_nat(struct Map_info *Map, off_t offset)
 int V2_delete_line_nat(struct Map_info *Map, int line)
 int V2_delete_line_nat(struct Map_info *Map, int line)
 {
 {
     int ret, i, side, type = 0, first = 0, next_line, area;
     int ret, i, side, type = 0, first = 0, next_line, area;
-    P_LINE *Line = NULL;
-    P_AREA *Area;
+    struct P_line *Line = NULL;
+    struct P_area *Area;
     struct Plus_head *plus;
     struct Plus_head *plus;
-    BOUND_BOX box, abox;
+    struct bound_box box, abox;
     int adjacent[4], n_adjacent = 0;
     int adjacent[4], n_adjacent = 0;
     static struct line_cats *Cats = NULL;
     static struct line_cats *Cats = NULL;
 
 
@@ -822,7 +822,7 @@ int V2_delete_line_nat(struct Map_info *Map, int line)
 int V1_restore_line_nat(struct Map_info *Map, off_t offset)
 int V1_restore_line_nat(struct Map_info *Map, off_t offset)
 {
 {
     char rhead;
     char rhead;
-    GVFILE *dig_fp;
+    struct gvfile *dig_fp;
     
     
     G_debug(3, "V1_restore_line_nat(), offset = %lu", (unsigned long) offset);
     G_debug(3, "V1_restore_line_nat(), offset = %lu", (unsigned long) offset);
     
     
@@ -865,9 +865,9 @@ int V1_restore_line_nat(struct Map_info *Map, off_t offset)
 int V2_restore_line_nat(struct Map_info *Map, int line, off_t offset)
 int V2_restore_line_nat(struct Map_info *Map, int line, off_t offset)
 {
 {
     int i, ret, type;
     int i, ret, type;
-    P_LINE *Line;
+    struct P_line *Line;
     struct Plus_head *plus;
     struct Plus_head *plus;
-    BOUND_BOX box;
+    struct bound_box box;
     
     
     static struct line_pnts *points = NULL;
     static struct line_pnts *points = NULL;
     static struct line_cats *cats = NULL;
     static struct line_cats *cats = NULL;

+ 2 - 2
lib/vector/dglib/graph.h

@@ -20,8 +20,8 @@
  * best view tabstop=4
  * best view tabstop=4
  */
  */
 
 
-#ifndef _DGL_GRAPH_H_
-#define _DGL_GRAPH_H_
+#ifndef _DGL_dglGraph_s_H_
+#define _DGL_dglGraph_s_H_
 
 
 #ifdef DGL_STATS
 #ifdef DGL_STATS
 #include <time.h>
 #include <time.h>

+ 2 - 2
lib/vector/dglib/graph_v1.h

@@ -20,8 +20,8 @@
  * best view tabstop=4
  * best view tabstop=4
  */
  */
 
 
-#ifndef _DGL_GRAPH_V1_H_
-#define _DGL_GRAPH_V1_H_
+#ifndef _DGL_dglGraph_s_V1_H_
+#define _DGL_dglGraph_s_V1_H_
 
 
 #ifdef DGL_STATS
 #ifdef DGL_STATS
 #include <time.h>
 #include <time.h>

+ 2 - 2
lib/vector/dglib/graph_v2.h

@@ -20,8 +20,8 @@
  * best view tabstop=4
  * best view tabstop=4
  */
  */
 
 
-#ifndef _DGL_GRAPH_V2_H_
-#define _DGL_GRAPH_V2_H_
+#ifndef _DGL_dglGraph_s_V2_H_
+#define _DGL_dglGraph_s_V2_H_
 
 
 #ifdef DGL_STATS
 #ifdef DGL_STATS
 #include <time.h>
 #include <time.h>

+ 3 - 3
lib/vector/diglib/box.c

@@ -22,7 +22,7 @@
  *  dig_line_box ()
  *  dig_line_box ()
  *  set box to points extent
  *  set box to points extent
  */
  */
-int dig_line_box(const struct line_pnts *Points, BOUND_BOX * Box)
+int dig_line_box(const struct line_pnts *Points, struct bound_box * Box)
 {
 {
     int i;
     int i;
 
 
@@ -67,7 +67,7 @@ int dig_line_box(const struct line_pnts *Points, BOUND_BOX * Box)
  *  dig_box_copy ()
  *  dig_box_copy ()
  *  Copy B to A.
  *  Copy B to A.
  */
  */
-int dig_box_copy(BOUND_BOX * A, BOUND_BOX * B)
+int dig_box_copy(struct bound_box * A, struct bound_box * B)
 {
 {
 
 
     A->N = B->N;
     A->N = B->N;
@@ -84,7 +84,7 @@ int dig_box_copy(BOUND_BOX * A, BOUND_BOX * B)
  * dig_box_extend ()
  * dig_box_extend ()
  * Extend A by B.
  * Extend A by B.
  */
  */
-int dig_box_extend(BOUND_BOX * A, BOUND_BOX * B)
+int dig_box_extend(struct bound_box * A, struct bound_box * B)
 {
 {
 
 
     if (B->N > A->N)
     if (B->N > A->N)

+ 6 - 5
lib/vector/diglib/cindex.c

@@ -20,12 +20,13 @@
 #include <grass/gis.h>
 #include <grass/gis.h>
 #include <grass/vector.h>
 #include <grass/vector.h>
 
 
-/* 
- *  dig_cidx_init ()
- *  initit cat index
+/*! 
+ * \brief Initialize Plus_head structure (cidx)
  *
  *
- *  returns 1 OK
- *          0 on error      
+ * \param Plus pointer to Plus_head structure
+ *
+ * \return 1 OK
+ * \return 0 on error      
  */
  */
 int dig_cidx_init(struct Plus_head *Plus)
 int dig_cidx_init(struct Plus_head *Plus)
 {
 {

+ 23 - 9
lib/vector/diglib/cindex_rw.c

@@ -21,7 +21,7 @@
 #include <grass/gis.h>
 #include <grass/gis.h>
 #include <grass/vector.h>
 #include <grass/vector.h>
 
 
-int dig_write_cidx_head(GVFILE * fp, struct Plus_head *plus)
+int dig_write_cidx_head(struct gvfile * fp, struct Plus_head *plus)
 {
 {
     int i;
     int i;
     unsigned char buf[5];
     unsigned char buf[5];
@@ -110,8 +110,16 @@ int dig_write_cidx_head(GVFILE * fp, struct Plus_head *plus)
     return (0);
     return (0);
 }
 }
 
 
-/* return: 0 OK, -1 error */
-int dig_read_cidx_head(GVFILE * fp, struct Plus_head *plus)
+/*!
+  \brief Read header of cidx file
+  
+  \param fp pointer to gvfile structure
+  \param plus pointer to Plus_head strcuture
+
+  \return 0 OK
+  \return -1 error
+*/
+int dig_read_cidx_head(struct gvfile * fp, struct Plus_head *plus)
 {
 {
     unsigned char buf[5];
     unsigned char buf[5];
     int i, byte_order;
     int i, byte_order;
@@ -232,7 +240,7 @@ int dig_read_cidx_head(GVFILE * fp, struct Plus_head *plus)
 }
 }
 
 
 /* Write spatial index */
 /* Write spatial index */
-int dig_write_cidx(GVFILE * fp, struct Plus_head *plus)
+int dig_write_cidx(struct gvfile * fp, struct Plus_head *plus)
 {
 {
     int i;
     int i;
 
 
@@ -266,11 +274,17 @@ int dig_write_cidx(GVFILE * fp, struct Plus_head *plus)
     return 0;
     return 0;
 }
 }
 
 
-/* Read spatial index file 
- * returns 0 - OK
- *         1 - error
- */
-int dig_read_cidx(GVFILE * fp, struct Plus_head *plus, int head_only)
+/*!
+  \brief Read spatial index file 
+
+  \param fp pointer to gvfile structure
+  \param[in,out] plus pointer to Plus_head structure
+  \param head_only non-zero to read only head
+
+  \return 0 OK
+  \return 1 error
+*/
+int dig_read_cidx(struct gvfile * fp, struct Plus_head *plus, int head_only)
 {
 {
     int i;
     int i;
 
 

+ 27 - 27
lib/vector/diglib/file.c

@@ -29,13 +29,13 @@
 #include <grass/glocale.h>
 #include <grass/glocale.h>
 
 
 /*!
 /*!
-  \brief Get GVFILE position.
+  \brief Get struct gvfile position.
 
 
-  \param file pointer to GVFILE structure
+  \param file pointer to struct gvfile structure
 
 
   \return current file position
   \return current file position
 */
 */
-off_t dig_ftell(GVFILE *file)
+off_t dig_ftell(struct gvfile *file)
 {
 {
     if (file->loaded) /* using memory */
     if (file->loaded) /* using memory */
 	return (file->current - file->start);
 	return (file->current - file->start);
@@ -44,7 +44,7 @@ off_t dig_ftell(GVFILE *file)
 }
 }
 
 
 /*!
 /*!
-  \brief Set GVFILE position.
+  \brief Set struct gvfile position.
  
  
   Start positions:
   Start positions:
   
   
@@ -52,14 +52,14 @@ off_t dig_ftell(GVFILE *file)
    - SEEK_CUR (current position)
    - SEEK_CUR (current position)
    - SEEK_END (end)
    - SEEK_END (end)
   
   
-  \param file pointer to GVFILE structure
+  \param file pointer to struct gvfile structure
   \param offset offset position
   \param offset offset position
   \param whence start position
   \param whence start position
 
 
   \return 0 OK
   \return 0 OK
   \return -1 error
   \return -1 error
 */
 */
-int dig_fseek(GVFILE * file, off_t offset, int whence)
+int dig_fseek(struct gvfile * file, off_t offset, int whence)
 {
 {
     if (file->loaded) {	 /* using memory */
     if (file->loaded) {	 /* using memory */
 	switch (whence) {
 	switch (whence) {
@@ -82,11 +82,11 @@ int dig_fseek(GVFILE * file, off_t offset, int whence)
 }
 }
 
 
 /*!
 /*!
-  \brief Rewind GVFILE position.
+  \brief Rewind file position.
  
  
-  \param file pointer to GVFILE structure
+  \param file pointer to gvfile structure
 */
 */
-void dig_rewind(GVFILE * file)
+void dig_rewind(struct gvfile * file)
 {
 {
     if (file->loaded) {	/* using memory */
     if (file->loaded) {	/* using memory */
 	file->current = file->start;
 	file->current = file->start;
@@ -97,13 +97,13 @@ void dig_rewind(GVFILE * file)
 }
 }
 
 
 /*!
 /*!
-  \brief Flush GVFILE.
+  \brief Flush struct gvfile.
  
  
-  \param file pointer to GVFILE structure
+  \param file pointer to struct gvfile structure
 
 
   \return 0
   \return 0
 */
 */
-int dig_fflush(GVFILE * file)
+int dig_fflush(struct gvfile * file)
 {
 {
     if (file->loaded) {	/* using memory */
     if (file->loaded) {	/* using memory */
 	return 0;
 	return 0;
@@ -114,16 +114,16 @@ int dig_fflush(GVFILE * file)
 }
 }
 
 
 /*!
 /*!
-  \brief Read GVFILE.
+  \brief Read struct gvfile.
  
  
   \param[out] ptr data buffer
   \param[out] ptr data buffer
   \param size buffer size
   \param size buffer size
   \param nmemb number of members
   \param nmemb number of members
-  \param file pointer to GVFILE structure
+  \param file pointer to struct gvfile structure
 
 
   \return number of read members
   \return number of read members
  */
  */
-size_t dig_fread(void *ptr, size_t size, size_t nmemb, GVFILE *file)
+size_t dig_fread(void *ptr, size_t size, size_t nmemb, struct gvfile *file)
 {
 {
     long tot;
     long tot;
     size_t cnt;
     size_t cnt;
@@ -146,16 +146,16 @@ size_t dig_fread(void *ptr, size_t size, size_t nmemb, GVFILE *file)
 }
 }
 
 
 /*!
 /*!
-  \brief Write GVFILE.
+  \brief Write struct gvfile.
 
 
   \param ptr data buffer
   \param ptr data buffer
   \param size buffer size
   \param size buffer size
   \param nmemb number of members
   \param nmemb number of members
-  \param[out] file pointer to GVFILE structure
+  \param[out] file pointer to struct gvfile structure
 
 
   \return number of items written
   \return number of items written
  */
  */
-size_t dig_fwrite(const void *ptr, size_t size, size_t nmemb, GVFILE *file)
+size_t dig_fwrite(const void *ptr, size_t size, size_t nmemb, struct gvfile *file)
 {
 {
     if (file->loaded) {	/* using memory */
     if (file->loaded) {	/* using memory */
 	G_fatal_error(_("Writing to file loaded to memory not supported"));
 	G_fatal_error(_("Writing to file loaded to memory not supported"));
@@ -165,11 +165,11 @@ size_t dig_fwrite(const void *ptr, size_t size, size_t nmemb, GVFILE *file)
 }
 }
 
 
 /*!
 /*!
-  \brief Initialize GVFILE.
+  \brief Initialize gvfile strcuture
   
   
-  \param[out] file pointer to GVFILE structure
+  \param[in,out] file pointer to gvfile structure
 */
 */
-void dig_file_init(GVFILE *file)
+void dig_file_init(struct gvfile *file)
 {
 {
     file->file = NULL;
     file->file = NULL;
     file->start = NULL;
     file->start = NULL;
@@ -181,17 +181,17 @@ void dig_file_init(GVFILE *file)
 }
 }
 
 
 /*!
 /*!
-  \brief Load opened GVFILE to memory.
+  \brief Load opened struct gvfile to memory.
  
  
   Warning: position in file is set to the beginning.
   Warning: position in file is set to the beginning.
  
  
-  \param file pointer to GVFILE structure
+  \param file pointer to struct gvfile structure
 
 
   \return 1 loaded
   \return 1 loaded
   \return 0 not loaded
   \return 0 not loaded
   \return -1 error
   \return -1 error
 */
 */
-int dig_file_load(GVFILE * file)
+int dig_file_load(struct gvfile * file)
 {
 {
     int ret, mode, load;
     int ret, mode, load;
     const char *cmode;
     const char *cmode;
@@ -266,11 +266,11 @@ int dig_file_load(GVFILE * file)
 }
 }
 
 
 /*!
 /*!
-  \brief Free GVFILE.
+  \brief Free struct gvfile.
 
 
-  \param file pointer to GVFILE structure
+  \param file pointer to struct gvfile structure
 */
 */
-void dig_file_free(GVFILE * file)
+void dig_file_free(struct gvfile * file)
 {
 {
     if (file->loaded) {
     if (file->loaded) {
 	G_free(file->start);
 	G_free(file->start);

+ 9 - 5
lib/vector/diglib/frmt.c

@@ -20,11 +20,15 @@
 #include <grass/vector.h>
 #include <grass/vector.h>
 #include <grass/gis.h>
 #include <grass/gis.h>
 
 
-/* Read vector format.
- *
- *  Returns: format number
- *           -1 on error
- */
+/*!
+  \brief Read external vector format file
+ 
+  \param dascii format file (frmt)
+  \param[out] finfo pointer to Format_info structure
+
+  \return format code
+  \return -1 on error
+*/
 int dig_read_frmt_ascii(FILE * dascii, struct Format_info *finfo)
 int dig_read_frmt_ascii(FILE * dascii, struct Format_info *finfo)
 {
 {
     char buff[20001], buf1[1024];
     char buff[20001], buf1[1024];

+ 1 - 1
lib/vector/diglib/inside.c

@@ -30,7 +30,7 @@ dig_x_intersect(double beg_x,
     return (a + b * Y);
     return (a + b * Y);
 }
 }
 
 
-int dig_in_area_bbox(P_AREA * Area, double x, double y)
+int dig_in_area_bbox(struct P_area * Area, double x, double y)
 {
 {
 #ifdef GDEBUG
 #ifdef GDEBUG
     G_debug(3, "BBOX: (x,y) (%lf, %lf)\n", x, y);
     G_debug(3, "BBOX: (x,y) (%lf, %lf)\n", x, y);

+ 11 - 11
lib/vector/diglib/plus.c

@@ -24,7 +24,7 @@
 #include <grass/glocale.h>
 #include <grass/glocale.h>
 
 
 /*!
 /*!
- * \brief Init head structure
+ * \brief Initialize Plus_head structure
  *
  *
  * \param[in,out] Plus pointer to Plus_head structure
  * \param[in,out] Plus pointer to Plus_head structure
  *
  *
@@ -109,7 +109,7 @@ int dig_init_plus(struct Plus_head *Plus)
 void dig_free_plus_nodes(struct Plus_head *Plus)
 void dig_free_plus_nodes(struct Plus_head *Plus)
 {
 {
     int i;
     int i;
-    P_NODE *Node;
+    struct P_node *Node;
 
 
     G_debug(2, "dig_free_plus_nodes()");
     G_debug(2, "dig_free_plus_nodes()");
 
 
@@ -137,7 +137,7 @@ void dig_free_plus_nodes(struct Plus_head *Plus)
 void dig_free_plus_lines(struct Plus_head *Plus)
 void dig_free_plus_lines(struct Plus_head *Plus)
 {
 {
     int i;
     int i;
-    P_LINE *Line;
+    struct P_line *Line;
 
 
     G_debug(2, "dig_free_plus_lines()");
     G_debug(2, "dig_free_plus_lines()");
 
 
@@ -173,7 +173,7 @@ void dig_free_plus_lines(struct Plus_head *Plus)
 void dig_free_plus_areas(struct Plus_head *Plus)
 void dig_free_plus_areas(struct Plus_head *Plus)
 {
 {
     int i;
     int i;
-    P_AREA *Area;
+    struct P_area *Area;
 
 
     G_debug(2, "dig_free_plus_areas()");
     G_debug(2, "dig_free_plus_areas()");
 
 
@@ -201,7 +201,7 @@ void dig_free_plus_areas(struct Plus_head *Plus)
 void dig_free_plus_isles(struct Plus_head *Plus)
 void dig_free_plus_isles(struct Plus_head *Plus)
 {
 {
     int i;
     int i;
-    P_ISLE *Isle;
+    struct P_isle *Isle;
 
 
     G_debug(2, "dig_free_plus_isles()");
     G_debug(2, "dig_free_plus_isles()");
 
 
@@ -250,7 +250,7 @@ void dig_free_plus(struct Plus_head *Plus)
  * \return 1 on success
  * \return 1 on success
  * \return 0 on error
  * \return 0 on error
  */
  */
-int dig_load_plus(struct Plus_head *Plus, GVFILE * plus, int head_only)
+int dig_load_plus(struct Plus_head *Plus, struct gvfile * plus, int head_only)
 {
 {
     int i;
     int i;
 
 
@@ -325,7 +325,7 @@ int dig_load_plus(struct Plus_head *Plus, GVFILE * plus, int head_only)
  * \return 0 on success
  * \return 0 on success
  * \return -1 on error
  * \return -1 on error
  */
  */
-int dig_write_plus_file(GVFILE * fp_plus, struct Plus_head *Plus)
+int dig_write_plus_file(struct gvfile * fp_plus, struct Plus_head *Plus)
 {
 {
 
 
     dig_set_cur_port(&(Plus->port));
     dig_set_cur_port(&(Plus->port));
@@ -375,7 +375,7 @@ int dig_write_plus_file(GVFILE * fp_plus, struct Plus_head *Plus)
  * \return 0 on success
  * \return 0 on success
  * \return -1 on error
  * \return -1 on error
  */
  */
-int dig_write_nodes(GVFILE * plus, struct Plus_head *Plus)
+int dig_write_nodes(struct gvfile * plus, struct Plus_head *Plus)
 {
 {
     int i;
     int i;
 
 
@@ -399,7 +399,7 @@ int dig_write_nodes(GVFILE * plus, struct Plus_head *Plus)
  * \return 0 on success
  * \return 0 on success
  * \return -1 on error
  * \return -1 on error
  */
  */
-int dig_write_lines(GVFILE * plus, struct Plus_head *Plus)
+int dig_write_lines(struct gvfile * plus, struct Plus_head *Plus)
 {
 {
     int i;
     int i;
 
 
@@ -424,7 +424,7 @@ int dig_write_lines(GVFILE * plus, struct Plus_head *Plus)
  * \return 0 on success
  * \return 0 on success
  * \return -1 on error
  * \return -1 on error
  */
  */
-int dig_write_areas(GVFILE * plus, struct Plus_head *Plus)
+int dig_write_areas(struct gvfile * plus, struct Plus_head *Plus)
 {
 {
     int i;
     int i;
 
 
@@ -449,7 +449,7 @@ int dig_write_areas(GVFILE * plus, struct Plus_head *Plus)
  * \return 0 on success
  * \return 0 on success
  * \return -1 on error
  * \return -1 on error
  */
  */
-int dig_write_isles(GVFILE * plus, struct Plus_head *Plus)
+int dig_write_isles(struct gvfile * plus, struct Plus_head *Plus)
 {
 {
     int i;
     int i;
 
 

+ 21 - 21
lib/vector/diglib/plus_area.c

@@ -56,7 +56,7 @@ dig_build_area_with_line(struct Plus_head *plus, plus_t first_line, int side,
     char *p;
     char *p;
     static int array_size;	/* 0 on startup */
     static int array_size;	/* 0 on startup */
     int n_lines;
     int n_lines;
-    P_LINE *Line;
+    struct P_line *Line;
     int node;
     int node;
     const char *dstr;
     const char *dstr;
     int debug_level;
     int debug_level;
@@ -175,9 +175,9 @@ int dig_add_area(struct Plus_head *plus, int n_lines, plus_t * lines)
 {
 {
     register int i;
     register int i;
     register int area, line;
     register int area, line;
-    P_AREA *Area;
-    P_LINE *Line;
-    BOUND_BOX box, abox;
+    struct P_area *Area;
+    struct P_line *Line;
+    struct bound_box box, abox;
 
 
     G_debug(3, "dig_add_area():");
     G_debug(3, "dig_add_area():");
     /* First look if we have space in array of pointers to areas
     /* First look if we have space in array of pointers to areas
@@ -254,7 +254,7 @@ int dig_add_area(struct Plus_head *plus, int n_lines, plus_t * lines)
 int dig_area_add_isle(struct Plus_head *plus, int area, int isle)
 int dig_area_add_isle(struct Plus_head *plus, int area, int isle)
 {
 {
     int i;
     int i;
-    P_AREA *Area;
+    struct P_area *Area;
 
 
     G_debug(3, "dig_area_add_isle(): area = %d isle = %d", area, isle);
     G_debug(3, "dig_area_add_isle(): area = %d isle = %d", area, isle);
 
 
@@ -291,7 +291,7 @@ int dig_area_add_isle(struct Plus_head *plus, int area, int isle)
 int dig_area_del_isle(struct Plus_head *plus, int area, int isle)
 int dig_area_del_isle(struct Plus_head *plus, int area, int isle)
 {
 {
     int i, mv;
     int i, mv;
-    P_AREA *Area;
+    struct P_area *Area;
 
 
     G_debug(3, "dig_area_del_isle(): area = %d isle = %d", area, isle);
     G_debug(3, "dig_area_del_isle(): area = %d isle = %d", area, isle);
 
 
@@ -344,9 +344,9 @@ int dig_del_area(struct Plus_head *plus, int area)
     int i, line;
     int i, line;
 
 
     /* int    isle, area_out; */
     /* int    isle, area_out; */
-    P_AREA *Area;
-    P_LINE *Line;
-    P_ISLE *Isle;
+    struct P_area *Area;
+    struct P_line *Line;
+    struct P_isle *Isle;
 
 
     G_debug(3, "dig_del_area() area =  %d", area);
     G_debug(3, "dig_del_area() area =  %d", area);
     Area = plus->Area[area];
     Area = plus->Area[area];
@@ -440,9 +440,9 @@ int dig_del_area(struct Plus_head *plus, int area)
  *
  *
  * \return 1
  * \return 1
  */
  */
-int dig_area_set_box(struct Plus_head *plus, plus_t area, BOUND_BOX * Box)
+int dig_area_set_box(struct Plus_head *plus, plus_t area, struct bound_box * Box)
 {
 {
-    P_AREA *Area;
+    struct P_area *Area;
 
 
     Area = plus->Area[area];
     Area = plus->Area[area];
 
 
@@ -480,8 +480,8 @@ dig_angle_next_line(struct Plus_head *plus, plus_t current_line, int side,
     int current;
     int current;
     int line;
     int line;
     plus_t node;
     plus_t node;
-    P_NODE *Node;
-    P_LINE *Line;
+    struct P_node *Node;
+    struct P_line *Line;
     const char *dstr;
     const char *dstr;
     int debug_level;
     int debug_level;
 
 
@@ -582,7 +582,7 @@ int dig_node_angle_check(struct Plus_head *plus, plus_t line, int type)
     int next, prev;
     int next, prev;
     float angle1, angle2;
     float angle1, angle2;
     plus_t node;
     plus_t node;
-    P_LINE *Line;
+    struct P_line *Line;
 
 
     G_debug(3, "dig_node_angle_check: line = %d, type = %d", line, type);
     G_debug(3, "dig_node_angle_check: line = %d, type = %d", line, type);
 
 
@@ -637,9 +637,9 @@ int dig_add_isle(struct Plus_head *plus, int n_lines, plus_t * lines)
 {
 {
     register int i;
     register int i;
     register int isle, line;
     register int isle, line;
-    P_ISLE *Isle;
-    P_LINE *Line;
-    BOUND_BOX box, abox;
+    struct P_isle *Isle;
+    struct P_line *Line;
+    struct bound_box box, abox;
 
 
     G_debug(3, "dig_add_isle():");
     G_debug(3, "dig_add_isle():");
     /* First look if we have space in array of pointers to isles
     /* First look if we have space in array of pointers to isles
@@ -719,9 +719,9 @@ int dig_add_isle(struct Plus_head *plus, int n_lines, plus_t * lines)
  *
  *
  * \return 1
  * \return 1
  */
  */
-int dig_isle_set_box(struct Plus_head *plus, plus_t isle, BOUND_BOX * Box)
+int dig_isle_set_box(struct Plus_head *plus, plus_t isle, struct bound_box * Box)
 {
 {
-    P_ISLE *Isle;
+    struct P_isle *Isle;
 
 
     Isle = plus->Isle[isle];
     Isle = plus->Isle[isle];
 
 
@@ -748,8 +748,8 @@ int dig_isle_set_box(struct Plus_head *plus, plus_t isle, BOUND_BOX * Box)
 int dig_del_isle(struct Plus_head *plus, int isle)
 int dig_del_isle(struct Plus_head *plus, int isle)
 {
 {
     int i, line;
     int i, line;
-    P_LINE *Line;
-    P_ISLE *Isle;
+    struct P_line *Line;
+    struct P_isle *Isle;
 
 
     G_debug(3, "dig_del_isle() isle =  %d", isle);
     G_debug(3, "dig_del_isle() isle =  %d", isle);
     Isle = plus->Isle[isle];
     Isle = plus->Isle[isle];

+ 10 - 10
lib/vector/diglib/plus_line.c

@@ -23,8 +23,8 @@ static int add_line(struct Plus_head *plus, int lineid, int type, const struct l
 		    off_t offset)
 		    off_t offset)
 {
 {
     int node, lp;
     int node, lp;
-    P_LINE *line;
-    BOUND_BOX box;
+    struct P_line *line;
+    struct bound_box box;
 
 
     plus->Line[lineid] = dig_alloc_line();
     plus->Line[lineid] = dig_alloc_line();
     line = plus->Line[lineid];
     line = plus->Line[lineid];
@@ -185,8 +185,8 @@ dig_restore_line(struct Plus_head *plus, int lineid,
 int dig_del_line(struct Plus_head *plus, int line)
 int dig_del_line(struct Plus_head *plus, int line)
 {
 {
     int i, mv;
     int i, mv;
-    P_LINE *Line;
-    P_NODE *Node;
+    struct P_line *Line;
+    struct P_node *Node;
 
 
     G_debug(3, "dig_del_line() line =  %d", line);
     G_debug(3, "dig_del_line() line =  %d", line);
 
 
@@ -266,7 +266,7 @@ int dig_del_line(struct Plus_head *plus, int line)
  */
  */
 plus_t dig_line_get_area(struct Plus_head * plus, plus_t line, int side)
 plus_t dig_line_get_area(struct Plus_head * plus, plus_t line, int side)
 {
 {
-    P_LINE *Line;
+    struct P_line *Line;
 
 
     Line = plus->Line[line];
     Line = plus->Line[line];
     if (side == GV_LEFT) {
     if (side == GV_LEFT) {
@@ -299,7 +299,7 @@ plus_t dig_line_get_area(struct Plus_head * plus, plus_t line, int side)
 int
 int
 dig_line_set_area(struct Plus_head *plus, plus_t line, int side, plus_t area)
 dig_line_set_area(struct Plus_head *plus, plus_t line, int side, plus_t area)
 {
 {
-    P_LINE *Line;
+    struct P_line *Line;
 
 
     Line = plus->Line[line];
     Line = plus->Line[line];
     if (side == GV_LEFT) {
     if (side == GV_LEFT) {
@@ -321,9 +321,9 @@ dig_line_set_area(struct Plus_head *plus, plus_t line, int side, plus_t area)
  *
  *
  * \return 1
  * \return 1
  */
  */
-int dig_line_set_box(struct Plus_head *plus, plus_t line, BOUND_BOX * Box)
+int dig_line_set_box(struct Plus_head *plus, plus_t line, struct bound_box * Box)
 {
 {
-    P_LINE *Line;
+    struct P_line *Line;
 
 
     Line = plus->Line[line];
     Line = plus->Line[line];
 
 
@@ -346,9 +346,9 @@ int dig_line_set_box(struct Plus_head *plus, plus_t line, BOUND_BOX * Box)
  *
  *
  * \return 1
  * \return 1
  */
  */
-int dig_line_get_box(struct Plus_head *plus, plus_t line, BOUND_BOX * Box)
+int dig_line_get_box(struct Plus_head *plus, plus_t line, struct bound_box * Box)
 {
 {
-    P_LINE *Line;
+    struct P_line *Line;
 
 
     Line = plus->Line[line];
     Line = plus->Line[line];
 
 

+ 4 - 4
lib/vector/diglib/plus_node.c

@@ -46,7 +46,7 @@ dig_node_add_line(struct Plus_head *plus, int nodeid, int lineid,
     register int i, j, nlines;
     register int i, j, nlines;
     float angle;
     float angle;
     int ret;
     int ret;
-    P_NODE *node;
+    struct P_node *node;
 
 
     G_debug(3, "dig_node_add_line(): node = %d line = %d", nodeid, lineid);
     G_debug(3, "dig_node_add_line(): node = %d line = %d", nodeid, lineid);
 
 
@@ -107,7 +107,7 @@ dig_node_add_line(struct Plus_head *plus, int nodeid, int lineid,
 int dig_add_node(struct Plus_head *plus, double x, double y, double z)
 int dig_add_node(struct Plus_head *plus, double x, double y, double z)
 {
 {
     int nnum;
     int nnum;
-    P_NODE *node;
+    struct P_node *node;
 
 
     /* First look if we have space in array of pointers to nodes
     /* First look if we have space in array of pointers to nodes
      *  and reallocate if necessary */
      *  and reallocate if necessary */
@@ -155,7 +155,7 @@ int dig_which_node(struct Plus_head *plus, double x, double y, double thresh)
     register int have_match;
     register int have_match;
     int winner;
     int winner;
     double least_dist, dist;
     double least_dist, dist;
-    P_NODE *node;
+    struct P_node *node;
 
 
     first_time = 1;
     first_time = 1;
     have_match = 0;
     have_match = 0;
@@ -203,7 +203,7 @@ int dig_which_node(struct Plus_head *plus, double x, double y, double thresh)
 float dig_node_line_angle(struct Plus_head *plus, int nodeid, int lineid)
 float dig_node_line_angle(struct Plus_head *plus, int nodeid, int lineid)
 {
 {
     int i, nlines;
     int i, nlines;
-    P_NODE *node;
+    struct P_node *node;
 
 
     G_debug(3, "dig_node_line_angle: node = %d line = %d", nodeid, lineid);
     G_debug(3, "dig_node_line_angle: node = %d line = %d", nodeid, lineid);
 
 

+ 29 - 23
lib/vector/diglib/plus_struct.c

@@ -48,10 +48,10 @@
  *    plus_t is changed to a type that is larger than an int.
  *    plus_t is changed to a type that is larger than an int.
  */
  */
 
 
-int dig_Rd_P_node(struct Plus_head *Plus, int n, GVFILE * fp)
+int dig_Rd_P_node(struct Plus_head *Plus, int n, struct gvfile * fp)
 {
 {
     int cnt, n_edges;
     int cnt, n_edges;
-    P_NODE *ptr;
+    struct P_node *ptr;
 
 
     G_debug(3, "dig_Rd_P_node()");
     G_debug(3, "dig_Rd_P_node()");
 
 
@@ -102,10 +102,10 @@ int dig_Rd_P_node(struct Plus_head *Plus, int n, GVFILE * fp)
     return (0);
     return (0);
 }
 }
 
 
-int dig_Wr_P_node(struct Plus_head *Plus, int n, GVFILE * fp)
+int dig_Wr_P_node(struct Plus_head *Plus, int n, struct gvfile * fp)
 {
 {
     int i, n_edges = 0;
     int i, n_edges = 0;
-    P_NODE *ptr;
+    struct P_node *ptr;
 
 
     G_debug(3, "dig_Wr_P_node()");
     G_debug(3, "dig_Wr_P_node()");
     ptr = Plus->Node[n];
     ptr = Plus->Node[n];
@@ -147,12 +147,12 @@ int dig_Wr_P_node(struct Plus_head *Plus, int n, GVFILE * fp)
     return (0);
     return (0);
 }
 }
 
 
-int dig_Rd_P_line(struct Plus_head *Plus, int n, GVFILE * fp)
+int dig_Rd_P_line(struct Plus_head *Plus, int n, struct gvfile * fp)
 {
 {
     int n_edges, vol;
     int n_edges, vol;
     char tp;
     char tp;
-    P_LINE *ptr;
-    P_NODE *Node;
+    struct P_line *ptr;
+    struct P_node *Node;
 
 
     G_debug(3, "dig_Rd_P_line()");
     G_debug(3, "dig_Rd_P_line()");
 
 
@@ -251,11 +251,11 @@ int dig_Rd_P_line(struct Plus_head *Plus, int n, GVFILE * fp)
     return (0);
     return (0);
 }
 }
 
 
-int dig_Wr_P_line(struct Plus_head *Plus, int n, GVFILE * fp)
+int dig_Wr_P_line(struct Plus_head *Plus, int n, struct gvfile * fp)
 {
 {
     int n_edges = 0, vol = 0;
     int n_edges = 0, vol = 0;
     char ch;
     char ch;
-    P_LINE *ptr;
+    struct P_line *ptr;
 
 
     G_debug(4, "dig_Wr_P_line() line = %d", n);
     G_debug(4, "dig_Wr_P_line() line = %d", n);
 
 
@@ -339,10 +339,10 @@ int dig_Wr_P_line(struct Plus_head *Plus, int n, GVFILE * fp)
     return (0);
     return (0);
 }
 }
 
 
-int dig_Rd_P_area(struct Plus_head *Plus, int n, GVFILE * fp)
+int dig_Rd_P_area(struct Plus_head *Plus, int n, struct gvfile * fp)
 {
 {
     int cnt;
     int cnt;
-    P_AREA *ptr;
+    struct P_area *ptr;
 
 
 #ifdef GDEBUG
 #ifdef GDEBUG
     G_debug(3, "dig_Rd_P_area(): n = %d", n);
     G_debug(3, "dig_Rd_P_area(): n = %d", n);
@@ -408,10 +408,10 @@ int dig_Rd_P_area(struct Plus_head *Plus, int n, GVFILE * fp)
     return (0);
     return (0);
 }
 }
 
 
-int dig_Wr_P_area(struct Plus_head *Plus, int n, GVFILE * fp)
+int dig_Wr_P_area(struct Plus_head *Plus, int n, struct gvfile * fp)
 {
 {
     int i;
     int i;
-    P_AREA *ptr;
+    struct P_area *ptr;
 
 
     ptr = Plus->Area[n];
     ptr = Plus->Area[n];
 
 
@@ -462,10 +462,10 @@ int dig_Wr_P_area(struct Plus_head *Plus, int n, GVFILE * fp)
     return (0);
     return (0);
 }
 }
 
 
-int dig_Rd_P_isle(struct Plus_head *Plus, int n, GVFILE * fp)
+int dig_Rd_P_isle(struct Plus_head *Plus, int n, struct gvfile * fp)
 {
 {
     int cnt;
     int cnt;
-    P_ISLE *ptr;
+    struct P_isle *ptr;
 
 
 #ifdef GDEBUG
 #ifdef GDEBUG
     G_debug(3, "dig_Rd_P_isle()");
     G_debug(3, "dig_Rd_P_isle()");
@@ -520,10 +520,10 @@ int dig_Rd_P_isle(struct Plus_head *Plus, int n, GVFILE * fp)
     return (0);
     return (0);
 }
 }
 
 
-int dig_Wr_P_isle(struct Plus_head *Plus, int n, GVFILE * fp)
+int dig_Wr_P_isle(struct Plus_head *Plus, int n, struct gvfile * fp)
 {
 {
     int i;
     int i;
-    P_ISLE *ptr;
+    struct P_isle *ptr;
 
 
     ptr = Plus->Isle[n];
     ptr = Plus->Isle[n];
 
 
@@ -566,11 +566,16 @@ int dig_Wr_P_isle(struct Plus_head *Plus, int n, GVFILE * fp)
     return (0);
     return (0);
 }
 }
 
 
-/*
-   \return -1 error
-   \return  0 OK 
- */
-int dig_Rd_Plus_head(GVFILE * fp, struct Plus_head *ptr)
+/*!
+  \brief Read Plus_head from file
+
+  \param fp pointer to gvfile structure
+  \param[in,out] ptr pointer to Plus_head structure
+
+  \return -1 error
+  \return  0 OK 
+*/
+int dig_Rd_Plus_head(struct gvfile * fp, struct Plus_head *ptr)
 {
 {
     unsigned char buf[5];
     unsigned char buf[5];
     int byte_order;
     int byte_order;
@@ -614,6 +619,7 @@ int dig_Rd_Plus_head(GVFILE * fp, struct Plus_head *ptr)
 	     ptr->Version_Major, ptr->Version_Minor);
 	     ptr->Version_Major, ptr->Version_Minor);
     }
     }
 
 
+    /* init Port_info structure and set as default */
     dig_init_portable(&(ptr->port), byte_order);
     dig_init_portable(&(ptr->port), byte_order);
     dig_set_cur_port(&(ptr->port));
     dig_set_cur_port(&(ptr->port));
 
 
@@ -714,7 +720,7 @@ int dig_Rd_Plus_head(GVFILE * fp, struct Plus_head *ptr)
     return (0);
     return (0);
 }
 }
 
 
-int dig_Wr_Plus_head(GVFILE * fp, struct Plus_head *ptr)
+int dig_Wr_Plus_head(struct gvfile * fp, struct Plus_head *ptr)
 {
 {
     unsigned char buf[10];
     unsigned char buf[10];
     long length = 142;
     long length = 142;

+ 1 - 1
lib/vector/diglib/port_init.c

@@ -178,7 +178,7 @@ static int find_offsets(const void *pattern, unsigned char *cnvrt,
 }
 }
 
 
 /*!
 /*!
-  \brief Initialize structures
+  \brief Initialize Port_info structures
 */
 */
 void port_init(void)
 void port_init(void)
 {
 {

+ 36 - 36
lib/vector/diglib/portable.c

@@ -73,12 +73,12 @@ static int buf_alloc(int needed)
 
 
    \param[out] buf data buffer
    \param[out] buf data buffer
    \param cnt number of members
    \param cnt number of members
-   \param fp pointer to GVFILE
+   \param fp pointer to struct gvfile
 
 
    \return 0 error
    \return 0 error
    \return 1 OK
    \return 1 OK
 */
 */
-int dig__fread_port_D(double *buf, size_t cnt, GVFILE * fp)
+int dig__fread_port_D(double *buf, size_t cnt, struct gvfile * fp)
 {
 {
     unsigned int i, j;
     unsigned int i, j;
     int ret;
     int ret;
@@ -117,12 +117,12 @@ int dig__fread_port_D(double *buf, size_t cnt, GVFILE * fp)
 
 
    \param[out] buf data buffer
    \param[out] buf data buffer
    \param cnt number of members
    \param cnt number of members
-   \param fp pointer to GVFILE
+   \param fp pointer to struct gvfile
 
 
    \return 0 error
    \return 0 error
    \return 1 OK
    \return 1 OK
 */
 */
-int dig__fread_port_F(float *buf, size_t cnt, GVFILE * fp)
+int dig__fread_port_F(float *buf, size_t cnt, struct gvfile * fp)
 {
 {
     unsigned int i, j;
     unsigned int i, j;
     int ret;
     int ret;
@@ -161,12 +161,12 @@ int dig__fread_port_F(float *buf, size_t cnt, GVFILE * fp)
 
 
    \param[out] buf data buffer
    \param[out] buf data buffer
    \param cnt number of members
    \param cnt number of members
-   \param fp pointer to GVFILE
+   \param fp pointer to struct gvfile
    \param port_off_t_size offset
    \param port_off_t_size offset
    \return 0 error
    \return 0 error
    \return 1 OK
    \return 1 OK
 */
 */
-int dig__fread_port_O(off_t *buf, size_t cnt, GVFILE * fp, size_t port_off_t_size)
+int dig__fread_port_O(off_t *buf, size_t cnt, struct gvfile * fp, size_t port_off_t_size)
 {
 {
     unsigned int i, j;
     unsigned int i, j;
     int ret;
     int ret;
@@ -256,12 +256,12 @@ int dig__fread_port_O(off_t *buf, size_t cnt, GVFILE * fp, size_t port_off_t_siz
 
 
    \param[out] buf data buffer
    \param[out] buf data buffer
    \param cnt number of members
    \param cnt number of members
-   \param fp pointer to GVFILE
+   \param fp pointer to struct gvfile
 
 
    \return 0 error
    \return 0 error
    \return 1 OK
    \return 1 OK
 */
 */
-int dig__fread_port_L(long *buf, size_t cnt, GVFILE * fp)
+int dig__fread_port_L(long *buf, size_t cnt, struct gvfile * fp)
 {
 {
     unsigned int i, j;
     unsigned int i, j;
     int ret;
     int ret;
@@ -341,12 +341,12 @@ int dig__fread_port_L(long *buf, size_t cnt, GVFILE * fp)
 
 
    \param[out] buf data buffer
    \param[out] buf data buffer
    \param cnt number of members
    \param cnt number of members
-   \param fp pointer to GVFILE
+   \param fp pointer to struct gvfile
 
 
    \return 0 error
    \return 0 error
    \return 1 OK
    \return 1 OK
 */
 */
-int dig__fread_port_I(int *buf, size_t cnt, GVFILE * fp)
+int dig__fread_port_I(int *buf, size_t cnt, struct gvfile * fp)
 {
 {
     unsigned int i, j;
     unsigned int i, j;
     int ret;
     int ret;
@@ -426,12 +426,12 @@ int dig__fread_port_I(int *buf, size_t cnt, GVFILE * fp)
 
 
    \param[out] buf data buffer
    \param[out] buf data buffer
    \param cnt number of members
    \param cnt number of members
-   \param fp pointer to GVFILE
+   \param fp pointer to struct gvfile
 
 
    \return 0 error
    \return 0 error
    \return 1 OK
    \return 1 OK
 */
 */
-int dig__fread_port_S(short *buf, size_t cnt, GVFILE * fp)
+int dig__fread_port_S(short *buf, size_t cnt, struct gvfile * fp)
 {
 {
     unsigned int i, j;
     unsigned int i, j;
     int ret;
     int ret;
@@ -511,12 +511,12 @@ int dig__fread_port_S(short *buf, size_t cnt, GVFILE * fp)
 
 
    \param[out] buf data buffer
    \param[out] buf data buffer
    \param cnt number of members
    \param cnt number of members
-   \param fp pointer to GVFILE
+   \param fp pointer to gvfile structure
 
 
    \return 0 error
    \return 0 error
    \return 1 OK
    \return 1 OK
 */
 */
-int dig__fread_port_C(char *buf, size_t cnt, GVFILE * fp)
+int dig__fread_port_C(char *buf, size_t cnt, struct gvfile * fp)
 {
 {
     int ret;
     int ret;
 
 
@@ -537,12 +537,12 @@ int dig__fread_port_C(char *buf, size_t cnt, GVFILE * fp)
 
 
    \param[out] buf data buffer
    \param[out] buf data buffer
    \param cnt number of members
    \param cnt number of members
-   \param fp pointer to GVFILE
+   \param fp pointer to struct gvfile
 
 
    \return 0 error
    \return 0 error
    \return 1 OK
    \return 1 OK
 */
 */
-int dig__fread_port_P(plus_t * buf, size_t cnt, GVFILE * fp)
+int dig__fread_port_P(plus_t * buf, size_t cnt, struct gvfile * fp)
 {
 {
     int *ibuf;
     int *ibuf;
 
 
@@ -559,13 +559,13 @@ int dig__fread_port_P(plus_t * buf, size_t cnt, GVFILE * fp)
 
 
    \param buf data buffer
    \param buf data buffer
    \param cnt number of members
    \param cnt number of members
-   \param[in,out] fp pointer to GVFILE
+   \param[in,out] fp pointer to struct gvfile
 
 
    \return 0 error
    \return 0 error
    \return 1 OK
    \return 1 OK
 */
 */
 int dig__fwrite_port_D(const double *buf,
 int dig__fwrite_port_D(const double *buf,
-		       size_t cnt, GVFILE * fp)
+		       size_t cnt, struct gvfile * fp)
 {
 {
     unsigned int i, j;
     unsigned int i, j;
     unsigned char *c1, *c2;
     unsigned char *c1, *c2;
@@ -598,13 +598,13 @@ int dig__fwrite_port_D(const double *buf,
 
 
    \param buf data buffer
    \param buf data buffer
    \param cnt number of members
    \param cnt number of members
-   \param[in,out] fp pointer to GVFILE
+   \param[in,out] fp pointer to struct gvfile
 
 
    \return 0 error
    \return 0 error
    \return 1 OK
    \return 1 OK
 */
 */
 int dig__fwrite_port_F(const float *buf,
 int dig__fwrite_port_F(const float *buf,
-		       size_t cnt, GVFILE * fp)
+		       size_t cnt, struct gvfile * fp)
 {
 {
     unsigned int i, j;
     unsigned int i, j;
     unsigned char *c1, *c2;
     unsigned char *c1, *c2;
@@ -637,13 +637,13 @@ int dig__fwrite_port_F(const float *buf,
 
 
    \param buf data buffer
    \param buf data buffer
    \param cnt number of members
    \param cnt number of members
-   \param[in,out] fp pointer to GVFILE
+   \param[in,out] fp pointer to struct gvfile
 
 
    \return 0 error
    \return 0 error
    \return 1 OK
    \return 1 OK
 */
 */
 int dig__fwrite_port_O(const off_t *buf,
 int dig__fwrite_port_O(const off_t *buf,
-		       size_t cnt, GVFILE * fp, size_t port_off_t_size)
+		       size_t cnt, struct gvfile * fp, size_t port_off_t_size)
 {
 {
     unsigned int i, j;
     unsigned int i, j;
     unsigned char *c1, *c2;
     unsigned char *c1, *c2;
@@ -703,13 +703,13 @@ int dig__fwrite_port_O(const off_t *buf,
 
 
    \param buf data buffer
    \param buf data buffer
    \param cnt number of members
    \param cnt number of members
-   \param[in,out] fp pointer to GVFILE
+   \param[in,out] fp pointer to struct gvfile
 
 
    \return 0 error
    \return 0 error
    \return 1 OK
    \return 1 OK
 */
 */
 int dig__fwrite_port_L(const long *buf,
 int dig__fwrite_port_L(const long *buf,
-		       size_t cnt, GVFILE * fp)
+		       size_t cnt, struct gvfile * fp)
 {
 {
     unsigned int i, j;
     unsigned int i, j;
     unsigned char *c1, *c2;
     unsigned char *c1, *c2;
@@ -759,13 +759,13 @@ int dig__fwrite_port_L(const long *buf,
 
 
    \param buf data buffer
    \param buf data buffer
    \param cnt number of members
    \param cnt number of members
-   \param[in,out] fp pointer to GVFILE
+   \param[in,out] fp pointer to struct gvfile
 
 
    \return 0 error
    \return 0 error
    \return 1 OK
    \return 1 OK
 */
 */
 int dig__fwrite_port_I(const int *buf,
 int dig__fwrite_port_I(const int *buf,
-		       size_t cnt, GVFILE * fp)
+		       size_t cnt, struct gvfile * fp)
 {
 {
     unsigned int i, j;
     unsigned int i, j;
     unsigned char *c1, *c2;
     unsigned char *c1, *c2;
@@ -815,13 +815,13 @@ int dig__fwrite_port_I(const int *buf,
 
 
    \param buf data buffer
    \param buf data buffer
    \param cnt number of members
    \param cnt number of members
-   \param[in,out] fp pointer to GVFILE
+   \param[in,out] fp pointer to struct gvfile
 
 
    \return 0 error
    \return 0 error
    \return 1 OK
    \return 1 OK
 */
 */
 int dig__fwrite_port_S(const short *buf,
 int dig__fwrite_port_S(const short *buf,
-		       size_t cnt, GVFILE * fp)
+		       size_t cnt, struct gvfile * fp)
 {
 {
     unsigned int i, j;
     unsigned int i, j;
     unsigned char *c1, *c2;
     unsigned char *c1, *c2;
@@ -872,13 +872,13 @@ int dig__fwrite_port_S(const short *buf,
 
 
    \param buf data buffer
    \param buf data buffer
    \param cnt number of members
    \param cnt number of members
-   \param[in,out] fp pointer to GVFILE
+   \param[in,out] fp pointer to struct gvfile
 
 
    \return 0 error
    \return 0 error
    \return 1 OK
    \return 1 OK
 */
 */
 int dig__fwrite_port_P(const plus_t * buf,
 int dig__fwrite_port_P(const plus_t * buf,
-		       size_t cnt, GVFILE * fp)
+		       size_t cnt, struct gvfile * fp)
 {
 {
     return (dig__fwrite_port_I((int *)buf, cnt, fp));
     return (dig__fwrite_port_I((int *)buf, cnt, fp));
 }
 }
@@ -891,13 +891,13 @@ int dig__fwrite_port_P(const plus_t * buf,
 
 
    \param buf data buffer
    \param buf data buffer
    \param cnt number of members
    \param cnt number of members
-   \param[in,out] fp pointer to GVFILE
+   \param[in,out] fp pointer to struct gvfile
 
 
    \return 0 error
    \return 0 error
    \return 1 OK
    \return 1 OK
 */
 */
 int dig__fwrite_port_C(const char *buf,
 int dig__fwrite_port_C(const char *buf,
-		       size_t cnt, GVFILE * fp)
+		       size_t cnt, struct gvfile * fp)
 {
 {
     if (dig_fwrite(buf, PORT_CHAR, cnt, fp) == cnt)
     if (dig_fwrite(buf, PORT_CHAR, cnt, fp) == cnt)
 	return 1;
 	return 1;
@@ -906,9 +906,9 @@ int dig__fwrite_port_C(const char *buf,
 }
 }
 
 
 /*!
 /*!
-  \brief Set portable info structure to byte order of file
+  \brief Set Port_info structure to byte order of file
 
 
-  \param port pointer to Port_info
+  \param port pointer to Port_info structure
   \param byte_order ENDIAN_BIG or ENDIAN_LITTLE
   \param byte_order ENDIAN_BIG or ENDIAN_LITTLE
 */
 */
 void dig_init_portable(struct Port_info *port, int byte_order)
 void dig_init_portable(struct Port_info *port, int byte_order)
@@ -1001,9 +1001,9 @@ void dig_init_portable(struct Port_info *port, int byte_order)
 }
 }
 
 
 /*!
 /*!
-  \brief set current portable info
+  \brief Set current Port_info structure
 
 
-  \param port pointer to Port_info
+  \param port pointer to Port_info structure
 
 
   \return 0
   \return 0
 */
 */

+ 11 - 11
lib/vector/diglib/spindex.c

@@ -182,7 +182,7 @@ dig_spidx_add_node(struct Plus_head *Plus, int node,
 
 
    \return 0
    \return 0
  */
  */
-int dig_spidx_add_line(struct Plus_head *Plus, int line, BOUND_BOX * box)
+int dig_spidx_add_line(struct Plus_head *Plus, int line, struct bound_box * box)
 {
 {
     struct Rect rect;
     struct Rect rect;
 
 
@@ -208,7 +208,7 @@ int dig_spidx_add_line(struct Plus_head *Plus, int line, BOUND_BOX * box)
 
 
    \return 0
    \return 0
  */
  */
-int dig_spidx_add_area(struct Plus_head *Plus, int area, BOUND_BOX * box)
+int dig_spidx_add_area(struct Plus_head *Plus, int area, struct bound_box * box)
 {
 {
     struct Rect rect;
     struct Rect rect;
 
 
@@ -235,7 +235,7 @@ int dig_spidx_add_area(struct Plus_head *Plus, int area, BOUND_BOX * box)
    \return 0
    \return 0
  */
  */
 
 
-int dig_spidx_add_isle(struct Plus_head *Plus, int isle, BOUND_BOX * box)
+int dig_spidx_add_isle(struct Plus_head *Plus, int isle, struct bound_box * box)
 {
 {
     struct Rect rect;
     struct Rect rect;
 
 
@@ -265,7 +265,7 @@ int dig_spidx_add_isle(struct Plus_head *Plus, int isle, BOUND_BOX * box)
 int dig_spidx_del_node(struct Plus_head *Plus, int node)
 int dig_spidx_del_node(struct Plus_head *Plus, int node)
 {
 {
     int ret;
     int ret;
-    P_NODE *Node;
+    struct P_node *Node;
     struct Rect rect;
     struct Rect rect;
 
 
     G_debug(3, "dig_spidx_del_node(): node = %d", node);
     G_debug(3, "dig_spidx_del_node(): node = %d", node);
@@ -299,7 +299,7 @@ int dig_spidx_del_node(struct Plus_head *Plus, int node)
  */
  */
 int dig_spidx_del_line(struct Plus_head *Plus, int line)
 int dig_spidx_del_line(struct Plus_head *Plus, int line)
 {
 {
-    P_LINE *Line;
+    struct P_line *Line;
     struct Rect rect;
     struct Rect rect;
     int ret;
     int ret;
 
 
@@ -340,7 +340,7 @@ int dig_spidx_del_line(struct Plus_head *Plus, int line)
 int dig_spidx_del_area(struct Plus_head *Plus, int area)
 int dig_spidx_del_area(struct Plus_head *Plus, int area)
 {
 {
     int ret;
     int ret;
-    P_AREA *Area;
+    struct P_area *Area;
     struct Rect rect;
     struct Rect rect;
 
 
     G_debug(3, "dig_spidx_del_area(): area = %d", area);
     G_debug(3, "dig_spidx_del_area(): area = %d", area);
@@ -379,7 +379,7 @@ int dig_spidx_del_area(struct Plus_head *Plus, int area)
 int dig_spidx_del_isle(struct Plus_head *Plus, int isle)
 int dig_spidx_del_isle(struct Plus_head *Plus, int isle)
 {
 {
     int ret;
     int ret;
-    P_ISLE *Isle;
+    struct P_isle *Isle;
     struct Rect rect;
     struct Rect rect;
 
 
     G_debug(3, "dig_spidx_del_isle(): isle = %d", isle);
     G_debug(3, "dig_spidx_del_isle(): isle = %d", isle);
@@ -419,7 +419,7 @@ static int _add_item(int id, struct ilist *list)
    \return -1 on error
    \return -1 on error
  */
  */
 int
 int
-dig_select_nodes(struct Plus_head *Plus, const BOUND_BOX * box,
+dig_select_nodes(struct Plus_head *Plus, const struct bound_box * box,
 		 struct ilist *list)
 		 struct ilist *list)
 {
 {
     struct Rect rect;
     struct Rect rect;
@@ -495,7 +495,7 @@ int dig_find_node(struct Plus_head *Plus, double x, double y, double z)
    \return number of selected lines
    \return number of selected lines
  */
  */
 int
 int
-dig_select_lines(struct Plus_head *Plus, const BOUND_BOX * box,
+dig_select_lines(struct Plus_head *Plus, const struct bound_box * box,
 		 struct ilist *list)
 		 struct ilist *list)
 {
 {
     struct Rect rect;
     struct Rect rect;
@@ -529,7 +529,7 @@ dig_select_lines(struct Plus_head *Plus, const BOUND_BOX * box,
    \return number of selected areas
    \return number of selected areas
  */
  */
 int
 int
-dig_select_areas(struct Plus_head *Plus, const BOUND_BOX * box,
+dig_select_areas(struct Plus_head *Plus, const struct bound_box * box,
 		 struct ilist *list)
 		 struct ilist *list)
 {
 {
     struct Rect rect;
     struct Rect rect;
@@ -563,7 +563,7 @@ dig_select_areas(struct Plus_head *Plus, const BOUND_BOX * box,
    \return number of selected isles
    \return number of selected isles
  */
  */
 int
 int
-dig_select_isles(struct Plus_head *Plus, const BOUND_BOX * box,
+dig_select_isles(struct Plus_head *Plus, const struct bound_box * box,
 		 struct ilist *list)
 		 struct ilist *list)
 {
 {
     struct Rect rect;
     struct Rect rect;

+ 15 - 15
lib/vector/diglib/spindex_rw.c

@@ -42,13 +42,13 @@ struct FNode			/* node for file based index */
 /*!
 /*!
    \brief Write spatial index to the file
    \brief Write spatial index to the file
 
 
-   \param[in,out] fp pointer to GVFILE
+   \param[in,out] fp pointer to struct gvfile
    \param ptr pointer to Plus_head structure
    \param ptr pointer to Plus_head structure
 
 
    \return 0 on success
    \return 0 on success
    \return -1 on error
    \return -1 on error
  */
  */
-int dig_Wr_spidx_head(GVFILE * fp, struct Plus_head *ptr)
+int dig_Wr_spidx_head(struct gvfile * fp, struct Plus_head *ptr)
 {
 {
     unsigned char buf[6];
     unsigned char buf[6];
     long length = 81;		/* header length in bytes */
     long length = 81;		/* header length in bytes */
@@ -252,13 +252,13 @@ int dig_Wr_spidx_head(GVFILE * fp, struct Plus_head *ptr)
 /*!
 /*!
    \brief Read spatial index to the file
    \brief Read spatial index to the file
 
 
-   \param fp pointer to GVFILE
+   \param fp pointer to struct gvfile
    \param[in,out] ptr pointer to Plus_head structure
    \param[in,out] ptr pointer to Plus_head structure
 
 
    \return 0 on success
    \return 0 on success
    \return -1 on error
    \return -1 on error
  */
  */
-int dig_Rd_spidx_head(GVFILE * fp, struct Plus_head *ptr)
+int dig_Rd_spidx_head(struct gvfile * fp, struct Plus_head *ptr)
 {
 {
     unsigned char buf[6];
     unsigned char buf[6];
     int byte_order;
     int byte_order;
@@ -574,16 +574,16 @@ int rtree_dump_node(FILE * fp, struct Node *n, int with_z)
    \brief Write RTree body from memory to sidx file
    \brief Write RTree body from memory to sidx file
    Must be called when new or updated vector is closed
    Must be called when new or updated vector is closed
 
 
-   \param[out] fp pointer to GVFILE
-   \param startpos offset to GVFILE where to start writing out
+   \param[out] fp pointer to struct gvfile
+   \param startpos offset to struct gvfile where to start writing out
    \param t pointer to RTree
    \param t pointer to RTree
-   \param off_t_size size of off_t used to write GVFILE
+   \param off_t_size size of off_t used to write struct gvfile
 
 
    \return -1 on error
    \return -1 on error
    \return offset to root node on success
    \return offset to root node on success
  */
  */
 
 
-static off_t rtree_write_to_sidx(GVFILE * fp, off_t startpos,
+static off_t rtree_write_to_sidx(struct gvfile * fp, off_t startpos,
 				 struct RTree *t, int off_t_size)
 				 struct RTree *t, int off_t_size)
 {
 {
     off_t nextfreepos = startpos;
     off_t nextfreepos = startpos;
@@ -666,16 +666,16 @@ static off_t rtree_write_to_sidx(GVFILE * fp, off_t startpos,
    \brief Load RTree body from sidx file to memory
    \brief Load RTree body from sidx file to memory
    Must be called when old vector is opened in update mode
    Must be called when old vector is opened in update mode
 
 
-   \param fp pointer to GVFILE
+   \param fp pointer to struct gvfile
    \param rootpos position of root node in file
    \param rootpos position of root node in file
    \param t pointer to RTree
    \param t pointer to RTree
-   \param off_t_size size of off_t used to read GVFILE
+   \param off_t_size size of off_t used to read struct gvfile
 
 
    \return -1 on error
    \return -1 on error
    \return pointer to root node on success
    \return pointer to root node on success
  */
  */
 
 
-struct Node *rtree_load_from_sidx(GVFILE * fp, off_t rootpos,
+struct Node *rtree_load_from_sidx(struct gvfile * fp, off_t rootpos,
 				  struct RTree *t, int off_t_size)
 				  struct RTree *t, int off_t_size)
 {
 {
     struct Node *newnode = NULL;
     struct Node *newnode = NULL;
@@ -773,12 +773,12 @@ struct Node *rtree_load_from_sidx(GVFILE * fp, off_t rootpos,
 /*!
 /*!
    \brief Write spatial index to the file
    \brief Write spatial index to the file
 
 
-   \param[out] fp pointer to GVFILE
+   \param[out] fp pointer to struct gvfile
    \param Plus pointer to Plus_head structure
    \param Plus pointer to Plus_head structure
 
 
    \return 0
    \return 0
  */
  */
-int dig_Wr_spidx(GVFILE * fp, struct Plus_head *Plus)
+int dig_Wr_spidx(struct gvfile * fp, struct Plus_head *Plus)
 {
 {
     G_debug(1, "dig_Wr_spidx()");
     G_debug(1, "dig_Wr_spidx()");
 
 
@@ -823,12 +823,12 @@ int dig_Wr_spidx(GVFILE * fp, struct Plus_head *Plus)
    \brief Read spatial index from spidx file
    \brief Read spatial index from spidx file
    Only needed when old vector is opened in update mode
    Only needed when old vector is opened in update mode
 
 
-   \param fp pointer to GVFILE
+   \param fp pointer to struct gvfile
    \param[in,out] Plus pointer to Plus_head structure
    \param[in,out] Plus pointer to Plus_head structure
 
 
    \return 0
    \return 0
  */
  */
-int dig_Rd_spidx(GVFILE * fp, struct Plus_head *Plus)
+int dig_Rd_spidx(struct gvfile * fp, struct Plus_head *Plus)
 {
 {
     G_debug(1, "dig_read_spindx()");
     G_debug(1, "dig_read_spindx()");
 
 

+ 28 - 28
lib/vector/diglib/struct_alloc.c

@@ -37,11 +37,11 @@
  */
  */
 
 
 /* allocate new node structure */
 /* allocate new node structure */
-P_NODE *dig_alloc_node()
+struct P_node *dig_alloc_node()
 {
 {
-    P_NODE *Node;
+    struct P_node *Node;
 
 
-    Node = (P_NODE *) G_malloc(sizeof(P_NODE));
+    Node = (struct P_node *) G_malloc(sizeof(struct P_node));
     if (Node == NULL)
     if (Node == NULL)
         return NULL;
         return NULL;
 
 
@@ -54,7 +54,7 @@ P_NODE *dig_alloc_node()
 }
 }
 
 
 /* free node structure */
 /* free node structure */
-void dig_free_node(P_NODE *Node)
+void dig_free_node(struct P_node *Node)
 {
 {
     if (Node->alloc_lines > 0) {
     if (Node->alloc_lines > 0) {
         G_free(Node->lines);
         G_free(Node->lines);
@@ -71,7 +71,7 @@ void dig_free_node(P_NODE *Node)
  **  Returns   0 ok    or    -1 on error
  **  Returns   0 ok    or    -1 on error
  */
  */
 
 
-int dig_node_alloc_line(P_NODE * node, int add)
+int dig_node_alloc_line(struct P_node * node, int add)
 {
 {
     int num;
     int num;
     char *p;
     char *p;
@@ -107,22 +107,22 @@ int dig_alloc_nodes(struct Plus_head *Plus, int add)
     char *p;
     char *p;
 
 
     size = Plus->alloc_nodes + 1 + add;
     size = Plus->alloc_nodes + 1 + add;
-    p = G_realloc(Plus->Node, size * sizeof(P_NODE *));
+    p = G_realloc(Plus->Node, size * sizeof(struct P_node *));
     if (p == NULL)
     if (p == NULL)
         return -1;
         return -1;
 
 
-    Plus->Node = (P_NODE **) p;
+    Plus->Node = (struct P_node **) p;
     Plus->alloc_nodes = size - 1;
     Plus->alloc_nodes = size - 1;
 
 
     return (0);
     return (0);
 }
 }
 
 
 /* allocate new line structure */
 /* allocate new line structure */
-P_LINE *dig_alloc_line()
+struct P_line *dig_alloc_line()
 {
 {
-    P_LINE *Line;
+    struct P_line *Line;
 
 
-    Line = (P_LINE *) G_malloc(sizeof(P_LINE));
+    Line = (struct P_line *) G_malloc(sizeof(struct P_line));
     if (Line == NULL)
     if (Line == NULL)
         return NULL;
         return NULL;
 
 
@@ -130,7 +130,7 @@ P_LINE *dig_alloc_line()
 }
 }
 
 
 /* free line structure */
 /* free line structure */
-void dig_free_line(P_LINE *Line)
+void dig_free_line(struct P_line *Line)
 {
 {
     G_free(Line);
     G_free(Line);
 }
 }
@@ -147,11 +147,11 @@ int dig_alloc_lines(struct Plus_head *Plus, int add)
     char *p;
     char *p;
 
 
     size = Plus->alloc_lines + 1 + add;
     size = Plus->alloc_lines + 1 + add;
-    p = G_realloc(Plus->Line, size * sizeof(P_LINE *));
+    p = G_realloc(Plus->Line, size * sizeof(struct P_line *));
     if (p == NULL)
     if (p == NULL)
         return -1;
         return -1;
 
 
-    Plus->Line = (P_LINE **) p;
+    Plus->Line = (struct P_line **) p;
     Plus->alloc_lines = size - 1;
     Plus->alloc_lines = size - 1;
 
 
     return (0);
     return (0);
@@ -169,11 +169,11 @@ int dig_alloc_areas(struct Plus_head *Plus, int add)
     char *p;
     char *p;
 
 
     size = Plus->alloc_areas + 1 + add;
     size = Plus->alloc_areas + 1 + add;
-    p = G_realloc(Plus->Area, size * sizeof(P_AREA *));
+    p = G_realloc(Plus->Area, size * sizeof(struct P_area *));
     if (p == NULL)
     if (p == NULL)
         return -1;
         return -1;
 
 
-    Plus->Area = (P_AREA **) p;
+    Plus->Area = (struct P_area **) p;
     Plus->alloc_areas = size - 1;
     Plus->alloc_areas = size - 1;
 
 
     return (0);
     return (0);
@@ -192,22 +192,22 @@ int dig_alloc_isles(struct Plus_head *Plus, int add)
 
 
     G_debug(3, "dig_alloc_isle():");
     G_debug(3, "dig_alloc_isle():");
     size = Plus->alloc_isles + 1 + add;
     size = Plus->alloc_isles + 1 + add;
-    p = G_realloc(Plus->Isle, size * sizeof(P_ISLE *));
+    p = G_realloc(Plus->Isle, size * sizeof(struct P_isle *));
     if (p == NULL)
     if (p == NULL)
         return -1;
         return -1;
 
 
-    Plus->Isle = (P_ISLE **) p;
+    Plus->Isle = (struct P_isle **) p;
     Plus->alloc_isles = size - 1;
     Plus->alloc_isles = size - 1;
 
 
     return (0);
     return (0);
 }
 }
 
 
 /* allocate new area structure */
 /* allocate new area structure */
-P_AREA *dig_alloc_area()
+struct P_area *dig_alloc_area()
 {
 {
-    P_AREA *Area;
+    struct P_area *Area;
 
 
-    Area = (P_AREA *) G_malloc(sizeof(P_AREA));
+    Area = (struct P_area *) G_malloc(sizeof(struct P_area));
     if (Area == NULL)
     if (Area == NULL)
         return NULL;
         return NULL;
 
 
@@ -225,7 +225,7 @@ P_AREA *dig_alloc_area()
 }
 }
 
 
 /* free area structure */
 /* free area structure */
-void dig_free_area(P_AREA *Area)
+void dig_free_area(struct P_area *Area)
 {
 {
     if (Area->alloc_lines > 0)
     if (Area->alloc_lines > 0)
         free(Area->lines);
         free(Area->lines);
@@ -237,11 +237,11 @@ void dig_free_area(P_AREA *Area)
 }
 }
 
 
 /* alloc new isle structure */
 /* alloc new isle structure */
-P_ISLE *dig_alloc_isle()
+struct P_isle *dig_alloc_isle()
 {
 {
-    P_ISLE *Isle;
+    struct P_isle *Isle;
 
 
-    Isle = (P_ISLE *) G_malloc(sizeof(P_ISLE));
+    Isle = (struct P_isle *) G_malloc(sizeof(struct P_isle));
     if (Isle == NULL)
     if (Isle == NULL)
         return NULL;
         return NULL;
 
 
@@ -255,7 +255,7 @@ P_ISLE *dig_alloc_isle()
 }
 }
 
 
 /* free isle structure */
 /* free isle structure */
-void dig_free_isle(P_ISLE *Isle)
+void dig_free_isle(struct P_isle *Isle)
 {
 {
     if (Isle->alloc_lines > 0)
     if (Isle->alloc_lines > 0)
         G_free(Isle->lines);
         G_free(Isle->lines);
@@ -337,7 +337,7 @@ int dig_alloc_cats(struct line_cats *cats, int num)
  **
  **
  **  Returns   0 ok    or    -1 on error
  **  Returns   0 ok    or    -1 on error
  */
  */
-int dig_area_alloc_line(P_AREA * area, int add)
+int dig_area_alloc_line(struct P_area * area, int add)
 {
 {
     int num;
     int num;
     char *p;
     char *p;
@@ -359,7 +359,7 @@ int dig_area_alloc_line(P_AREA * area, int add)
  **
  **
  **  Returns   0 ok    or    -1 on error
  **  Returns   0 ok    or    -1 on error
  */
  */
-int dig_area_alloc_isle(P_AREA * area, int add)
+int dig_area_alloc_isle(struct P_area * area, int add)
 {
 {
     int num;
     int num;
     char *p;
     char *p;
@@ -382,7 +382,7 @@ int dig_area_alloc_isle(P_AREA * area, int add)
  **  Returns   0 ok    or    -1 on error
  **  Returns   0 ok    or    -1 on error
  */
  */
 
 
-int dig_isle_alloc_line(P_ISLE * isle, int add)
+int dig_isle_alloc_line(struct P_isle * isle, int add)
 {
 {
     int num;
     int num;
     char *p;
     char *p;

+ 1 - 1
lib/vector/diglib/test.c

@@ -34,7 +34,7 @@ int main()
     int err;
     int err;
     int byte_order;
     int byte_order;
     struct Port_info port;
     struct Port_info port;
-    GVFILE fp;
+    struct gvfile fp;
     int port_off_t;
     int port_off_t;
 
 
     double db, td[] = { -(PORT_DOUBLE_MAX), -(D_TEST), -(PORT_DOUBLE_MIN),
     double db, td[] = { -(PORT_DOUBLE_MAX), -(D_TEST), -(PORT_DOUBLE_MIN),

+ 2 - 2
ps/ps.map/ps_vareas.c

@@ -133,8 +133,8 @@ int PS_vareas_plot(struct Map_info *P_map, int vec)
     double llx, lly, urx, ury, sc;
     double llx, lly, urx, ury, sc;
     char pat[50];
     char pat[50];
     struct line_cats *Cats;
     struct line_cats *Cats;
-    BOUND_BOX box;
-    VARRAY *Varray = NULL;
+    struct bound_box box;
+    struct varray *Varray = NULL;
     PSCOLOR color;
     PSCOLOR color;
     int centroid;
     int centroid;
 
 

+ 1 - 1
ps/ps.map/ps_vlines.c

@@ -23,7 +23,7 @@ int PS_vlines_plot(struct Map_info *P_map, int vec, int type)
     int i, k, np, line, cat, nlines, ret;
     int i, k, np, line, cat, nlines, ret;
     double *xarray, *yarray, tol = 0.1, width;
     double *xarray, *yarray, tol = 0.1, width;
     struct line_cats *Cats;
     struct line_cats *Cats;
-    VARRAY *Varray = NULL;
+    struct varray *Varray = NULL;
 
 
     /* rgbcol */
     /* rgbcol */
     dbCatValArray cvarr_rgb;
     dbCatValArray cvarr_rgb;

+ 1 - 1
ps/ps.map/ps_vpoints.c

@@ -29,7 +29,7 @@ int PS_vpoints_plot(struct Map_info *P_map, int vec, int type)
     double llx, lly, urx, ury;
     double llx, lly, urx, ury;
     int x_int, y_int, eps_exist;
     int x_int, y_int, eps_exist;
     SYMBOL *Symb;
     SYMBOL *Symb;
-    VARRAY *Varray = NULL;
+    struct varray *Varray = NULL;
 
 
     /* Attributes if sizecol is used */
     /* Attributes if sizecol is used */
     dbCatValArray cvarr_size;
     dbCatValArray cvarr_size;

+ 1 - 1
raster/r.region/main.c

@@ -203,7 +203,7 @@ int main(int argc, char *argv[])
 
 
     if ((name = parm.vect->answer)) {	/* vect= */
     if ((name = parm.vect->answer)) {	/* vect= */
 	struct Map_info Map;
 	struct Map_info Map;
-	BOUND_BOX box;
+	struct bound_box box;
 
 
 	Vect_set_open_level(1);
 	Vect_set_open_level(1);
 	if (Vect_open_old(&Map, name, "") != 1)
 	if (Vect_open_old(&Map, name, "") != 1)

+ 6 - 6
vector/lidar/lidarlib/PolimiFunct.h

@@ -98,8 +98,8 @@ struct element
 void P_zero_dim(struct Reg_dimens * /**/);
 void P_zero_dim(struct Reg_dimens * /**/);
 
 
 int P_set_regions(struct Cell_head *, /**/
 int P_set_regions(struct Cell_head *, /**/
-		  BOUND_BOX *, /**/
-		  BOUND_BOX *, /**/ struct Reg_dimens, /**/ int /**/);
+		  struct bound_box *, /**/
+		  struct bound_box *, /**/ struct Reg_dimens, /**/ int /**/);
 
 
 int P_get_orlo(int, /**/ struct Reg_dimens *, /**/ double, /**/ double /**/);
 int P_get_orlo(int, /**/ struct Reg_dimens *, /**/ double, /**/ double /**/);
 
 
@@ -115,8 +115,8 @@ double P_Mean_Calc(struct Cell_head *, /**/ struct Point *, /**/ int /**/);
 void
 void
 P_Sparse_Points(struct Map_info *, /**/
 P_Sparse_Points(struct Map_info *, /**/
 		struct Cell_head *, /**/
 		struct Cell_head *, /**/
-		BOUND_BOX, /**/
-		BOUND_BOX, /**/
+		struct bound_box, /**/
+		struct bound_box, /**/
 		double **, /**/
 		double **, /**/
 		double *, /**/
 		double *, /**/
 		int *, /**/
 		int *, /**/
@@ -131,8 +131,8 @@ P_Sparse_Points(struct Map_info *, /**/
 		dbDriver *, /**/ double, /**/ char * /**/);
 		dbDriver *, /**/ double, /**/ char * /**/);
 
 
 double **P_Regular_Points(struct Cell_head *, /**/
 double **P_Regular_Points(struct Cell_head *, /**/
-			  BOUND_BOX, /**/
-			  BOUND_BOX, /**/
+			  struct bound_box, /**/
+			  struct bound_box, /**/
 			  double **, /**/
 			  double **, /**/
 			  double *, /**/
 			  double *, /**/
 			  double, /**/
 			  double, /**/

+ 3 - 3
vector/lidar/lidarlib/raster.c

@@ -13,7 +13,7 @@
 /*------------------------------------------------------------------------------------------------*/
 /*------------------------------------------------------------------------------------------------*/
 void
 void
 P_Sparse_Points(struct Map_info *Out, struct Cell_head *Elaboration,
 P_Sparse_Points(struct Map_info *Out, struct Cell_head *Elaboration,
-		BOUND_BOX General, BOUND_BOX Overlap, double **obs,
+		struct bound_box General, struct bound_box Overlap, double **obs,
 		double *param, int *line_num, double pe, double pn,
 		double *param, int *line_num, double pe, double pn,
 		double overlap, int nsplx, int nsply, int num_points,
 		double overlap, int nsplx, int nsply, int num_points,
 		int bilin, struct line_cats *categories, dbDriver * driver,
 		int bilin, struct line_cats *categories, dbDriver * driver,
@@ -200,8 +200,8 @@ P_Sparse_Points(struct Map_info *Out, struct Cell_head *Elaboration,
 
 
 
 
 /*------------------------------------------------------------------------------------------------*/
 /*------------------------------------------------------------------------------------------------*/
-double **P_Regular_Points(struct Cell_head *Elaboration, BOUND_BOX General,
-			  BOUND_BOX Overlap, double **matrix, double *param,
+double **P_Regular_Points(struct Cell_head *Elaboration, struct bound_box General,
+			  struct bound_box Overlap, double **matrix, double *param,
 			  double passoN, double passoE, double overlap,
 			  double passoN, double passoE, double overlap,
 			  double mean, int nsplx, int nsply, int nrows,
 			  double mean, int nsplx, int nsply, int nrows,
 			  int ncols, int bilin)
 			  int ncols, int bilin)

+ 4 - 4
vector/lidar/lidarlib/zones.c

@@ -24,8 +24,8 @@ void P_zero_dim(struct Reg_dimens *dim)
 
 
 /*----------------------------------------------------------------------------------------*/
 /*----------------------------------------------------------------------------------------*/
 int
 int
-P_set_regions(struct Cell_head *Elaboration, BOUND_BOX * General,
-	      BOUND_BOX * Overlap, struct Reg_dimens dim, int type)
+P_set_regions(struct Cell_head *Elaboration, struct bound_box * General,
+	      struct bound_box * Overlap, struct Reg_dimens dim, int type)
 {
 {
     /* Set the Elaborationoration region limits-> Also set the limits of the orlo and overlapping regions->
     /* Set the Elaborationoration region limits-> Also set the limits of the orlo and overlapping regions->
      * Returns 0 on success; -1 on failure*/
      * Returns 0 on success; -1 on failure*/
@@ -126,7 +126,7 @@ P_Mean_Calc(struct Cell_head *Elaboration, struct Point *obs, int npoints)
 {
 {
     int i, mean_count = 0;
     int i, mean_count = 0;
     double mean = 0.0;
     double mean = 0.0;
-    BOUND_BOX mean_box;
+    struct bound_box mean_box;
 
 
     Vect_region_box(Elaboration, &mean_box);
     Vect_region_box(Elaboration, &mean_box);
     mean_box.W -= CONTOUR;
     mean_box.W -= CONTOUR;
@@ -158,7 +158,7 @@ struct Point *P_Read_Vector_Region_Map(struct Map_info *Map,
     struct Point *obs;
     struct Point *obs;
     struct line_pnts *points;
     struct line_pnts *points;
     struct line_cats *categories;
     struct line_cats *categories;
-    BOUND_BOX elaboration_box;
+    struct bound_box elaboration_box;
 
 
     pippo = dim_vect;
     pippo = dim_vect;
     obs = (struct Point *)G_calloc(pippo, sizeof(struct Point));
     obs = (struct Point *)G_calloc(pippo, sizeof(struct Point));

+ 2 - 2
vector/lidar/v.lidar.correction/correction.c

@@ -30,7 +30,7 @@
 void
 void
 P_Sparse_Correction(struct Map_info *In, struct Map_info *Out,
 P_Sparse_Correction(struct Map_info *In, struct Map_info *Out,
 		    struct Map_info *Terrain, struct Cell_head *Elaboration,
 		    struct Map_info *Terrain, struct Cell_head *Elaboration,
-		    BOUND_BOX General, BOUND_BOX Overlap, double **obs,
+		    struct bound_box General, struct bound_box Overlap, double **obs,
 		    double *param, int *line_num, double passoN,
 		    double *param, int *line_num, double passoN,
 		    double passoE, double overlap, double HighThresh,
 		    double passoE, double overlap, double HighThresh,
 		    double LowThresh, int nsplx, int nsply, int num_points,
 		    double LowThresh, int nsplx, int nsply, int num_points,
@@ -302,7 +302,7 @@ struct Point *P_Read_Vector_Correction(struct Map_info *Map,
     struct Point *obs;
     struct Point *obs;
     struct line_pnts *points;
     struct line_pnts *points;
     struct line_cats *categories;
     struct line_cats *categories;
-    BOUND_BOX elaboration_box;
+    struct bound_box elaboration_box;
 
 
     pippo = dim_vect;
     pippo = dim_vect;
 
 

+ 2 - 2
vector/lidar/v.lidar.correction/correction.h

@@ -12,8 +12,8 @@ P_Sparse_Correction(struct Map_info *, /**/
 		    struct Map_info *, /**/
 		    struct Map_info *, /**/
 		    struct Map_info *, /**/
 		    struct Map_info *, /**/
 		    struct Cell_head *, /**/
 		    struct Cell_head *, /**/
-		    BOUND_BOX, /**/
-		    BOUND_BOX, /**/
+		    struct bound_box, /**/
+		    struct bound_box, /**/
 		    double **, /**/
 		    double **, /**/
 		    double *, /**/
 		    double *, /**/
 		    int *, /**/
 		    int *, /**/

+ 1 - 1
vector/lidar/v.lidar.correction/main.c

@@ -54,7 +54,7 @@ int main(int argc, char *argv[])
 
 
     struct Cell_head elaboration_reg, original_reg;
     struct Cell_head elaboration_reg, original_reg;
     struct Reg_dimens dims;
     struct Reg_dimens dims;
-    BOUND_BOX general_box, overlap_box;
+    struct bound_box general_box, overlap_box;
 
 
     struct Point *observ;
     struct Point *observ;
 
 

+ 2 - 2
vector/lidar/v.lidar.edgedetection/edgedetection.c

@@ -33,7 +33,7 @@
 #include <grass/dbmi.h>
 #include <grass/dbmi.h>
     /* #include <grass/PolimiFunct.h> */
     /* #include <grass/PolimiFunct.h> */
 #include "edgedetection.h"
 #include "edgedetection.h"
-int edge_detection(struct Cell_head elaboration_reg, BOUND_BOX Overlap_Box,
+int edge_detection(struct Cell_head elaboration_reg, struct bound_box Overlap_Box,
 		   double *parBilin, double obsX, double obsY,
 		   double *parBilin, double obsX, double obsY,
 		   double *partial, double alpha, double residual,
 		   double *partial, double alpha, double residual,
 		   double gradHigh, double gradLow)
 		   double gradHigh, double gradLow)
@@ -171,7 +171,7 @@ double *Get_Gradient(struct Cell_head Elaboration, double X, double Y,
 }
 }
 
 
 void classification(struct Map_info *Out, struct Cell_head Elaboration,
 void classification(struct Map_info *Out, struct Cell_head Elaboration,
-		    BOUND_BOX General, BOUND_BOX Overlap, double **obs,
+		    struct bound_box General, struct bound_box Overlap, double **obs,
 		    double *parBilin, double *parBicub, double mean,
 		    double *parBilin, double *parBicub, double mean,
 		    double alpha, double gradHigh, double gradLow,
 		    double alpha, double gradHigh, double gradLow,
 		    double overlap, int *line_num, int num_points,
 		    double overlap, int *line_num, int num_points,

+ 3 - 3
vector/lidar/v.lidar.edgedetection/edgedetection.h

@@ -31,7 +31,7 @@
 
 
 /*---------------------------------------------------------------------------------------*/
 /*---------------------------------------------------------------------------------------*/
 int edge_detection(struct Cell_head, /**/
 int edge_detection(struct Cell_head, /**/
-		   BOUND_BOX, /**/
+		   struct bound_box, /**/
 		   double *, /**/
 		   double *, /**/
 		   double, /**/
 		   double, /**/
 		   double, /**/
 		   double, /**/
@@ -43,8 +43,8 @@ double *Get_Gradient(struct Cell_head, /**/
 
 
 void classification(struct Map_info *, /**/
 void classification(struct Map_info *, /**/
 		    struct Cell_head, /**/
 		    struct Cell_head, /**/
-		    BOUND_BOX, /**/
-		    BOUND_BOX, /**/
+		    struct bound_box, /**/
+		    struct bound_box, /**/
 		    double **, /**/
 		    double **, /**/
 		    double *, /**/
 		    double *, /**/
 		    double *, /**/
 		    double *, /**/

+ 1 - 1
vector/lidar/v.lidar.edgedetection/main.c

@@ -62,7 +62,7 @@ int main(int argc, char *argv[])
 
 
     struct Cell_head elaboration_reg, original_reg;
     struct Cell_head elaboration_reg, original_reg;
     struct Reg_dimens dims;
     struct Reg_dimens dims;
-    BOUND_BOX general_box, overlap_box;
+    struct bound_box general_box, overlap_box;
 
 
     struct Point *observ;
     struct Point *observ;
 
 

+ 0 - 0
vector/lidar/v.lidar.growing/main.c


部分文件因为文件数量过多而无法显示