Преглед на файлове

libsegment: function prefixes change from segment_ to Segment_ (trac https://trac.osgeo.org/grass/ticket/2422)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@62324 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler преди 10 години
родител
ревизия
a4be91acec
променени са 80 файла, в които са добавени 582 реда и са изтрити 580 реда
  1. 24 24
      imagery/i.segment/create_isegs.c
  2. 18 18
      imagery/i.segment/open_files.c
  3. 5 5
      imagery/i.segment/write_output.c
  4. 11 11
      include/defs/segment.h
  5. 3 3
      include/segment.h
  6. 2 2
      lib/lidar/raster.c
  7. 1 1
      lib/lidar/zones.c
  8. 3 3
      lib/python/pygrass/raster/__init__.py
  9. 15 15
      lib/python/pygrass/raster/segment.py
  10. 4 4
      lib/segment/address.c
  11. 3 3
      lib/segment/close.c
  12. 6 6
      lib/segment/flush.c
  13. 10 10
      lib/segment/format.c
  14. 4 4
      lib/segment/get.c
  15. 9 9
      lib/segment/get_row.c
  16. 6 6
      lib/segment/init.c
  17. 12 12
      lib/segment/local_proto.h
  18. 4 4
      lib/segment/open.c
  19. 8 8
      lib/segment/pagein.c
  20. 4 4
      lib/segment/pageout.c
  21. 5 5
      lib/segment/put.c
  22. 11 11
      lib/segment/put_row.c
  23. 3 3
      lib/segment/release.c
  24. 4 4
      lib/segment/seek.c
  25. 38 38
      lib/segment/segmentlib.dox
  26. 9 9
      lib/segment/setup.c
  27. 3 1
      lib/vector/Vlib/open.c
  28. 20 20
      raster/r.cost/main.c
  29. 3 3
      raster/r.flow/io.c
  30. 7 7
      raster/r.flow/mem.c
  31. 7 7
      raster/r.flow/mem.h
  32. 15 15
      raster/r.resamp.bspline/main.c
  33. 3 3
      raster/r.resamp.bspline/resamp.c
  34. 4 4
      raster/r.spreadpath/drawline.c
  35. 18 18
      raster/r.spreadpath/main.c
  36. 3 3
      raster/r.spreadpath/path_finder.c
  37. 7 7
      raster/r.stream.channel/io.c
  38. 21 21
      raster/r.stream.channel/stream_topology.c
  39. 13 13
      raster/r.stream.channel/stream_write.c
  40. 34 34
      raster/r.stream.distance/distance_calc.c
  41. 9 9
      raster/r.stream.distance/distance_init.c
  42. 7 7
      raster/r.stream.distance/io.c
  43. 6 6
      raster/r.stream.extract/bseg.c
  44. 9 9
      raster/r.stream.extract/cseg.c
  45. 9 9
      raster/r.stream.extract/dseg.c
  46. 9 9
      raster/r.stream.extract/seg.c
  47. 7 7
      raster/r.stream.order/io.c
  48. 2 2
      raster/r.stream.order/stream_raster_close.c
  49. 11 11
      raster/r.stream.order/stream_topology.c
  50. 4 4
      raster/r.stream.order/stream_vector.c
  51. 7 7
      raster/r.stream.segment/io.c
  52. 22 22
      raster/r.stream.segment/stream_topology.c
  53. 7 7
      raster/r.stream.snap/io.c
  54. 2 2
      raster/r.stream.snap/points_io.c
  55. 4 4
      raster/r.stream.snap/snap.c
  56. 7 7
      raster/r.stream.stats/io.c
  57. 12 12
      raster/r.stream.stats/stats_prepare.c
  58. 20 20
      raster/r.walk/main.c
  59. 1 1
      raster/r.watershed/seg/bseg_close.c
  60. 2 2
      raster/r.watershed/seg/bseg_get.c
  61. 2 2
      raster/r.watershed/seg/bseg_open.c
  62. 4 4
      raster/r.watershed/seg/bseg_put.c
  63. 1 1
      raster/r.watershed/seg/cseg_close.c
  64. 1 1
      raster/r.watershed/seg/cseg_get.c
  65. 2 2
      raster/r.watershed/seg/cseg_open.c
  66. 2 2
      raster/r.watershed/seg/cseg_put.c
  67. 1 1
      raster/r.watershed/seg/cseg_read.c
  68. 2 2
      raster/r.watershed/seg/cseg_write.c
  69. 1 1
      raster/r.watershed/seg/dseg_close.c
  70. 2 2
      raster/r.watershed/seg/dseg_get.c
  71. 2 2
      raster/r.watershed/seg/dseg_open.c
  72. 2 2
      raster/r.watershed/seg/dseg_put.c
  73. 1 1
      raster/r.watershed/seg/dseg_read.c
  74. 2 2
      raster/r.watershed/seg/dseg_write.c
  75. 1 1
      raster/r.watershed/seg/sseg_close.c
  76. 3 3
      raster/r.watershed/seg/sseg_get.c
  77. 2 2
      raster/r.watershed/seg/sseg_open.c
  78. 2 2
      raster/r.watershed/seg/sseg_put.c
  79. 9 9
      vector/v.surf.bspline/main.c
  80. 3 3
      vector/v.surf.bspline/resamp.c

+ 24 - 24
imagery/i.segment/create_isegs.c

@@ -143,13 +143,13 @@ int create_isegs(struct globals *globals)
 	    for (row = 0; row < globals->nrows; row++) {
 	    for (row = 0; row < globals->nrows; row++) {
 		for (col = 0; col < globals->ncols; col++) {
 		for (col = 0; col < globals->ncols; col++) {
 		    FLAG_SET(globals->null_flag, row, col);
 		    FLAG_SET(globals->null_flag, row, col);
-		    segment_get(&globals->bounds_seg, &bounds_val,
+		    Segment_get(&globals->bounds_seg, &bounds_val,
 				row, col);
 				row, col);
 
 
 		    if (!Rast_is_c_null_value(&bounds_val)
 		    if (!Rast_is_c_null_value(&bounds_val)
 		        && bounds_val == current_bound) {
 		        && bounds_val == current_bound) {
 
 
-			segment_get(&globals->rid_seg, &rid, row, col);
+			Segment_get(&globals->rid_seg, &rid, row, col);
 			if (!Rast_is_c_null_value(&rid)) {
 			if (!Rast_is_c_null_value(&rid)) {
 			    have_bound = 1;
 			    have_bound = 1;
 
 
@@ -178,7 +178,7 @@ int create_isegs(struct globals *globals)
 	flag_clear_all(globals->null_flag);
 	flag_clear_all(globals->null_flag);
 	for (row = 0; row < globals->nrows; row++) {
 	for (row = 0; row < globals->nrows; row++) {
 	    for (col = 0; col < globals->ncols; col++) {
 	    for (col = 0; col < globals->ncols; col++) {
-		segment_get(&globals->rid_seg, &rid, row, col);
+		Segment_get(&globals->rid_seg, &rid, row, col);
 		if (Rast_is_c_null_value(&rid))
 		if (Rast_is_c_null_value(&rid))
 		    FLAG_SET(globals->null_flag, row, col);
 		    FLAG_SET(globals->null_flag, row, col);
 	    }
 	    }
@@ -284,7 +284,7 @@ int region_growing(struct globals *globals)
 		Ri.col = col;
 		Ri.col = col;
 
 
 		/* get Ri's segment ID */
 		/* get Ri's segment ID */
-		segment_get(&globals->rid_seg, (void *)&Ri.id, Ri.row, Ri.col);
+		Segment_get(&globals->rid_seg, (void *)&Ri.id, Ri.row, Ri.col);
 		
 		
 		if (Ri.id < 0)
 		if (Ri.id < 0)
 		    continue;
 		    continue;
@@ -567,7 +567,7 @@ int region_growing(struct globals *globals)
 		Ri.col = col;
 		Ri.col = col;
 
 
 		/* get segment id */
 		/* get segment id */
-		segment_get(&globals->rid_seg, (void *) &Ri.id, row, col);
+		Segment_get(&globals->rid_seg, (void *) &Ri.id, row, col);
 		
 		
 		if (Ri.id < 0)
 		if (Ri.id < 0)
 		    continue;
 		    continue;
@@ -731,7 +731,7 @@ static int find_best_neighbor(struct ngbr_stats *Ri,
 			rbtree_insert(no_check_tree, &ngbr_rc);
 			rbtree_insert(no_check_tree, &ngbr_rc);
 
 
 			/* get neighbor ID */
 			/* get neighbor ID */
-			segment_get(&globals->rid_seg,
+			Segment_get(&globals->rid_seg,
 				    (void *) &(globals->ns.id),
 				    (void *) &(globals->ns.id),
 				    ngbr_rc.row, ngbr_rc.col);
 				    ngbr_rc.row, ngbr_rc.col);
 
 
@@ -867,8 +867,8 @@ void find_eight_neighbors(int p_row, int p_col,
 }
 }
 
 
 /* similarity / distance between two points based on their input raster values */
 /* similarity / distance between two points based on their input raster values */
-/* assumes first point values already saved in files->bands_seg - only run segment_get once for that value... */
-/* TODO: segment_get already happened for a[] values in the main function.  Could remove a[] from these parameters */
+/* assumes first point values already saved in files->bands_seg - only run Segment_get once for that value... */
+/* TODO: Segment_get already happened for a[] values in the main function.  Could remove a[] from these parameters */
 double calculate_euclidean_similarity(struct ngbr_stats *Ri,
 double calculate_euclidean_similarity(struct ngbr_stats *Ri,
                                       struct ngbr_stats *Rk,
                                       struct ngbr_stats *Rk,
 				      struct globals *globals)
 				      struct globals *globals)
@@ -1076,7 +1076,7 @@ int update_band_vals(int row, int col, struct reg_stats *rs,
 	              rs->count, globals->min_reg_size);
 	              rs->count, globals->min_reg_size);
     }
     }
 
 
-    segment_get(&globals->rid_seg, (void *) &rid, row, col);
+    Segment_get(&globals->rid_seg, (void *) &rid, row, col);
     
     
     if (rid != rs->id) {
     if (rid != rs->id) {
 	G_fatal_error(_("Region ids are different"));
 	G_fatal_error(_("Region ids are different"));
@@ -1088,7 +1088,7 @@ int update_band_vals(int row, int col, struct reg_stats *rs,
     }
     }
 
 
     /* update region stats */
     /* update region stats */
-    segment_put(&globals->bands_seg, (void *)rs->sum, row, col);
+    Segment_put(&globals->bands_seg, (void *)rs->sum, row, col);
     count = 1;
     count = 1;
 
 
     /* fast version for rs->count == 2 */
     /* fast version for rs->count == 2 */
@@ -1108,13 +1108,13 @@ int update_band_vals(int row, int col, struct reg_stats *rs,
 
 
 	    if ((FLAG_GET(globals->null_flag, ngbr_rc.row, ngbr_rc.col)) == 0) {
 	    if ((FLAG_GET(globals->null_flag, ngbr_rc.row, ngbr_rc.col)) == 0) {
 
 
-		segment_get(&globals->rid_seg, (void *) &rid,
+		Segment_get(&globals->rid_seg, (void *) &rid,
 			    ngbr_rc.row, ngbr_rc.col);
 			    ngbr_rc.row, ngbr_rc.col);
 		
 		
 		if (rid == rs->id) {
 		if (rid == rs->id) {
 
 
 		    /* update region stats */
 		    /* update region stats */
-		    segment_put(&globals->bands_seg,
+		    Segment_put(&globals->bands_seg,
 				(void *)rs->sum,
 				(void *)rs->sum,
 				ngbr_rc.row, ngbr_rc.col);
 				ngbr_rc.row, ngbr_rc.col);
 
 
@@ -1168,7 +1168,7 @@ int update_band_vals(int row, int col, struct reg_stats *rs,
 			    /* not yet checked, don't check it again */
 			    /* not yet checked, don't check it again */
 			    rbtree_insert(rc_check_tree, &ngbr_rc);
 			    rbtree_insert(rc_check_tree, &ngbr_rc);
 
 
-			    segment_get(&globals->rid_seg, (void *) &rid,
+			    Segment_get(&globals->rid_seg, (void *) &rid,
 					ngbr_rc.row, ngbr_rc.col);
 					ngbr_rc.row, ngbr_rc.col);
 			    
 			    
 			    if (rid == rs->id) {
 			    if (rid == rs->id) {
@@ -1177,7 +1177,7 @@ int update_band_vals(int row, int col, struct reg_stats *rs,
 				rclist_add(&rlist, ngbr_rc.row, ngbr_rc.col);
 				rclist_add(&rlist, ngbr_rc.row, ngbr_rc.col);
 
 
 				/* update region stats */
 				/* update region stats */
-				segment_put(&globals->bands_seg,
+				Segment_put(&globals->bands_seg,
 					    (void *)rs->sum,
 					    (void *)rs->sum,
 					    ngbr_rc.row, ngbr_rc.col);
 					    ngbr_rc.row, ngbr_rc.col);
 				count++;
 				count++;
@@ -1282,7 +1282,7 @@ static int merge_regions(struct ngbr_stats *Ri, struct reg_stats *Ri_rs,
 	 * need to clear candidate flag for Rk and set new id */
 	 * need to clear candidate flag for Rk and set new id */
 	 
 	 
 	/* the actual merge: change region id */
 	/* the actual merge: change region id */
-	segment_put(&globals->rid_seg, (void *) &Ri->id, Rk->row, Rk->col);
+	Segment_put(&globals->rid_seg, (void *) &Ri->id, Rk->row, Rk->col);
 
 
 	if (do_cand) {
 	if (do_cand) {
 	    do_cand = 0;
 	    do_cand = 0;
@@ -1320,12 +1320,12 @@ static int merge_regions(struct ngbr_stats *Ri, struct reg_stats *Ri_rs,
 
 
 		    if (!(FLAG_GET(globals->null_flag, ngbr_rc.row, ngbr_rc.col))) {
 		    if (!(FLAG_GET(globals->null_flag, ngbr_rc.row, ngbr_rc.col))) {
 
 
-			segment_get(&globals->rid_seg, (void *) &R_id,
+			Segment_get(&globals->rid_seg, (void *) &R_id,
 			            ngbr_rc.row, ngbr_rc.col);
 			            ngbr_rc.row, ngbr_rc.col);
 
 
 			if (R_id == Rk->id) {
 			if (R_id == Rk->id) {
 			    /* the actual merge: change region id */
 			    /* the actual merge: change region id */
-			    segment_put(&globals->rid_seg, (void *) &Ri->id, ngbr_rc.row, ngbr_rc.col);
+			    Segment_put(&globals->rid_seg, (void *) &Ri->id, ngbr_rc.row, ngbr_rc.col);
 
 
 			    /* want to check this neighbor's neighbors */
 			    /* want to check this neighbor's neighbors */
 			    rclist_add(&rlist, ngbr_rc.row, ngbr_rc.col);
 			    rclist_add(&rlist, ngbr_rc.row, ngbr_rc.col);
@@ -1347,7 +1347,7 @@ static int merge_regions(struct ngbr_stats *Ri, struct reg_stats *Ri_rs,
 	/* update region id for Ri */
 	/* update region id for Ri */
 
 
 	/* the actual merge: change region id */
 	/* the actual merge: change region id */
-	segment_put(&globals->rid_seg, (void *) &Rk->id, Ri->row, Ri->col);
+	Segment_put(&globals->rid_seg, (void *) &Rk->id, Ri->row, Ri->col);
 
 
 	rclist_init(&rlist);
 	rclist_init(&rlist);
 	rclist_add(&rlist, Ri->row, Ri->col);
 	rclist_add(&rlist, Ri->row, Ri->col);
@@ -1370,11 +1370,11 @@ static int merge_regions(struct ngbr_stats *Ri, struct reg_stats *Ri_rs,
 
 
 		    if (!(FLAG_GET(globals->null_flag, ngbr_rc.row, ngbr_rc.col))) {
 		    if (!(FLAG_GET(globals->null_flag, ngbr_rc.row, ngbr_rc.col))) {
 
 
-			segment_get(&globals->rid_seg, (void *) &R_id, ngbr_rc.row, ngbr_rc.col);
+			Segment_get(&globals->rid_seg, (void *) &R_id, ngbr_rc.row, ngbr_rc.col);
 
 
 			if (R_id == Ri->id) {
 			if (R_id == Ri->id) {
 			    /* the actual merge: change region id */
 			    /* the actual merge: change region id */
-			    segment_put(&globals->rid_seg, (void *) &Rk->id, ngbr_rc.row, ngbr_rc.col);
+			    Segment_put(&globals->rid_seg, (void *) &Rk->id, ngbr_rc.row, ngbr_rc.col);
 
 
 			    /* want to check this neighbor's neighbors */
 			    /* want to check this neighbor's neighbors */
 			    rclist_add(&rlist, ngbr_rc.row, ngbr_rc.col);
 			    rclist_add(&rlist, ngbr_rc.row, ngbr_rc.col);
@@ -1453,7 +1453,7 @@ static int set_candidate_flag(struct ngbr_stats *head, int value, struct globals
 
 
 		    if (!(FLAG_GET(globals->candidate_flag, ngbr_rc.row, ngbr_rc.col)) == value) {
 		    if (!(FLAG_GET(globals->candidate_flag, ngbr_rc.row, ngbr_rc.col)) == value) {
 
 
-			segment_get(&globals->rid_seg, (void *) &R_id, ngbr_rc.row, ngbr_rc.col);
+			Segment_get(&globals->rid_seg, (void *) &R_id, ngbr_rc.row, ngbr_rc.col);
 
 
 			if (R_id == head->id) {
 			if (R_id == head->id) {
 			    /* want to check this neighbor's neighbors */
 			    /* want to check this neighbor's neighbors */
@@ -1510,7 +1510,7 @@ static int calculate_reg_stats(int row, int col, struct reg_stats *rs,
     if (rs->id <= 0)
     if (rs->id <= 0)
 	G_fatal_error("Invalid region id %d", rs->id);
 	G_fatal_error("Invalid region id %d", rs->id);
 
 
-    segment_get(&globals->bands_seg, (void *)globals->bands_val,
+    Segment_get(&globals->bands_seg, (void *)globals->bands_val,
 		row, col);
 		row, col);
     rs->count = 1;
     rs->count = 1;
     memcpy(rs->sum, globals->bands_val, globals->datasize);
     memcpy(rs->sum, globals->bands_val, globals->datasize);
@@ -1537,7 +1537,7 @@ static int calculate_reg_stats(int row, int col, struct reg_stats *rs,
 
 
 	    if ((FLAG_GET(globals->null_flag, ngbr_rc.row, ngbr_rc.col)) == 0) {
 	    if ((FLAG_GET(globals->null_flag, ngbr_rc.row, ngbr_rc.col)) == 0) {
 
 
-		segment_get(&globals->rid_seg, (void *) &rid,
+		Segment_get(&globals->rid_seg, (void *) &rid,
 			    ngbr_rc.row, ngbr_rc.col);
 			    ngbr_rc.row, ngbr_rc.col);
 		
 		
 		if (rid == rs->id) {
 		if (rid == rs->id) {
@@ -1601,7 +1601,7 @@ static int calculate_reg_stats(int row, int col, struct reg_stats *rs,
 			    /* not yet checked, don't check it again */
 			    /* not yet checked, don't check it again */
 			    rbtree_insert(rc_check_tree, &ngbr_rc);
 			    rbtree_insert(rc_check_tree, &ngbr_rc);
 
 
-			    segment_get(&globals->rid_seg, (void *) &rid,
+			    Segment_get(&globals->rid_seg, (void *) &rid,
 					ngbr_rc.row, ngbr_rc.col);
 					ngbr_rc.row, ngbr_rc.col);
 			    
 			    
 			    if (rid == rs->id) {
 			    if (rid == rs->id) {

+ 18 - 18
imagery/i.segment/open_files.c

@@ -125,12 +125,12 @@ int open_files(struct globals *globals)
     nseg = manage_memory(srows, scols, globals);
     nseg = manage_memory(srows, scols, globals);
 
 
     /* create segment structures */
     /* create segment structures */
-    if (segment_open
+    if (Segment_open
 	(&globals->bands_seg, G_tempfile(), globals->nrows, globals->ncols, srows,
 	(&globals->bands_seg, G_tempfile(), globals->nrows, globals->ncols, srows,
 	 scols, inlen, nseg) != 1)
 	 scols, inlen, nseg) != 1)
 	G_fatal_error("Unable to create input temporary files");
 	G_fatal_error("Unable to create input temporary files");
 
 
-    if (segment_open
+    if (Segment_open
 	(&globals->rid_seg, G_tempfile(), globals->nrows, globals->ncols, srows,
 	(&globals->rid_seg, G_tempfile(), globals->nrows, globals->ncols, srows,
 	 scols, outlen, nseg * 2) != 1)
 	 scols, outlen, nseg * 2) != 1)
 	G_fatal_error("Unable to create input temporary files");
 	G_fatal_error("Unable to create input temporary files");
@@ -169,7 +169,7 @@ int open_files(struct globals *globals)
 			globals->bands_val[n] = (inbuf[n][col] - min[n]) / (max[n] - min[n]);
 			globals->bands_val[n] = (inbuf[n][col] - min[n]) / (max[n] - min[n]);
 		}
 		}
 	    }
 	    }
-	    if (segment_put(&globals->bands_seg,
+	    if (Segment_put(&globals->bands_seg,
 	                    (void *)globals->bands_val, row, col) != 1)
 	                    (void *)globals->bands_val, row, col) != 1)
 		G_fatal_error(_("Unable to write to temporary file"));
 		G_fatal_error(_("Unable to write to temporary file"));
 
 
@@ -196,7 +196,7 @@ int open_files(struct globals *globals)
 		FLAG_SET(globals->null_flag, row, col);
 		FLAG_SET(globals->null_flag, row, col);
 	    }
 	    }
 	    if (!globals->seeds || is_null) {
 	    if (!globals->seeds || is_null) {
-		if (segment_put(&globals->rid_seg,
+		if (Segment_put(&globals->rid_seg,
 		                (void *)&id, row, col) != 1)
 		                (void *)&id, row, col) != 1)
 		    G_fatal_error(_("Unable to write to temporary file"));
 		    G_fatal_error(_("Unable to write to temporary file"));
 	    }
 	    }
@@ -219,7 +219,7 @@ int open_files(struct globals *globals)
     Rast_set_c_null_value(&globals->lower_bound, 1);
     Rast_set_c_null_value(&globals->lower_bound, 1);
 
 
     if (globals->bounds_map != NULL) {
     if (globals->bounds_map != NULL) {
-	if (segment_open
+	if (Segment_open
 	    (&globals->bounds_seg, G_tempfile(), globals->nrows, globals->ncols,
 	    (&globals->bounds_seg, G_tempfile(), globals->nrows, globals->ncols,
 	     srows, scols, sizeof(CELL), nseg) != TRUE)
 	     srows, scols, sizeof(CELL), nseg) != TRUE)
 	    G_fatal_error("Unable to create bounds temporary files");
 	    G_fatal_error("Unable to create bounds temporary files");
@@ -256,7 +256,7 @@ int open_files(struct globals *globals)
 			    globals->upper_bound = bounds_val;
 			    globals->upper_bound = bounds_val;
 		    }
 		    }
 		}
 		}
-		if (segment_put(&globals->bounds_seg, &bounds_val, row, col) != 1)
+		if (Segment_put(&globals->bounds_seg, &bounds_val, row, col) != 1)
 		    G_fatal_error(_("Unable to write to temporary file"));
 		    G_fatal_error(_("Unable to write to temporary file"));
 	    }
 	    }
 	}
 	}
@@ -267,7 +267,7 @@ int open_files(struct globals *globals)
 	    G_warning(_("There are no boundary constraints in '%s'"), globals->bounds_map);
 	    G_warning(_("There are no boundary constraints in '%s'"), globals->bounds_map);
 	    Rast_set_c_null_value(&globals->upper_bound, 1);
 	    Rast_set_c_null_value(&globals->upper_bound, 1);
 	    Rast_set_c_null_value(&globals->lower_bound, 1);
 	    Rast_set_c_null_value(&globals->lower_bound, 1);
-	    segment_close(&globals->bounds_seg);
+	    Segment_close(&globals->bounds_seg);
 	    globals->bounds_map = NULL;
 	    globals->bounds_map = NULL;
 	    globals->bounds_mapset = NULL;
 	    globals->bounds_mapset = NULL;
 	}
 	}
@@ -321,7 +321,7 @@ static int load_seeds(struct globals *globals, int srows, int scols, int nseg)
     
     
     G_message(_("Loading seeds from '%s'"), globals->seeds);
     G_message(_("Loading seeds from '%s'"), globals->seeds);
 
 
-    if (segment_open
+    if (Segment_open
 	(&seeds_seg, G_tempfile(), globals->nrows, globals->ncols,
 	(&seeds_seg, G_tempfile(), globals->nrows, globals->ncols,
 	 srows, scols, sizeof(CELL), nseg) != TRUE)
 	 srows, scols, sizeof(CELL), nseg) != TRUE)
 	G_fatal_error("Unable to create bounds temporary files");
 	G_fatal_error("Unable to create bounds temporary files");
@@ -343,7 +343,7 @@ static int load_seeds(struct globals *globals, int srows, int scols, int nseg)
 		if (!Rast_is_c_null_value(&seeds_val))
 		if (!Rast_is_c_null_value(&seeds_val))
 		    have_seeds = 1;
 		    have_seeds = 1;
 	    }
 	    }
-	    if (segment_put(&seeds_seg, &seeds_val, row, col) != 1)
+	    if (Segment_put(&seeds_seg, &seeds_val, row, col) != 1)
 		G_fatal_error(_("Unable to write to temporary file"));
 		G_fatal_error(_("Unable to write to temporary file"));
 	}
 	}
     }
     }
@@ -352,7 +352,7 @@ static int load_seeds(struct globals *globals, int srows, int scols, int nseg)
 	G_warning(_("No seeds found in '%s'!"), globals->seeds);
 	G_warning(_("No seeds found in '%s'!"), globals->seeds);
 	G_free(seeds_buf);
 	G_free(seeds_buf);
 	Rast_close(seeds_fd);
 	Rast_close(seeds_fd);
-	segment_close(&seeds_seg);
+	Segment_close(&seeds_seg);
 	return 0;
 	return 0;
     }
     }
 
 
@@ -369,7 +369,7 @@ static int load_seeds(struct globals *globals, int srows, int scols, int nseg)
 	        !(FLAG_GET(globals->candidate_flag, row, col))) {
 	        !(FLAG_GET(globals->candidate_flag, row, col))) {
 
 
 		if (Rast_is_c_null_value(&(seeds_buf[col]))) {
 		if (Rast_is_c_null_value(&(seeds_buf[col]))) {
-		    if (segment_put(&globals->rid_seg, &sneg, row, col) != 1)
+		    if (Segment_put(&globals->rid_seg, &sneg, row, col) != 1)
 			G_fatal_error(_("Unable to write to temporary file"));
 			G_fatal_error(_("Unable to write to temporary file"));
 		    sneg--;
 		    sneg--;
 		    globals->n_regions--;
 		    globals->n_regions--;
@@ -386,7 +386,7 @@ static int load_seeds(struct globals *globals, int srows, int scols, int nseg)
 
 
     G_free(seeds_buf);
     G_free(seeds_buf);
     Rast_close(seeds_fd);
     Rast_close(seeds_fd);
-    segment_close(&seeds_seg);
+    Segment_close(&seeds_seg);
 
 
     globals->n_regions = spos - 1;
     globals->n_regions = spos - 1;
     
     
@@ -406,10 +406,10 @@ static int read_seed(struct globals *globals, SEGMENT *seeds_seg, struct rc *Ri,
     G_debug(4, "read_seed()");
     G_debug(4, "read_seed()");
 
 
     /* get Ri's segment ID from input seeds */
     /* get Ri's segment ID from input seeds */
-    segment_get(seeds_seg, &Ri_id, Ri->row, Ri->col);
+    Segment_get(seeds_seg, &Ri_id, Ri->row, Ri->col);
     
     
     /* set new segment id */
     /* set new segment id */
-    if (segment_put(&globals->rid_seg, &new_id, Ri->row, Ri->col) != 1)
+    if (Segment_put(&globals->rid_seg, &new_id, Ri->row, Ri->col) != 1)
 	G_fatal_error(_("Unable to write to temporary file"));
 	G_fatal_error(_("Unable to write to temporary file"));
     /* set candidate flag */
     /* set candidate flag */
     FLAG_SET(globals->candidate_flag, Ri->row, Ri->col);
     FLAG_SET(globals->candidate_flag, Ri->row, Ri->col);
@@ -418,7 +418,7 @@ static int read_seed(struct globals *globals, SEGMENT *seeds_seg, struct rc *Ri,
     globals->rs.count = 1;
     globals->rs.count = 1;
 
 
     globals->rs.id = new_id;
     globals->rs.id = new_id;
-    segment_get(&globals->bands_seg, (void *)globals->bands_val,
+    Segment_get(&globals->bands_seg, (void *)globals->bands_val,
 		Ri->row, Ri->col);
 		Ri->row, Ri->col);
 
 
     for (i = 0; i < globals->nbands; i++) {
     for (i = 0; i < globals->nbands; i++) {
@@ -455,7 +455,7 @@ static int read_seed(struct globals *globals, SEGMENT *seeds_seg, struct rc *Ri,
 		continue;
 		continue;
 	    }
 	    }
 
 
-	    segment_get(seeds_seg, (void *) &Rk_id, ngbr_rc.row, ngbr_rc.col);
+	    Segment_get(seeds_seg, (void *) &Rk_id, ngbr_rc.row, ngbr_rc.col);
 		
 		
 	    G_debug(5, "Rk ID = %d Ri ID = %d", Rk_id, Ri_id);
 	    G_debug(5, "Rk ID = %d Ri ID = %d", Rk_id, Ri_id);
 
 
@@ -464,7 +464,7 @@ static int read_seed(struct globals *globals, SEGMENT *seeds_seg, struct rc *Ri,
 	    }
 	    }
 
 
 	    /* set segment id */
 	    /* set segment id */
-	    if (segment_put(&globals->rid_seg,
+	    if (Segment_put(&globals->rid_seg,
 	                    &new_id, ngbr_rc.row, ngbr_rc.col) != 1)
 	                    &new_id, ngbr_rc.row, ngbr_rc.col) != 1)
 		G_fatal_error(_("Unable to write to temporary file"));
 		G_fatal_error(_("Unable to write to temporary file"));
 	    
 	    
@@ -475,7 +475,7 @@ static int read_seed(struct globals *globals, SEGMENT *seeds_seg, struct rc *Ri,
 	    rclist_add(&rilist, ngbr_rc.row, ngbr_rc.col);
 	    rclist_add(&rilist, ngbr_rc.row, ngbr_rc.col);
 	    
 	    
 	    /* update region stats */
 	    /* update region stats */
-	    segment_get(&globals->bands_seg, (void *)globals->bands_val,
+	    Segment_get(&globals->bands_seg, (void *)globals->bands_val,
 			ngbr_rc.row, ngbr_rc.col);
 			ngbr_rc.row, ngbr_rc.col);
 
 
 	    for (i = 0; i < globals->nbands; i++) {
 	    for (i = 0; i < globals->nbands; i++) {

+ 5 - 5
imagery/i.segment/write_output.c

@@ -38,7 +38,7 @@ int write_output(struct globals *globals)
 	for (col = 0; col < globals->ncols; col++) {
 	for (col = 0; col < globals->ncols; col++) {
 
 
 	    if (!(FLAG_GET(globals->null_flag, row, col))) {
 	    if (!(FLAG_GET(globals->null_flag, row, col))) {
-		segment_get(&globals->rid_seg, (void *) &rid, row, col);
+		Segment_get(&globals->rid_seg, (void *) &rid, row, col);
 
 
 		if (rid > 0) {
 		if (rid > 0) {
 		    outbuf[col] = rid;
 		    outbuf[col] = rid;
@@ -122,7 +122,7 @@ int write_output(struct globals *globals)
 
 
 		if (!(FLAG_GET(globals->null_flag, row, col))) {
 		if (!(FLAG_GET(globals->null_flag, row, col))) {
 		    
 		    
-		    segment_get(&globals->rid_seg, (void *) &rid, row, col);
+		    Segment_get(&globals->rid_seg, (void *) &rid, row, col);
 
 
 		    if (rid > 0) {
 		    if (rid > 0) {
 			
 			
@@ -203,14 +203,14 @@ int close_files(struct globals *globals)
 {
 {
     /* close segmentation files and output raster */
     /* close segmentation files and output raster */
     G_debug(1, "closing files");
     G_debug(1, "closing files");
-    segment_close(&globals->bands_seg);
+    Segment_close(&globals->bands_seg);
     if (globals->bounds_map)
     if (globals->bounds_map)
-	segment_close(&globals->bounds_seg);
+	Segment_close(&globals->bounds_seg);
 
 
     G_free(globals->bands_val);
     G_free(globals->bands_val);
     G_free(globals->second_val);
     G_free(globals->second_val);
 
 
-    segment_close(&globals->rid_seg);
+    Segment_close(&globals->rid_seg);
 
 
     flag_destroy(globals->null_flag);
     flag_destroy(globals->null_flag);
     flag_destroy(globals->candidate_flag);
     flag_destroy(globals->candidate_flag);

+ 11 - 11
include/defs/segment.h

@@ -1,16 +1,16 @@
 #ifndef GRASS_SEGMENTDEFS_H
 #ifndef GRASS_SEGMENTDEFS_H
 #define GRASS_SEGMENTDEFS_H
 #define GRASS_SEGMENTDEFS_H
 
 
-int segment_open(SEGMENT *, char *, off_t, off_t, int, int, int, int);
-int segment_close(SEGMENT *);
-int segment_flush(SEGMENT *);
-int segment_format(int, off_t, off_t, int, int, int);
-int segment_format_nofill(int, off_t, off_t, int, int, int);
-int segment_get(SEGMENT *, void *, off_t, off_t);
-int segment_get_row(const SEGMENT *, void *, off_t);
-int segment_init(SEGMENT *, int, int);
-int segment_put(SEGMENT *, const void *, off_t, off_t);
-int segment_put_row(const SEGMENT *, const void *, off_t);
-int segment_release(SEGMENT *);
+int Segment_open(SEGMENT *, char *, off_t, off_t, int, int, int, int);
+int Segment_close(SEGMENT *);
+int Segment_flush(SEGMENT *);
+int Segment_format(int, off_t, off_t, int, int, int);
+int Segment_format_nofill(int, off_t, off_t, int, int, int);
+int Segment_get(SEGMENT *, void *, off_t, off_t);
+int Segment_get_row(const SEGMENT *, void *, off_t);
+int Segment_init(SEGMENT *, int, int);
+int Segment_put(SEGMENT *, const void *, off_t, off_t);
+int Segment_put_row(const SEGMENT *, const void *, off_t);
+int Segment_release(SEGMENT *);
 
 
 #endif /* GRASS_SEGMENTDEFS_H */
 #endif /* GRASS_SEGMENTDEFS_H */

+ 3 - 3
include/segment.h

@@ -37,12 +37,12 @@ typedef struct
     int fast_seek;      	/* toggles fast seek mode */
     int fast_seek;      	/* toggles fast seek mode */
     int lenbits;        	/* data size bitshift */
     int lenbits;        	/* data size bitshift */
     int sizebits;       	/* segment size bitshift */
     int sizebits;       	/* segment size bitshift */
-    int (*segment_address)();
-    int (*segment_seek)();
+    int (*Segment_address)();
+    int (*Segment_seek)();
     
     
     char *fname;		/* segment file name */
     char *fname;		/* segment file name */
     int fd;			/* file descriptor to read/write segment */
     int fd;			/* file descriptor to read/write segment */
-    struct SEGMENT_SCB		/* control blocks */
+    struct Segment_SCB		/* control blocks */
     {
     {
 	char *buf;		/* data buffer */
 	char *buf;		/* data buffer */
 	char dirty;		/* dirty flag */
 	char dirty;		/* dirty flag */

+ 2 - 2
lib/lidar/raster.c

@@ -247,7 +247,7 @@ int P_Regular_Points(struct Cell_head *Elaboration, struct Cell_head *Original,
 		    dval = interpolation;
 		    dval = interpolation;
 		}
 		}
 		else {
 		else {
-		    segment_get(out_seg, &dval, row, col);
+		    Segment_get(out_seg, &dval, row, col);
 		    if ((X > Overlap.E) && (X < General.E)) {
 		    if ((X > Overlap.E) && (X < General.E)) {
 			if ((Y > Overlap.N) && (Y < General.N)) {	/* (3) */
 			if ((Y > Overlap.N) && (Y < General.N)) {	/* (3) */
 			    csi = (General.E - X) / overlap;
 			    csi = (General.E - X) / overlap;
@@ -303,7 +303,7 @@ int P_Regular_Points(struct Cell_head *Elaboration, struct Cell_head *Original,
 			}
 			}
 		    }
 		    }
 		}
 		}
-		segment_put(out_seg, &dval, row, col);
+		Segment_put(out_seg, &dval, row, col);
 	    }
 	    }
 	}			/* END COL */
 	}			/* END COL */
     }				/* END ROW */
     }				/* END ROW */

+ 1 - 1
lib/lidar/zones.c

@@ -420,7 +420,7 @@ struct Point *P_Read_Raster_Region_Map(SEGMENT *in_seg,
     for (row = startrow; row < endrow; row++) {
     for (row = startrow; row < endrow; row++) {
 	for (col = startcol; col < endcol; col++) {
 	for (col = startcol; col < endcol; col++) {
 
 
-	    segment_get(in_seg, &z, row, col);
+	    Segment_get(in_seg, &z, row, col);
 
 
 	    if (!Rast_is_d_null_value(&z)) {
 	    if (!Rast_is_d_null_value(&z)) {
 
 

+ 3 - 3
lib/python/pygrass/raster/__init__.py

@@ -254,11 +254,11 @@ class RasterSegment(RasterAbstractBase):
     segment library for cached randomly reading and writing access.
     segment library for cached randomly reading and writing access.
 
 
         * Implements the [row][col] operator for read and write access using
         * Implements the [row][col] operator for read and write access using
-          segement_get() and segment_put() functions internally
+          Segment_get() and Segment_put() functions internally
         * Implements row read and write access with the [row] operator using
         * Implements row read and write access with the [row] operator using
-          segment_get_row() segment_put_row() internally
+          Segment_get_row() Segment_put_row() internally
         * Implements the get_row() and put_row() method  using
         * Implements the get_row() and put_row() method  using
-          segment_get_row() segment_put_row() internally
+          Segment_get_row() Segment_put_row() internally
         * Implements the flush_segment() method
         * Implements the flush_segment() method
         * Implements the copying of raster maps to segments and vice verse
         * Implements the copying of raster maps to segments and vice verse
         * Overwrites the open and close methods
         * Overwrites the open and close methods

+ 15 - 15
lib/python/pygrass/raster/segment.py

@@ -48,7 +48,7 @@ class Segment(object):
         size = ctypes.sizeof(RTYPE[mapobj.mtype]['ctypes'])
         size = ctypes.sizeof(RTYPE[mapobj.mtype]['ctypes'])
         file_name = libgis.G_tempfile()
         file_name = libgis.G_tempfile()
         #import pdb; pdb.set_trace()
         #import pdb; pdb.set_trace()
-        libseg.segment_open(self.c_seg, file_name,
+        libseg.Segment_open(self.c_seg, file_name,
                             self.rows(), self.cols(),
                             self.rows(), self.cols(),
                             self.srows, self.scols,
                             self.srows, self.scols,
                             size,
                             size,
@@ -65,10 +65,10 @@ class Segment(object):
         mapobj.temp_file = file(file_name, 'w')
         mapobj.temp_file = file(file_name, 'w')
         size = ctypes.sizeof(RTYPE[mapobj.mtype]['ctypes'])
         size = ctypes.sizeof(RTYPE[mapobj.mtype]['ctypes'])
         if fill:
         if fill:
-            libseg.segment_format(mapobj.temp_file.fileno(), self.rows(),
+            libseg.Segment_format(mapobj.temp_file.fileno(), self.rows(),
                                   self.cols(), self.srows, self.scols, size)
                                   self.cols(), self.srows, self.scols, size)
         else:
         else:
-            libseg.segment_format_nofill(mapobj.temp_file.fileno(),
+            libseg.Segment_format_nofill(mapobj.temp_file.fileno(),
                                          self.rows(), self.cols(),
                                          self.rows(), self.cols(),
                                          self.srows, self.scols, size)
                                          self.srows, self.scols, size)
         # TODO: why should I close and then re-open it?
         # TODO: why should I close and then re-open it?
@@ -78,29 +78,29 @@ class Segment(object):
         if file_name == '':
         if file_name == '':
             file_name = mapobj.temp_file.name
             file_name = mapobj.temp_file.name
         mapobj.temp_file = open(file_name, 'w')
         mapobj.temp_file = open(file_name, 'w')
-        libseg.segment_init(self.c_seg, mapobj.temp_file.fileno(),
+        libseg.Segment_init(self.c_seg, mapobj.temp_file.fileno(),
                             self.segments_in_mem)
                             self.segments_in_mem)
 
 
     def get_row(self, row_index, buf):
     def get_row(self, row_index, buf):
         """Return the row using, the `segment` method"""
         """Return the row using, the `segment` method"""
-        libseg.segment_get_row(self.c_seg, buf.p, row_index)
+        libseg.Segment_get_row(self.c_seg, buf.p, row_index)
         return buf
         return buf
 
 
     def put_row(self, row_index, buf):
     def put_row(self, row_index, buf):
         """Write the row using the `segment` method"""
         """Write the row using the `segment` method"""
-        libseg.segment_put_row(self.c_seg, buf.p, row_index)
+        libseg.Segment_put_row(self.c_seg, buf.p, row_index)
 
 
     def get(self, row_index, col_index):
     def get(self, row_index, col_index):
         """Return the value of the map
         """Return the value of the map
         """
         """
-        libseg.segment_get(self.c_seg,
+        libseg.Segment_get(self.c_seg,
                            ctypes.byref(self.val), row_index, col_index)
                            ctypes.byref(self.val), row_index, col_index)
         return self.val.value
         return self.val.value
 
 
     def put(self, row_index, col_index):
     def put(self, row_index, col_index):
         """Write the value to the map
         """Write the value to the map
         """
         """
-        libseg.segment_put(self.c_seg,
+        libseg.Segment_put(self.c_seg,
                            ctypes.byref(self.val), row_index, col_index)
                            ctypes.byref(self.val), row_index, col_index)
 
 
     def get_seg_number(self, row_index, col_index):
     def get_seg_number(self, row_index, col_index):
@@ -111,19 +111,19 @@ class Segment(object):
 
 
     def flush(self):
     def flush(self):
         """Flush pending updates to disk.
         """Flush pending updates to disk.
-        Forces all pending updates generated by segment_put() to be written to
-        the segment file seg. Must be called after the final segment_put()
+        Forces all pending updates generated by Segment_put() to be written to
+        the segment file seg. Must be called after the final Segment_put()
         to force all pending updates to disk. Must also be called before the
         to force all pending updates to disk. Must also be called before the
-        first call to segment_get_row."""
-        libseg.segment_flush(self.c_seg)
+        first call to Segment_get_row."""
+        libseg.Segment_flush(self.c_seg)
 
 
     def close(self):
     def close(self):
         """Free memory allocated to segment and delete temp file.  """
         """Free memory allocated to segment and delete temp file.  """
-        libseg.segment_close(self.c_seg)
+        libseg.Segment_close(self.c_seg)
 
 
     def release(self):
     def release(self):
         """Free memory allocated to segment.
         """Free memory allocated to segment.
         Releases the allocated memory associated with the segment file seg.
         Releases the allocated memory associated with the segment file seg.
         Note: Does not close the file. Does not flush the data which may be
         Note: Does not close the file. Does not flush the data which may be
-        pending from previous segment_put() calls."""
-        libseg.segment_release(self.c_seg)
+        pending from previous Segment_put() calls."""
+        libseg.Segment_release(self.c_seg)

+ 4 - 4
lib/segment/address.c

@@ -27,7 +27,7 @@
 #define INDEX_ADJ(SEG, i) \
 #define INDEX_ADJ(SEG, i) \
     ((SEG)->fast_seek ? ((i) << (SEG)->lenbits) : ((i) * (SEG)->len))
     ((SEG)->fast_seek ? ((i) << (SEG)->lenbits) : ((i) * (SEG)->len))
 
 
-int segment_address_fast(const SEGMENT * SEG, off_t row, off_t col, int *n,
+int Segment_address_fast(const SEGMENT * SEG, off_t row, off_t col, int *n,
 			 int *index)
 			 int *index)
 {
 {
 
 
@@ -70,7 +70,7 @@ int segment_address_fast(const SEGMENT * SEG, off_t row, off_t col, int *n,
     return 0;
     return 0;
 }
 }
 
 
-int segment_address_slow(const SEGMENT * SEG, off_t row, off_t col, int *n,
+int Segment_address_slow(const SEGMENT * SEG, off_t row, off_t col, int *n,
 			 int *index)
 			 int *index)
 {
 {
     if (row) {
     if (row) {
@@ -102,7 +102,7 @@ int segment_address_slow(const SEGMENT * SEG, off_t row, off_t col, int *n,
  * \return always returns 0
  * \return always returns 0
  */
  */
 
 
-int segment_address(const SEGMENT * SEG, off_t row, off_t col, int *n, int *index)
+int Segment_address(const SEGMENT * SEG, off_t row, off_t col, int *n, int *index)
 {
 {
     /* old code
     /* old code
      *n = row / SEG->srows * SEG->spr + col / SEG->scols;
      *n = row / SEG->srows * SEG->spr + col / SEG->scols;
@@ -112,5 +112,5 @@ int segment_address(const SEGMENT * SEG, off_t row, off_t col, int *n, int *inde
     /* this function is called at least once every time data are accessed in SEG
     /* this function is called at least once every time data are accessed in SEG
      * avoid very slow modulus and divisions, modulus was the main time killer */
      * avoid very slow modulus and divisions, modulus was the main time killer */
 
 
-    return SEG->segment_address(SEG, row, col, n, index);
+    return SEG->Segment_address(SEG, row, col, n, index);
 }
 }

+ 3 - 3
lib/segment/close.c

@@ -18,7 +18,7 @@
 #include "local_proto.h"
 #include "local_proto.h"
 
 
 /**
 /**
- * \fn int segment_close (SEGMENT *SEG)
+ * \fn int Segment_close (SEGMENT *SEG)
  *
  *
  * \brief Free memory allocated to segment, delete temp file.
  * \brief Free memory allocated to segment, delete temp file.
  *
  *
@@ -30,12 +30,12 @@
  * \return -1 if SEGMENT is not available (not open)
  * \return -1 if SEGMENT is not available (not open)
  */
  */
 
 
-int segment_close(SEGMENT *SEG)
+int Segment_close(SEGMENT *SEG)
 {
 {
     if (SEG->open != 1)
     if (SEG->open != 1)
 	return -1;
 	return -1;
 
 
-    segment_release(SEG);
+    Segment_release(SEG);
     close(SEG->fd);
     close(SEG->fd);
     unlink(SEG->fname);
     unlink(SEG->fname);
 
 

+ 6 - 6
lib/segment/flush.c

@@ -16,26 +16,26 @@
 
 
 
 
 /**
 /**
- * \fn int segment_flush (SEGMENT *SEG)
+ * \fn int Segment_flush (SEGMENT *SEG)
  *
  *
  * \brief Flush pending updates to disk.
  * \brief Flush pending updates to disk.
  *
  *
- * Forces all pending updates generated by <i>segment_put()</i> to be 
+ * Forces all pending updates generated by <i>Segment_put()</i> to be 
  * written to the segment file <b>seg</b>. Must be called after the 
  * written to the segment file <b>seg</b>. Must be called after the 
- * final <i>segment_put()</i> to force all pending updates to disk. Must 
- * also be called before the first call to <i>segment_get_row</i>.
+ * final <i>Segment_put()</i> to force all pending updates to disk. Must 
+ * also be called before the first call to <i>Segment_get_row</i>.
  *
  *
  * \param[in] SEG segment
  * \param[in] SEG segment
  * \return always returns 0
  * \return always returns 0
  */
  */
 
 
-int segment_flush(SEGMENT * SEG)
+int Segment_flush(SEGMENT * SEG)
 {
 {
     int i;
     int i;
 
 
     for (i = 0; i < SEG->nseg; i++)
     for (i = 0; i < SEG->nseg; i++)
 	if (SEG->scb[i].n >= 0 && SEG->scb[i].dirty)
 	if (SEG->scb[i].n >= 0 && SEG->scb[i].dirty)
-	    segment_pageout(SEG, i);
+	    Segment_pageout(SEG, i);
 
 
     return 0;
     return 0;
 }
 }

+ 10 - 10
lib/segment/format.c

@@ -22,7 +22,7 @@
 #include "local_proto.h"
 #include "local_proto.h"
 
 
 
 
-static int _segment_format(int, off_t, off_t, int, int, int, int);
+static int _Segment_format(int, off_t, off_t, int, int, int, int);
 static int write_int(int, int);
 static int write_int(int, int);
 static int write_off_t(int, off_t);
 static int write_off_t(int, off_t);
 static int zero_fill(int, off_t);
 static int zero_fill(int, off_t);
@@ -59,10 +59,10 @@ static int zero_fill(int, off_t);
  * \return -3 if illegal parameters are passed
  * \return -3 if illegal parameters are passed
  */
  */
 
 
-int segment_format(int fd, off_t nrows, off_t ncols, int srows, int scols,
+int Segment_format(int fd, off_t nrows, off_t ncols, int srows, int scols,
 		   int len)
 		   int len)
 {
 {
-    return _segment_format(fd, nrows, ncols, srows, scols, len, 1);
+    return _Segment_format(fd, nrows, ncols, srows, scols, len, 1);
 }
 }
 
 
 /**
 /**
@@ -97,14 +97,14 @@ int segment_format(int fd, off_t nrows, off_t ncols, int srows, int scols,
  * \return -3 if illegal parameters are passed
  * \return -3 if illegal parameters are passed
  */
  */
 
 
-int segment_format_nofill(int fd, off_t nrows, off_t ncols, int srows, int scols,
+int Segment_format_nofill(int fd, off_t nrows, off_t ncols, int srows, int scols,
 			  int len)
 			  int len)
 {
 {
-    return _segment_format(fd, nrows, ncols, srows, scols, len, 0);
+    return _Segment_format(fd, nrows, ncols, srows, scols, len, 0);
 }
 }
 
 
 
 
-static int _segment_format(int fd,
+static int _Segment_format(int fd,
 			   off_t nrows, off_t ncols,
 			   off_t nrows, off_t ncols,
 			   int srows, int scols, int len, int fill)
 			   int srows, int scols, int len, int fill)
 {
 {
@@ -112,7 +112,7 @@ static int _segment_format(int fd,
     int spr, size;
     int spr, size;
 
 
     if (nrows <= 0 || ncols <= 0 || len <= 0 || srows <= 0 || scols <= 0) {
     if (nrows <= 0 || ncols <= 0 || len <= 0 || srows <= 0 || scols <= 0) {
-	G_warning("segment_format(fd,%lld,%lld,%d,%d,%d): illegal value(s)",
+	G_warning("Segment_format(fd,%lld,%lld,%d,%d,%d): illegal value(s)",
 		  nrows, ncols, srows, scols, len);
 		  nrows, ncols, srows, scols, len);
 	return -3;
 	return -3;
     }
     }
@@ -147,7 +147,7 @@ static int _segment_format(int fd,
     }
     }
 
 
     if (lseek(fd, 0L, SEEK_SET) == (off_t) -1) {
     if (lseek(fd, 0L, SEEK_SET) == (off_t) -1) {
-	G_warning("segment_format(): Unable to seek (%s)", strerror(errno));
+	G_warning("Segment_format(): Unable to seek (%s)", strerror(errno));
 	return -1;
 	return -1;
     }
     }
 
 
@@ -179,7 +179,7 @@ static int _segment_format(int fd,
 static int write_int(int fd, int n)
 static int write_int(int fd, int n)
 {
 {
     if (write(fd, &n, sizeof(int)) != sizeof(int)) {
     if (write(fd, &n, sizeof(int)) != sizeof(int)) {
-	G_warning("segment_format(): Unable to write (%s)", strerror(errno));
+	G_warning("Segment_format(): Unable to write (%s)", strerror(errno));
 	return 0;
 	return 0;
     }
     }
 
 
@@ -189,7 +189,7 @@ static int write_int(int fd, int n)
 static int write_off_t(int fd, off_t n)
 static int write_off_t(int fd, off_t n)
 {
 {
     if (write(fd, &n, sizeof(off_t)) != sizeof(off_t)) {
     if (write(fd, &n, sizeof(off_t)) != sizeof(off_t)) {
-	G_warning("segment_format(): Unable to write (%s)", strerror(errno));
+	G_warning("Segment_format(): Unable to write (%s)", strerror(errno));
 	return 0;
 	return 0;
     }
     }
 
 

+ 4 - 4
lib/segment/get.c

@@ -17,7 +17,7 @@
 
 
 
 
 /*bugfix: buf: char* vs int* -> wrong pointer arithmetics!!!. Pierre de Mouveaux - 09 april 2000 */
 /*bugfix: buf: char* vs int* -> wrong pointer arithmetics!!!. Pierre de Mouveaux - 09 april 2000 */
-/* int segment_get (SEGMENT *SEG, register int *buf,int row,int col) */
+/* int Segment_get (SEGMENT *SEG, register int *buf,int row,int col) */
 
 
 
 
 /**
 /**
@@ -36,12 +36,12 @@
  * \return -1 if unable to seek or read segment file
  * \return -1 if unable to seek or read segment file
  */
  */
 
 
-int segment_get(SEGMENT * SEG, void *buf, off_t row, off_t col)
+int Segment_get(SEGMENT * SEG, void *buf, off_t row, off_t col)
 {
 {
     int index, n, i;
     int index, n, i;
 
 
-    SEG->segment_address(SEG, row, col, &n, &index);
-    if ((i = segment_pagein(SEG, n)) < 0)
+    SEG->Segment_address(SEG, row, col, &n, &index);
+    if ((i = Segment_pagein(SEG, n)) < 0)
 	return -1;
 	return -1;
 
 
     memcpy(buf, &SEG->scb[i].buf[index], SEG->len);
     memcpy(buf, &SEG->scb[i].buf[index], SEG->len);

+ 9 - 9
lib/segment/get_row.c

@@ -21,14 +21,14 @@
 
 
 
 
 /**
 /**
- * \fn int segment_get_row (SEGMENT *SEG, void *buf, int row)
+ * \fn int Segment_get_row (SEGMENT *SEG, void *buf, int row)
  *
  *
  * \brief Read row from segment file.
  * \brief Read row from segment file.
  *
  *
  * Transfers data from a segment file, row by row, into memory
  * Transfers data from a segment file, row by row, into memory
  * (which can then be written to a regular matrix file). <b>Seg</b> is the
  * (which can then be written to a regular matrix file). <b>Seg</b> is the
  * segment structure that was configured from a call to 
  * segment structure that was configured from a call to 
- * <i>segment_init()</i>.
+ * <i>Segment_init()</i>.
  *
  *
  * <b>Buf</b> will be filled with <em>ncols*len</em> bytes of data
  * <b>Buf</b> will be filled with <em>ncols*len</em> bytes of data
  * corresponding to the <b>row</b> in the data matrix.
  * corresponding to the <b>row</b> in the data matrix.
@@ -40,7 +40,7 @@
  * \return -1 if unable to seek or read segment file
  * \return -1 if unable to seek or read segment file
  */
  */
 
 
-int segment_get_row(const SEGMENT * SEG, void *buf, off_t row)
+int Segment_get_row(const SEGMENT * SEG, void *buf, off_t row)
 {
 {
     int size;
     int size;
     off_t ncols, col;
     off_t ncols, col;
@@ -52,11 +52,11 @@ int segment_get_row(const SEGMENT * SEG, void *buf, off_t row)
     size = scols * SEG->len;
     size = scols * SEG->len;
 
 
     for (col = 0; col < ncols; col += scols) {
     for (col = 0; col < ncols; col += scols) {
-	SEG->segment_address(SEG, row, col, &n, &index);
-	SEG->segment_seek(SEG, n, index);
+	SEG->Segment_address(SEG, row, col, &n, &index);
+	SEG->Segment_seek(SEG, n, index);
 
 
 	if (read(SEG->fd, buf, size) != size) {
 	if (read(SEG->fd, buf, size) != size) {
-	    G_warning("segment_get_row: %s", strerror(errno));
+	    G_warning("Segment_get_row: %s", strerror(errno));
 	    return -1;
 	    return -1;
 	}
 	}
 
 
@@ -68,11 +68,11 @@ int segment_get_row(const SEGMENT * SEG, void *buf, off_t row)
 	buf = ((char *)buf) + size;
 	buf = ((char *)buf) + size;
     }
     }
     if ((size = SEG->spill * SEG->len)) {
     if ((size = SEG->spill * SEG->len)) {
-	SEG->segment_address(SEG, row, col, &n, &index);
-	SEG->segment_seek(SEG, n, index);
+	SEG->Segment_address(SEG, row, col, &n, &index);
+	SEG->Segment_seek(SEG, n, index);
 
 
 	if (read(SEG->fd, buf, size) != size) {
 	if (read(SEG->fd, buf, size) != size) {
-	    G_warning("segment_get_row: %s", strerror(errno));
+	    G_warning("Segment_get_row: %s", strerror(errno));
 	    return -1;
 	    return -1;
 	}
 	}
     }
     }

+ 6 - 6
lib/segment/init.c

@@ -32,15 +32,15 @@ static int read_off_t(int, off_t *);
 
 
 
 
 /**
 /**
- * \fn int segment_init (SEGMENT *SEG, int fd, int nseg)
+ * \fn int Segment_init (SEGMENT *SEG, int fd, int nseg)
  *
  *
  * \brief Initialize segment structure.
  * \brief Initialize segment structure.
  *
  *
  * Initializes the <b>seg</b> structure. The file on <b>fd</b> is
  * Initializes the <b>seg</b> structure. The file on <b>fd</b> is
- * a segment file created by <i>segment_format()</i> and must be open 
+ * a segment file created by <i>Segment_format()</i> and must be open 
  * for reading and writing. The segment file configuration parameters 
  * for reading and writing. The segment file configuration parameters 
  * <i>nrows, ncols, srows, scols</i>, and <i>len</i>, as written to the 
  * <i>nrows, ncols, srows, scols</i>, and <i>len</i>, as written to the 
- * file by <i>segment_format()</i>, are read from the file and stored in 
+ * file by <i>Segment_format()</i>, are read from the file and stored in 
  * the <b>seg</b> structure. <b>nsegs</b> specifies the number of 
  * the <b>seg</b> structure. <b>nsegs</b> specifies the number of 
  * segments that will be retained in memory. The minimum value allowed 
  * segments that will be retained in memory. The minimum value allowed 
  * is 1.
  * is 1.
@@ -56,14 +56,14 @@ static int read_off_t(int, off_t *);
  * \return -2 if out of memory
  * \return -2 if out of memory
  */
  */
 
 
-int segment_init(SEGMENT *SEG, int fd, int nseg)
+int Segment_init(SEGMENT *SEG, int fd, int nseg)
 {
 {
     SEG->open = 0;
     SEG->open = 0;
     SEG->fd = fd;
     SEG->fd = fd;
     SEG->nseg = nseg;
     SEG->nseg = nseg;
 
 
     if (lseek(fd, 0L, SEEK_SET) < 0) {
     if (lseek(fd, 0L, SEEK_SET) < 0) {
-	G_warning("segment_init: %s", strerror(errno));
+	G_warning("Segment_init: %s", strerror(errno));
 	return -1;
 	return -1;
     }
     }
 
 
@@ -75,7 +75,7 @@ int segment_init(SEGMENT *SEG, int fd, int nseg)
 	|| !read_int(fd, &SEG->len))
 	|| !read_int(fd, &SEG->len))
 	return -1;
 	return -1;
 
 
-    return segment_setup(SEG);
+    return Segment_setup(SEG);
 }
 }
 
 
 
 

+ 12 - 12
lib/segment/local_proto.h

@@ -1,27 +1,27 @@
-#ifndef SEGMENT_LOCAL_H
-#define SEGMENT_LOCAL_H
+#ifndef Segment_LOCAL_H
+#define Segment_LOCAL_H
 
 
 #include <grass/segment.h>
 #include <grass/segment.h>
 
 
 /* address.c */
 /* address.c */
-int segment_address(const SEGMENT *, off_t, off_t, int *, int *);
-int segment_address_fast(const SEGMENT *, off_t, off_t, int *, int *);
-int segment_address_slow(const SEGMENT *, off_t, off_t, int *, int *);
+int Segment_address(const SEGMENT *, off_t, off_t, int *, int *);
+int Segment_address_fast(const SEGMENT *, off_t, off_t, int *, int *);
+int Segment_address_slow(const SEGMENT *, off_t, off_t, int *, int *);
 
 
 /* pagein.c */
 /* pagein.c */
-int segment_pagein(SEGMENT *, int);
+int Segment_pagein(SEGMENT *, int);
 
 
 /* pageout.c */
 /* pageout.c */
-int segment_pageout(SEGMENT *, int);
+int Segment_pageout(SEGMENT *, int);
 
 
 /* seek.c */
 /* seek.c */
-int segment_seek(const SEGMENT *, int, int);
-int segment_seek_fast(const SEGMENT *, int, int);
-int segment_seek_slow(const SEGMENT *, int, int);
+int Segment_seek(const SEGMENT *, int, int);
+int Segment_seek_fast(const SEGMENT *, int, int);
+int Segment_seek_slow(const SEGMENT *, int, int);
 
 
 /* setup.c */
 /* setup.c */
-int segment_setup(SEGMENT *);
+int Segment_setup(SEGMENT *);
 
 
 
 
-#endif /* SEGMENT_LOCAL_H */
+#endif /* Segment_LOCAL_H */
 
 

+ 4 - 4
lib/segment/open.c

@@ -22,7 +22,7 @@
  * \brief Initialize segment structure and open segment file.
  * \brief Initialize segment structure and open segment file.
  *
  *
  * Initializes the <b>seg</b> structure and prepares a temporary file. 
  * Initializes the <b>seg</b> structure and prepares a temporary file. 
- * This fn is a wrapper for segment_format() and segment_init()
+ * This fn is a wrapper for Segment_format() and Segment_init()
  *
  *
  * <b>Note:</b> The file with name fname will be created anew.
  * <b>Note:</b> The file with name fname will be created anew.
  *
  *
@@ -44,7 +44,7 @@
  */
  */
 
 
 int
 int
-segment_open(SEGMENT *SEG, char *fname, off_t nrows, off_t ncols,
+Segment_open(SEGMENT *SEG, char *fname, off_t nrows, off_t ncols,
              int srows, int scols, int len, int nseg)
              int srows, int scols, int len, int nseg)
 {
 {
     int ret;
     int ret;
@@ -66,7 +66,7 @@ segment_open(SEGMENT *SEG, char *fname, off_t nrows, off_t ncols,
 	G_warning(_("Unable to create segment file"));
 	G_warning(_("Unable to create segment file"));
 	return -1;
 	return -1;
     }
     }
-    if (0 > (ret = segment_format(SEG->fd, nrows, ncols, srows,
+    if (0 > (ret = Segment_format(SEG->fd, nrows, ncols, srows,
 							scols, len))) {
 							scols, len))) {
 	close(SEG->fd);
 	close(SEG->fd);
 	unlink(SEG->fname);
 	unlink(SEG->fname);
@@ -86,7 +86,7 @@ segment_open(SEGMENT *SEG, char *fname, off_t nrows, off_t ncols,
 	G_warning(_("Unable to re-open segment file"));
 	G_warning(_("Unable to re-open segment file"));
 	return -4;
 	return -4;
     }
     }
-    if (0 > (ret = segment_init(SEG, SEG->fd, nseg))) {
+    if (0 > (ret = Segment_init(SEG, SEG->fd, nseg))) {
 	close(SEG->fd);
 	close(SEG->fd);
 	unlink(SEG->fname);
 	unlink(SEG->fname);
 	if (ret == -1) {
 	if (ret == -1) {

+ 8 - 8
lib/segment/pagein.c

@@ -21,7 +21,7 @@
 
 
 
 
 /**
 /**
- * \fn int segment_pagein (SEGMENT *SEG, int n)
+ * \fn int Segment_pagein (SEGMENT *SEG, int n)
  *
  *
  * \brief Segment pagein.
  * \brief Segment pagein.
  *
  *
@@ -34,7 +34,7 @@
  * \return -1 if unable to seek or read segment file
  * \return -1 if unable to seek or read segment file
  */
  */
 
 
-int segment_pagein(SEGMENT * SEG, int n)
+int Segment_pagein(SEGMENT * SEG, int n)
 {
 {
     int cur;
     int cur;
     int read_result;
     int read_result;
@@ -77,7 +77,7 @@ int segment_pagein(SEGMENT * SEG, int n)
 
 
 	    /* write it out if dirty */
 	    /* write it out if dirty */
 	    if (SEG->scb[cur].dirty) {
 	    if (SEG->scb[cur].dirty) {
-		if (segment_pageout(SEG, cur) < 0)
+		if (Segment_pageout(SEG, cur) < 0)
 		    return -1;
 		    return -1;
 	    }
 	    }
 	}
 	}
@@ -90,20 +90,20 @@ int segment_pagein(SEGMENT * SEG, int n)
     /* read in the segment */
     /* read in the segment */
     SEG->scb[cur].n = n;
     SEG->scb[cur].n = n;
     SEG->scb[cur].dirty = 0;
     SEG->scb[cur].dirty = 0;
-    SEG->segment_seek(SEG, SEG->scb[cur].n, 0);
+    SEG->Segment_seek(SEG, SEG->scb[cur].n, 0);
 
 
     read_result = read(SEG->fd, SEG->scb[cur].buf, SEG->size);
     read_result = read(SEG->fd, SEG->scb[cur].buf, SEG->size);
     if (read_result != SEG->size) {
     if (read_result != SEG->size) {
-	G_debug(2, "segment_pagein: read_result=%d  SEG->size=%d",
+	G_debug(2, "Segment_pagein: read_result=%d  SEG->size=%d",
 		read_result, SEG->size);
 		read_result, SEG->size);
 
 
 	if (read_result < 0)
 	if (read_result < 0)
-	    G_warning("segment_pagein: %s", strerror(errno));
+	    G_warning("Segment_pagein: %s", strerror(errno));
 	else if (read_result == 0)
 	else if (read_result == 0)
-	    G_warning("segment_pagein: read EOF");
+	    G_warning("Segment_pagein: read EOF");
 	else
 	else
 	    G_warning
 	    G_warning
-		("segment_pagein: short count during read(), got %d, expected %d",
+		("Segment_pagein: short count during read(), got %d, expected %d",
 		 read_result, SEG->size);
 		 read_result, SEG->size);
 
 
 	return -1;
 	return -1;

+ 4 - 4
lib/segment/pageout.c

@@ -21,7 +21,7 @@
 
 
 
 
 /**
 /**
- * \fn int segment_pageout(SEGMENT *SEG, int i)
+ * \fn int Segment_pageout(SEGMENT *SEG, int i)
  *
  *
  * \brief Pages segment to disk.
  * \brief Pages segment to disk.
  *
  *
@@ -34,11 +34,11 @@
  * \return -1 on error
  * \return -1 on error
  */
  */
 
 
-int segment_pageout(SEGMENT * SEG, int i)
+int Segment_pageout(SEGMENT * SEG, int i)
 {
 {
-    SEG->segment_seek(SEG, SEG->scb[i].n, 0);
+    SEG->Segment_seek(SEG, SEG->scb[i].n, 0);
     if (write(SEG->fd, SEG->scb[i].buf, SEG->size) != SEG->size) {
     if (write(SEG->fd, SEG->scb[i].buf, SEG->size) != SEG->size) {
-	G_warning("segment_pageout: %s", strerror(errno));
+	G_warning("Segment_pageout: %s", strerror(errno));
 	return -1;
 	return -1;
     }
     }
     SEG->scb[i].dirty = 0;
     SEG->scb[i].dirty = 0;

+ 5 - 5
lib/segment/put.c

@@ -18,11 +18,11 @@
 
 
 
 
 /*bugfix: buf: char* vs int* -> wrong pointer arithmetics!!!. Pierre de Mouveaux - 09 april 2000 */
 /*bugfix: buf: char* vs int* -> wrong pointer arithmetics!!!. Pierre de Mouveaux - 09 april 2000 */
-/* int segment_put (SEGMENT *SEG,int *buf,int row,int col) */
+/* int Segment_put (SEGMENT *SEG,int *buf,int row,int col) */
 
 
 
 
 /**
 /**
- * \fn int segment_put (SEGMENT *SEG, void *buf, int row, int col)
+ * \fn int Segment_put (SEGMENT *SEG, void *buf, int row, int col)
  *
  *
  * \brief Write value to segment file.
  * \brief Write value to segment file.
  *
  *
@@ -42,12 +42,12 @@
  * \return -1 if unable to seek or write segment file
  * \return -1 if unable to seek or write segment file
  */
  */
 
 
-int segment_put(SEGMENT * SEG, const void *buf, off_t row, off_t col)
+int Segment_put(SEGMENT * SEG, const void *buf, off_t row, off_t col)
 {
 {
     int index, n, i;
     int index, n, i;
 
 
-    SEG->segment_address(SEG, row, col, &n, &index);
-    if ((i = segment_pagein(SEG, n)) < 0) {
+    SEG->Segment_address(SEG, row, col, &n, &index);
+    if ((i = Segment_pagein(SEG, n)) < 0) {
 	G_warning("segment lib: put: pagein failed");
 	G_warning("segment lib: put: pagein failed");
 	return -1;
 	return -1;
     }
     }

+ 11 - 11
lib/segment/put_row.c

@@ -21,7 +21,7 @@
 
 
 
 
 /*      buf is CELL *   WRAT code       */
 /*      buf is CELL *   WRAT code       */
-/* int segment_put_row (SEGMENT *SEG, CELL *buf,int row) */
+/* int Segment_put_row (SEGMENT *SEG, CELL *buf,int row) */
 
 
 
 
 /**
 /**
@@ -29,7 +29,7 @@
  *
  *
  * Transfers non-segmented matrix data, row by row, into a segment
  * Transfers non-segmented matrix data, row by row, into a segment
  * file.  <b>seg</b> is the segment structure that was configured from a 
  * file.  <b>seg</b> is the segment structure that was configured from a 
- * call to <i>segment_init()</i>. <b>buf</b> should contain 
+ * call to <i>Segment_init()</i>. <b>buf</b> should contain 
  * <em>ncols*len</em> bytes of data to be transferred to the segment 
  * <em>ncols*len</em> bytes of data to be transferred to the segment 
  * file. <b>row</b> specifies the row from the data matrix being 
  * file. <b>row</b> specifies the row from the data matrix being 
  * transferred.
  * transferred.
@@ -41,7 +41,7 @@
  * \return -1 if unable to seek or write segment file
  * \return -1 if unable to seek or write segment file
  */
  */
 
 
-int segment_put_row(const SEGMENT * SEG, const void *buf, off_t row)
+int Segment_put_row(const SEGMENT * SEG, const void *buf, off_t row)
 {
 {
     int size;
     int size;
     off_t ncols;
     off_t ncols;
@@ -53,15 +53,15 @@ int segment_put_row(const SEGMENT * SEG, const void *buf, off_t row)
     ncols = SEG->ncols - SEG->spill;
     ncols = SEG->ncols - SEG->spill;
     scols = SEG->scols;
     scols = SEG->scols;
     size = scols * SEG->len;
     size = scols * SEG->len;
-    /*      printf("segment_put_row ncols: %d, scols %d, size: %d, col %d, row: %d,  SEG->fd: %d\n",ncols,scols,size,col,row, SEG->fd); */
+    /*      printf("Segment_put_row ncols: %d, scols %d, size: %d, col %d, row: %d,  SEG->fd: %d\n",ncols,scols,size,col,row, SEG->fd); */
 
 
     for (col = 0; col < ncols; col += scols) {
     for (col = 0; col < ncols; col += scols) {
-	SEG->segment_address(SEG, row, col, &n, &index);
-	SEG->segment_seek(SEG, n, index);
+	SEG->Segment_address(SEG, row, col, &n, &index);
+	SEG->Segment_seek(SEG, n, index);
 
 
 	if ((result = write(SEG->fd, buf, size)) != size) {
 	if ((result = write(SEG->fd, buf, size)) != size) {
-	    G_warning("segment_put_row write error %s", strerror(errno));
-	    /*      printf("segment_put_row result = %d. ncols: %d, scols %d, size: %d, col %d, row: %d,  SEG->fd: %d\n",result,ncols,scols,size,col,row, SEG->fd); */
+	    G_warning("Segment_put_row write error %s", strerror(errno));
+	    /*      printf("Segment_put_row result = %d. ncols: %d, scols %d, size: %d, col %d, row: %d,  SEG->fd: %d\n",result,ncols,scols,size,col,row, SEG->fd); */
 	    return -1;
 	    return -1;
 	}
 	}
 
 
@@ -74,11 +74,11 @@ int segment_put_row(const SEGMENT * SEG, const void *buf, off_t row)
     }
     }
 
 
     if ((size = SEG->spill * SEG->len)) {
     if ((size = SEG->spill * SEG->len)) {
-	SEG->segment_address(SEG, row, col, &n, &index);
-	SEG->segment_seek(SEG, n, index);
+	SEG->Segment_address(SEG, row, col, &n, &index);
+	SEG->Segment_seek(SEG, n, index);
 
 
 	if (write(SEG->fd, buf, size) != size) {
 	if (write(SEG->fd, buf, size) != size) {
-	    G_warning("segment_put_row final write error: %s",
+	    G_warning("Segment_put_row final write error: %s",
 		      strerror(errno));
 		      strerror(errno));
 	    return -1;
 	    return -1;
 	}
 	}

+ 3 - 3
lib/segment/release.c

@@ -18,7 +18,7 @@
 
 
 
 
 /**
 /**
- * \fn int segment_release (SEGMENT *SEG)
+ * \fn int Segment_release (SEGMENT *SEG)
  *
  *
  * \brief Free memory allocated to segment.
  * \brief Free memory allocated to segment.
  *
  *
@@ -26,14 +26,14 @@
  * <b>seg</b>.
  * <b>seg</b>.
  *
  *
  * <b>Note:</b> Does not close the file. Does not flush the data which 
  * <b>Note:</b> Does not close the file. Does not flush the data which 
- * may be pending from previous <i>segment_put()</i> calls.
+ * may be pending from previous <i>Segment_put()</i> calls.
  *
  *
  * \param[in,out] SEG segment
  * \param[in,out] SEG segment
  * \return 1 if successful
  * \return 1 if successful
  * \return -1 if SEGMENT is not available (not open)
  * \return -1 if SEGMENT is not available (not open)
  */
  */
 
 
-int segment_release(SEGMENT * SEG)
+int Segment_release(SEGMENT * SEG)
 {
 {
     int i;
     int i;
 
 

+ 4 - 4
lib/segment/seek.c

@@ -37,7 +37,7 @@
 #define SEG_SEEK_SLOW(SEG, n, index) \
 #define SEG_SEEK_SLOW(SEG, n, index) \
     ((off_t) (n) * (SEG)->size + (index) + (SEG)->offset)
     ((off_t) (n) * (SEG)->size + (index) + (SEG)->offset)
 
 
-int segment_seek_fast(const SEGMENT * SEG, int n, int index)
+int Segment_seek_fast(const SEGMENT * SEG, int n, int index)
 {
 {
     if (lseek((SEG)->fd, SEG_SEEK_FAST(SEG, n, index), 
     if (lseek((SEG)->fd, SEG_SEEK_FAST(SEG, n, index), 
         SEEK_SET) == (off_t) -1) {
         SEEK_SET) == (off_t) -1) {
@@ -47,7 +47,7 @@ int segment_seek_fast(const SEGMENT * SEG, int n, int index)
     return 0;
     return 0;
 }
 }
 
 
-int segment_seek_slow(const SEGMENT * SEG, int n, int index)
+int Segment_seek_slow(const SEGMENT * SEG, int n, int index)
 {
 {
     if (lseek((SEG)->fd, SEG_SEEK_SLOW(SEG, n, index), 
     if (lseek((SEG)->fd, SEG_SEEK_SLOW(SEG, n, index), 
         SEEK_SET) == (off_t) -1) {
         SEEK_SET) == (off_t) -1) {
@@ -57,7 +57,7 @@ int segment_seek_slow(const SEGMENT * SEG, int n, int index)
     return 0;
     return 0;
 }
 }
 
 
-int segment_seek(const SEGMENT * SEG, int n, int index)
+int Segment_seek(const SEGMENT * SEG, int n, int index)
 {
 {
-    return SEG->segment_seek(SEG, n, index);
+    return SEG->Segment_seek(SEG, n, index);
 }
 }

+ 38 - 38
lib/segment/segmentlib.dox

@@ -60,7 +60,7 @@ data is paged into memory as needed and the requested data is returned to
 the caller.
 the caller.
 
 
 \note All routines and global variables in this library, documented
 \note All routines and global variables in this library, documented
-or undocumented, start with the prefix \c segment_. To avoid name
+or undocumented, start with the prefix \c Segment_. To avoid name
 conflicts, programmers should not create variables or routines in their own 
 conflicts, programmers should not create variables or routines in their own 
 modules which use this prefix.
 modules which use this prefix.
 
 
@@ -86,7 +86,7 @@ be initialized before any data can be transferred to the segment file.
 This can be done with the <I>Segment Library</I> routine:
 This can be done with the <I>Segment Library</I> routine:
 
 
 <P>
 <P>
-<I>int segment_open(SEGMENT *SEG, char *fname, off_t nrows, off_t ncols,
+<I>int Segment_open(SEGMENT *SEG, char *fname, off_t nrows, off_t ncols,
   int srows, int scols, int len, int nseg)</I>, open a new segment structure.
   int srows, int scols, int len, int nseg)</I>, open a new segment structure.
 <P>
 <P>
   A new file with full path name <B>fname</B> will be created and 
   A new file with full path name <B>fname</B> will be created and 
@@ -94,8 +94,8 @@ This can be done with the <I>Segment Library</I> routine:
   <B>nrows</B> and <B>ncols</B>. The segments consist of <B>srows</B> by
   <B>nrows</B> and <B>ncols</B>. The segments consist of <B>srows</B> by
   <B>scols</B>. The data items have length <B>len</B> bytes. The number 
   <B>scols</B>. The data items have length <B>len</B> bytes. The number 
   of segments to be retained in memory is given by <B>nseg</B>. This 
   of segments to be retained in memory is given by <B>nseg</B>. This 
-  routine calls segment_format() and segment_init(), see below. If 
-  segment_open() is used, the routines segment_format() and segment_init()
+  routine calls Segment_format() and Segment_init(), see below. If 
+  Segment_open() is used, the routines Segment_format() and Segment_init()
   must not be used.
   must not be used.
 <P>
 <P>
 Return codes are: 1 ok; else a negative number between -1 and -6 encoding
 Return codes are: 1 ok; else a negative number between -1 and -6 encoding
@@ -106,7 +106,7 @@ Alternatively, the first step is to create a file which is properly
 formatted for use by the <I>Segment Library</I> routines:
 formatted for use by the <I>Segment Library</I> routines:
 
 
 <P>
 <P>
-<I>int segment_format (int fd, int nrows, off_t ncols,off_t srows, int scols,
+<I>int Segment_format (int fd, int nrows, off_t ncols,off_t srows, int scols,
   int len)</I>, format a segment file
   int len)</I>, format a segment file
 <P>
 <P>
   The segmentation routines require a disk file to be used for paging
   The segmentation routines require a disk file to be used for paging
@@ -130,17 +130,17 @@ Return codes are: 1 ok; else -1 could not seek or write <I>fd</I>, or -3
 
 
 <P>
 <P>
 The next step is to initialize a SEGMENT structure to be associated with a
 The next step is to initialize a SEGMENT structure to be associated with a
-segment file formatted by segment_format().
+segment file formatted by Segment_format().
 
 
 <P>
 <P>
-<I>int segment_init (SEGMENT *seg, int fd, int nsegs)</I>, initialize segment
+<I>int Segment_init (SEGMENT *seg, int fd, int nsegs)</I>, initialize segment
   structure
   structure
 <P>
 <P>
   Initializes the <B>seg</B> structure. The file on <B>fd</B> is
   Initializes the <B>seg</B> structure. The file on <B>fd</B> is
-  a segment file created by segment_format() and must be open for
+  a segment file created by Segment_format() and must be open for
   reading and writing. The segment file configuration parameters <I>nrows,
   reading and writing. The segment file configuration parameters <I>nrows,
     ncols, srows, scols</I>, and <I>len</I>, as written to the file by
     ncols, srows, scols</I>, and <I>len</I>, as written to the file by
-  <I>segment_format</I>, are read from the file and stored in the
+  <I>Segment_format</I>, are read from the file and stored in the
   <B>seg</B> structure. <B>Nsegs</B> specifies the number of segments that
   <B>seg</B> structure. <B>Nsegs</B> specifies the number of segments that
   will be retained in memory. The minimum value allowed is 1.
   will be retained in memory. The minimum value allowed is 1.
 
 
@@ -154,12 +154,12 @@ Return codes are:  1 if ok; else -1 could not seek or read segment file,  or -2
 Then data can be written from another file to the segment file row by row:
 Then data can be written from another file to the segment file row by row:
 
 
 <P>
 <P>
-<I>int segment_put_row (SEGMENT *seg, char *buf, int row)</I>, write row to
+<I>int Segment_put_row (SEGMENT *seg, char *buf, int row)</I>, write row to
   segment file
   segment file
 <P>
 <P>
   Transfers nonsegmented matrix data, row by row, into a segment
   Transfers nonsegmented matrix data, row by row, into a segment
   file.  <B>Seg</B> is the segment structure that was configured from a call
   file.  <B>Seg</B> is the segment structure that was configured from a call
-  to segment_init(). <B>Buf</B> should contain <I>ncols*len</I>
+  to Segment_init(). <B>Buf</B> should contain <I>ncols*len</I>
   bytes of data to be transferred to the segment file. <B>Row</B> specifies
   bytes of data to be transferred to the segment file. <B>Row</B> specifies
   the row from the data matrix being transferred.
   the row from the data matrix being transferred.
 
 
@@ -170,7 +170,7 @@ Return codes are: 1 if ok;   else -1 could not seek or write segment file.
 Then data can be read or written to the segment file randomly:
 Then data can be read or written to the segment file randomly:
 
 
 <P>
 <P>
-<I>int segment_get (SEGMENT *seg, char *value, int row, int col)</I>, get value
+<I>int Segment_get (SEGMENT *seg, char *value, int row, int col)</I>, get value
   from segment file
   from segment file
 <P>
 <P>
   Provides random read access to the segmented data. It gets
   Provides random read access to the segmented data. It gets
@@ -182,7 +182,7 @@ Then data can be read or written to the segment file randomly:
 Return codes are:  1 if ok;  else -1 could not seek or read segment file.
 Return codes are:  1 if ok;  else -1 could not seek or read segment file.
 
 
 <P>
 <P>
-<I>int segment_put (SEGMENT *seg, char *value, int row, int col)</I>, put
+<I>int Segment_put (SEGMENT *seg, char *value, int row, int col)</I>, put
   value to segment file
   value to segment file
 <P>
 <P>
   Provides random write access to the segmented data. It
   Provides random write access to the segmented data. It
@@ -202,24 +202,24 @@ After random reading and writing is finished, the pending updates must be
 flushed to disk:
 flushed to disk:
 
 
 <P>
 <P>
-<I>int segment_flush (SEGMENT *seg)</I>, flush pending updates to disk
+<I>int Segment_flush (SEGMENT *seg)</I>, flush pending updates to disk
 <P>
 <P>
-  Forces all pending updates generated by segment_put() to be
+  Forces all pending updates generated by Segment_put() to be
   written to the segment file <B>seg.</B> Must be called after the final
   written to the segment file <B>seg.</B> Must be called after the final
-  segment_put() to force all pending updates to disk. Must also be called
-  before the first call to segment_get_row().
+  Segment_put() to force all pending updates to disk. Must also be called
+  before the first call to Segment_get_row().
 
 
 <P>
 <P>
 Now the data in segment file can be read row by row and transferred to a normal
 Now the data in segment file can be read row by row and transferred to a normal
 sequential data file:
 sequential data file:
 
 
 <P>
 <P>
-<I>int segment_get_row (SEGMENT *seg, char *buf, int row)</I>, read row from
+<I>int Segment_get_row (SEGMENT *seg, char *buf, int row)</I>, read row from
   segment file
   segment file
 <P>
 <P>
   Transfers data from a segment file, row by row, into memory
   Transfers data from a segment file, row by row, into memory
   (which can then be written to a regular matrix file) . <B>Seg</B> is the
   (which can then be written to a regular matrix file) . <B>Seg</B> is the
-  segment structure that was configured from a call to segment_init().
+  segment structure that was configured from a call to Segment_init().
   <B>Buf</B> will be filled with <I>ncols*len</I> bytes of data
   <B>Buf</B> will be filled with <I>ncols*len</I> bytes of data
   corresponding to the <B>row</B> in the data matrix.
   corresponding to the <B>row</B> in the data matrix.
 
 
@@ -230,11 +230,11 @@ Return codes are: 1 if ok; else -1 could not seek or read segment file.
 Finally, memory allocated in the SEGMENT structure is freed:
 Finally, memory allocated in the SEGMENT structure is freed:
 
 
 <P>
 <P>
-<I>int segment_release (SEGMENT *seg)</I>, free allocated memory
+<I>int Segment_release (SEGMENT *seg)</I>, free allocated memory
 <P>
 <P>
   Releases the allocated memory associated with the segment file
   Releases the allocated memory associated with the segment file
   <B>seg.</B> Does not close the file. Does not flush the data which may
   <B>seg.</B> Does not close the file. Does not flush the data which may
-  be pending from previous segment_put() calls.
+  be pending from previous Segment_put() calls.
 
 
 <P>
 <P>
 
 
@@ -242,9 +242,9 @@ The following routine both deletes the segment file and releases allocated
 memory:
 memory:
 
 
 <P>
 <P>
-<I>int segment_close (SEGMENT *seg)</I>, close segment structure
+<I>int Segment_close (SEGMENT *seg)</I>, close segment structure
 <P>
 <P>
-  Deletes the segment file and uses segment_release() to release the 
+  Deletes the segment file and uses Segment_release() to release the 
   allocated memory. No further cleaing up is required.
   allocated memory. No further cleaing up is required.
 
 
 <P>
 <P>
@@ -260,7 +260,7 @@ at once:
 \code
 \code
 SEGMENT seg;
 SEGMENT seg;
 
 
-segment_open (&seg, G_tempfile(), nrows, ncols, srows, scols, sizeof(int), nseg);
+Segment_open (&seg, G_tempfile(), nrows, ncols, srows, scols, sizeof(int), nseg);
 \endcode
 \endcode
 
 
 Alternatively, the first step is the creation and formatting of a segment 
 Alternatively, the first step is the creation and formatting of a segment 
@@ -270,7 +270,7 @@ file. A file is created, formatted and then closed:
 \code
 \code
 fd = creat (file, 0666);
 fd = creat (file, 0666);
 
 
-segment_format (fd, nrows, ncols, srows, scols, sizeof(int));
+Segment_format (fd, nrows, ncols, srows, scols, sizeof(int));
 
 
 close(fd);
 close(fd);
 \endcode
 \endcode
@@ -286,7 +286,7 @@ file format. The segment file is reopened for read and write and initialized:
 SEGMENT seg;
 SEGMENT seg;
 
 
 fd = open (file, O_RDWR);
 fd = open (file, O_RDWR);
-segment_init (&seg, fd, nseg);
+Segment_init (&seg, fd, nseg);
 \endcode
 \endcode
 
 
 <P>
 <P>
@@ -299,7 +299,7 @@ for (row = 0; row < nrows; row++)
 {
 {
     // code to get original matrix data for row into buf
     // code to get original matrix data for row into buf
 
 
-    segment_put_row (&seg, buf, row);
+    Segment_put_row (&seg, buf, row);
 }
 }
 \endcode
 \endcode
 
 
@@ -307,11 +307,11 @@ for (row = 0; row < nrows; row++)
 <P>
 <P>
 Of course if the intention is only to add new values rather than update existing
 Of course if the intention is only to add new values rather than update existing
 values, the step which transfers data from the original matrix to the segment
 values, the step which transfers data from the original matrix to the segment
-file, using segment_put_row(), could be omitted, since
-segment_format() will fill the segment file with zeros.
+file, using Segment_put_row(), could be omitted, since
+Segment_format() will fill the segment file with zeros.
 
 
 <P>
 <P>
-The data can now be accessed directly using segment_get(). For example,
+The data can now be accessed directly using Segment_get(). For example,
 to get the value at a given row and column:
 to get the value at a given row and column:
 
 
 \code
 \code
@@ -319,11 +319,11 @@ int value;
 
 
 SEGMENT seg;
 SEGMENT seg;
 
 
-segment_get (&seg, &value, row, col);
+Segment_get (&seg, &value, row, col);
 \endcode
 \endcode
 
 
 <P>
 <P>
-Similarly segment_put() can be used to change data values in the
+Similarly Segment_put() can be used to change data values in the
 segment file:
 segment file:
 
 
 
 
@@ -334,16 +334,16 @@ SEGMENT seg;
 
 
 value = 10;
 value = 10;
 
 
-segment_put (&seg, &value, row, col);
+Segment_put (&seg, &value, row, col);
 \endcode
 \endcode
 
 
 
 
 \warning It is an easy mistake to pass a value directly to
 \warning It is an easy mistake to pass a value directly to
-segment_put(). The following should be avoided:
+Segment_put(). The following should be avoided:
 
 
 
 
 \code
 \code
-segment_put (&seg, 10, row, col); // this will not work
+Segment_put (&seg, 10, row, col); // this will not work
 \endcode
 \endcode
 
 
 <P>
 <P>
@@ -353,11 +353,11 @@ follows:
 
 
 
 
 \code
 \code
-segment_flush (&seg);
+Segment_flush (&seg);
 
 
 for (row = 0; row < nrows; row++) 
 for (row = 0; row < nrows; row++) 
 {
 {
-    segment_get_row (&seg, buf, row);
+    Segment_get_row (&seg, buf, row);
 
 
     // code to put buf into a matrix data file for row
     // code to put buf into a matrix data file for row
 }
 }
@@ -369,7 +369,7 @@ released and the file closed:
 
 
 
 
 \code
 \code
-segment_release (&seg);
+Segment_release (&seg);
 
 
 close (fd);
 close (fd);
 \endcode
 \endcode

+ 9 - 9
lib/segment/setup.c

@@ -20,7 +20,7 @@
 
 
 
 
 /**
 /**
- * \fn int segment_setup (SEGMENT *SEG)
+ * \fn int Segment_setup (SEGMENT *SEG)
  *
  *
  * \brief Setup segment.
  * \brief Setup segment.
  *
  *
@@ -33,7 +33,7 @@
  * \return -2 if unable to allocate memory
  * \return -2 if unable to allocate memory
  */
  */
 
 
-int segment_setup(SEGMENT * SEG)
+int Segment_setup(SEGMENT * SEG)
 {
 {
     int i;
     int i;
     int seg_exp, n_total_segs;
     int seg_exp, n_total_segs;
@@ -75,9 +75,9 @@ int segment_setup(SEGMENT * SEG)
 	}
 	}
     }
     }
     if (SEG->fast_adrs)
     if (SEG->fast_adrs)
-	SEG->segment_address = segment_address_fast;
+	SEG->Segment_address = Segment_address_fast;
     else
     else
-	SEG->segment_address = segment_address_slow;
+	SEG->Segment_address = Segment_address_slow;
     
     
     /* fast seek */
     /* fast seek */
     SEG->fast_seek = 0;
     SEG->fast_seek = 0;
@@ -93,9 +93,9 @@ int segment_setup(SEGMENT * SEG)
 	}
 	}
     }
     }
     if (SEG->fast_seek)
     if (SEG->fast_seek)
-	SEG->segment_seek = segment_seek_fast;
+	SEG->Segment_seek = Segment_seek_fast;
     else
     else
-	SEG->segment_seek = segment_seek_slow;
+	SEG->Segment_seek = Segment_seek_slow;
 
 
     /* adjust number of open segments if larger than number of total segments */
     /* adjust number of open segments if larger than number of total segments */
     n_total_segs = SEG->spr * ((SEG->nrows + SEG->srows - 1) / SEG->srows);
     n_total_segs = SEG->spr * ((SEG->nrows + SEG->srows - 1) / SEG->srows);
@@ -106,8 +106,8 @@ int segment_setup(SEGMENT * SEG)
     }
     }
 
 
     if ((SEG->scb =
     if ((SEG->scb =
-	 (struct SEGMENT_SCB *)G_malloc(SEG->nseg *
-					sizeof(struct SEGMENT_SCB))) == NULL)
+	 (struct Segment_SCB *)G_malloc(SEG->nseg *
+					sizeof(struct Segment_SCB))) == NULL)
 	return -2;
 	return -2;
 
 
     if ((SEG->freeslot = (int *)G_malloc(SEG->nseg * sizeof(int))) == NULL)
     if ((SEG->freeslot = (int *)G_malloc(SEG->nseg * sizeof(int))) == NULL)
@@ -148,7 +148,7 @@ int segment_setup(SEGMENT * SEG)
     SEG->cur = 0;
     SEG->cur = 0;
     SEG->open = 1;
     SEG->open = 1;
 
 
-    /* SEG->loaded = rbtree_create(segment_compare, sizeof(SEGID)); */
+    /* SEG->loaded = rbtree_create(Segment_compare, sizeof(SEGID)); */
     /* SEG->loaded = NULL; */
     /* SEG->loaded = NULL; */
     
     
     /* index for each segment, same like cache of r.proj  */
     /* index for each segment, same like cache of r.proj  */

+ 3 - 1
lib/vector/Vlib/open.c

@@ -240,7 +240,9 @@ int Vect__open_old(struct Map_info *Map, const char *name, const char *mapset,
         }
         }
         else {
         else {
             char file_path[GPATH_MAX];
             char file_path[GPATH_MAX];
-            
+            /* reduce to current mapset if search path was set */
+            if(strcmp(Map->mapset, "") == 0)
+                Map->mapset = G_store(G_mapset());
             /* temporary map: reduce to current mapset if search path
             /* temporary map: reduce to current mapset if search path
              * was set */
              * was set */
             if (strcmp(Map->mapset, "") == 0)
             if (strcmp(Map->mapset, "") == 0)

+ 20 - 20
raster/r.cost/main.c

@@ -423,12 +423,12 @@ int main(int argc, char *argv[])
     /* Create segmented format files for cost layer and output layer */
     /* Create segmented format files for cost layer and output layer */
     G_verbose_message(_("Creating some temporary files..."));
     G_verbose_message(_("Creating some temporary files..."));
 
 
-    if (segment_open(&cost_seg, G_tempfile(), nrows, ncols, srows, scols,
+    if (Segment_open(&cost_seg, G_tempfile(), nrows, ncols, srows, scols,
 		     sizeof(struct cc), segments_in_memory) != 1)
 		     sizeof(struct cc), segments_in_memory) != 1)
 	G_fatal_error(_("Can not create temporary file"));
 	G_fatal_error(_("Can not create temporary file"));
 
 
     if (dir == TRUE) {
     if (dir == TRUE) {
-	if (segment_open(&dir_seg, G_tempfile(), nrows, ncols, srows, scols,
+	if (Segment_open(&dir_seg, G_tempfile(), nrows, ncols, srows, scols,
 		         sizeof(FCELL), segments_in_memory) != 1)
 		         sizeof(FCELL), segments_in_memory) != 1)
 	    G_fatal_error(_("Can not create temporary file"));
 	    G_fatal_error(_("Can not create temporary file"));
     }
     }
@@ -485,7 +485,7 @@ int main(int argc, char *argv[])
 		    p = null_cost;
 		    p = null_cost;
 		}
 		}
 		costs.cost_in = p;
 		costs.cost_in = p;
-		segment_put(&cost_seg, &costs, row, i);
+		Segment_put(&cost_seg, &costs, row, i);
 		ptr2 = G_incr_void_ptr(ptr2, dsize);
 		ptr2 = G_incr_void_ptr(ptr2, dsize);
 	    }
 	    }
 	}
 	}
@@ -498,7 +498,7 @@ int main(int argc, char *argv[])
 	for (row = 0; row < nrows; row++) {
 	for (row = 0; row < nrows; row++) {
 	    G_percent(row, nrows, 2);
 	    G_percent(row, nrows, 2);
 	    for (col = 0; col < ncols; col++) {
 	    for (col = 0; col < ncols; col++) {
-		segment_put(&dir_seg, &dnullval, row, col);
+		Segment_put(&dir_seg, &dnullval, row, col);
 	    }
 	    }
 	}
 	}
 	G_percent(1, 1, 1);
 	G_percent(1, 1, 1);
@@ -675,21 +675,21 @@ int main(int argc, char *argv[])
 		if (!Rast_is_null_value(ptr2, data_type2)) {
 		if (!Rast_is_null_value(ptr2, data_type2)) {
 		    double cellval;
 		    double cellval;
 
 
-		    segment_get(&cost_seg, &costs, row, col);
+		    Segment_get(&cost_seg, &costs, row, col);
 
 
 		    cellval = Rast_get_d_value(ptr2, data_type2);
 		    cellval = Rast_get_d_value(ptr2, data_type2);
 		    if (start_with_raster_vals == 1) {
 		    if (start_with_raster_vals == 1) {
                         insert(cellval, row, col);
                         insert(cellval, row, col);
 			costs.cost_out = cellval;
 			costs.cost_out = cellval;
 			costs.nearest = cellval;
 			costs.nearest = cellval;
-			segment_put(&cost_seg, &costs, row, col);
+			Segment_put(&cost_seg, &costs, row, col);
 		    }
 		    }
 		    else {
 		    else {
 			value = &zero;
 			value = &zero;
 			insert(zero, row, col);
 			insert(zero, row, col);
 			costs.cost_out = *value;
 			costs.cost_out = *value;
 			costs.nearest = cellval;
 			costs.nearest = cellval;
-			segment_put(&cost_seg, &costs, row, col);
+			Segment_put(&cost_seg, &costs, row, col);
 		    }
 		    }
 		    got_one = 1;
 		    got_one = 1;
 		}
 		}
@@ -718,12 +718,12 @@ int main(int argc, char *argv[])
 		|| top_start_pt->col < 0 || top_start_pt->col >= ncols)
 		|| top_start_pt->col < 0 || top_start_pt->col >= ncols)
 		G_fatal_error(_("Specified starting location outside database window"));
 		G_fatal_error(_("Specified starting location outside database window"));
 	    insert(zero, top_start_pt->row, top_start_pt->col);
 	    insert(zero, top_start_pt->row, top_start_pt->col);
-	    segment_get(&cost_seg, &costs, top_start_pt->row,
+	    Segment_get(&cost_seg, &costs, top_start_pt->row,
 			top_start_pt->col);
 			top_start_pt->col);
 	    costs.cost_out = *value;
 	    costs.cost_out = *value;
 	    costs.nearest = top_start_pt->value;
 	    costs.nearest = top_start_pt->value;
 
 
-	    segment_put(&cost_seg, &costs, top_start_pt->row,
+	    Segment_put(&cost_seg, &costs, top_start_pt->row,
 			top_start_pt->col);
 			top_start_pt->col);
 	    top_start_pt = top_start_pt->next;
 	    top_start_pt = top_start_pt->next;
 	}
 	}
@@ -755,7 +755,7 @@ int main(int argc, char *argv[])
 	    break;
 	    break;
 
 
 	/* If I've already been updated, delete me */
 	/* If I've already been updated, delete me */
-	segment_get(&cost_seg, &costs, pres_cell->row, pres_cell->col);
+	Segment_get(&cost_seg, &costs, pres_cell->row, pres_cell->col);
 	old_min_cost = costs.cost_out;
 	old_min_cost = costs.cost_out;
 	if (!Rast_is_d_null_value(&old_min_cost)) {
 	if (!Rast_is_d_null_value(&old_min_cost)) {
 	    if (pres_cell->min_cost > old_min_cost) {
 	    if (pres_cell->min_cost > old_min_cost) {
@@ -879,7 +879,7 @@ int main(int argc, char *argv[])
 		continue;
 		continue;
 
 
 	    min_cost = dnullval;
 	    min_cost = dnullval;
-	    segment_get(&cost_seg, &costs, row, col);
+	    Segment_get(&cost_seg, &costs, row, col);
 
 
 	    switch (neighbor) {
 	    switch (neighbor) {
 	    case 1:
 	    case 1:
@@ -968,27 +968,27 @@ int main(int argc, char *argv[])
 	    if (Rast_is_d_null_value(&min_cost))
 	    if (Rast_is_d_null_value(&min_cost))
 		continue;
 		continue;
 
 
-	    segment_get(&cost_seg, &costs, row, col);
+	    Segment_get(&cost_seg, &costs, row, col);
 	    old_min_cost = costs.cost_out;
 	    old_min_cost = costs.cost_out;
 
 
 	    /* add to list */
 	    /* add to list */
 	    if (Rast_is_d_null_value(&old_min_cost)) {
 	    if (Rast_is_d_null_value(&old_min_cost)) {
 		costs.cost_out = min_cost;
 		costs.cost_out = min_cost;
 		costs.nearest = nearest;
 		costs.nearest = nearest;
-		segment_put(&cost_seg, &costs, row, col);
+		Segment_put(&cost_seg, &costs, row, col);
 		insert(min_cost, row, col);
 		insert(min_cost, row, col);
 		if (dir == TRUE) {
 		if (dir == TRUE) {
-		    segment_put(&dir_seg, &cur_dir, row, col);
+		    Segment_put(&dir_seg, &cur_dir, row, col);
 		}
 		}
 	    }
 	    }
 	    /* update with lower costs */
 	    /* update with lower costs */
 	    else if (old_min_cost > min_cost) {
 	    else if (old_min_cost > min_cost) {
 		costs.cost_out = min_cost;
 		costs.cost_out = min_cost;
 		costs.nearest = nearest;
 		costs.nearest = nearest;
-		segment_put(&cost_seg, &costs, row, col);
+		Segment_put(&cost_seg, &costs, row, col);
 		insert(min_cost, row, col);
 		insert(min_cost, row, col);
 		if (dir == TRUE) {
 		if (dir == TRUE) {
-		    segment_put(&dir_seg, &cur_dir, row, col);
+		    Segment_put(&dir_seg, &cur_dir, row, col);
 		}
 		}
 	    }
 	    }
 	}
 	}
@@ -1060,7 +1060,7 @@ int main(int argc, char *argv[])
 			continue;
 			continue;
 		    }
 		    }
 		}
 		}
-		segment_get(&cost_seg, &costs, row, col);
+		Segment_get(&cost_seg, &costs, row, col);
 		min_cost = costs.cost_out;
 		min_cost = costs.cost_out;
 		nearest = costs.nearest;
 		nearest = costs.nearest;
 		if (Rast_is_d_null_value(&min_cost)) {
 		if (Rast_is_d_null_value(&min_cost)) {
@@ -1125,7 +1125,7 @@ int main(int argc, char *argv[])
 	for (row = 0; row < nrows; row++) {
 	for (row = 0; row < nrows; row++) {
 	    p = dir_cell;
 	    p = dir_cell;
 	    for (col = 0; col < ncols; col++) {
 	    for (col = 0; col < ncols; col++) {
-		segment_get(&dir_seg, &cur_dir, row, col);
+		Segment_get(&dir_seg, &cur_dir, row, col);
 		*((FCELL *) p) = cur_dir;
 		*((FCELL *) p) = cur_dir;
 		p = G_incr_void_ptr(p, dir_size);
 		p = G_incr_void_ptr(p, dir_size);
 	    }
 	    }
@@ -1136,9 +1136,9 @@ int main(int argc, char *argv[])
 	G_free(dir_cell);
 	G_free(dir_cell);
     }
     }
 
 
-    segment_close(&cost_seg);	/* release memory  */
+    Segment_close(&cost_seg);	/* release memory  */
     if (dir == TRUE)
     if (dir == TRUE)
-	segment_close(&dir_seg);
+	Segment_close(&dir_seg);
     Rast_close(cost_fd);
     Rast_close(cost_fd);
     Rast_close(cum_fd);
     Rast_close(cum_fd);
     if (dir == TRUE)
     if (dir == TRUE)

+ 3 - 3
raster/r.flow/io.c

@@ -95,7 +95,7 @@ void read_input_files(void)
     }
     }
     G_percent(1, 1, 1);
     G_percent(1, 1, 1);
     if (parm.seg)
     if (parm.seg)
-	segment_flush(el.seg);
+	Segment_flush(el.seg);
     Rast_close(fd);
     Rast_close(fd);
 
 
     if (parm.aspin) {
     if (parm.aspin) {
@@ -113,7 +113,7 @@ void read_input_files(void)
 	}
 	}
         G_percent(1, 1, 1);
         G_percent(1, 1, 1);
 	if (parm.seg)
 	if (parm.seg)
-	    segment_flush(as.seg);
+	    Segment_flush(as.seg);
 	Rast_close(fd);
 	Rast_close(fd);
     }
     }
 
 
@@ -148,7 +148,7 @@ static int open_segment_file(const char *name, layer l, int new)
 	if ((fd = G_open_new(string, name)) < 0)
 	if ((fd = G_open_new(string, name)) < 0)
 	    G_fatal_error(_("Cannot create segment file %s"), name);
 	    G_fatal_error(_("Cannot create segment file %s"), name);
 
 
-	if (segment_format(fd, region.rows + l.row_offset * 2,
+	if (Segment_format(fd, region.rows + l.row_offset * 2,
 			   region.cols + l.col_offset * 2, SEGROWS, SEGCOLS,
 			   region.cols + l.col_offset * 2, SEGROWS, SEGCOLS,
 			   sizeof(DCELL)) < 1)
 			   sizeof(DCELL)) < 1)
 	    G_fatal_error(_("Cannot format segment file %s"), name);
 	    G_fatal_error(_("Cannot format segment file %s"), name);

+ 7 - 7
raster/r.flow/mem.c

@@ -35,7 +35,7 @@
 
 
 void put_row_seg(layer l, int row)
 void put_row_seg(layer l, int row)
 {
 {
-    if (segment_put_row(l.seg, l.buf[row] - l.col_offset,
+    if (Segment_put_row(l.seg, l.buf[row] - l.col_offset,
 			row + l.row_offset) < 1)
 			row + l.row_offset) < 1)
 	G_fatal_error(_("Unable to write segment file for %s"), l.name);
 	G_fatal_error(_("Unable to write segment file for %s"), l.name);
 }
 }
@@ -64,12 +64,12 @@ void allocate_heap(void)
     if (parm.seg) {
     if (parm.seg) {
 	G_debug(1, "Allocating memory: segment");
 	G_debug(1, "Allocating memory: segment");
 	el.seg = (SEGMENT *) G_malloc(sizeof(SEGMENT));
 	el.seg = (SEGMENT *) G_malloc(sizeof(SEGMENT));
-	segment_init(el.seg, el.sfd, SEGSINMEM);
+	Segment_init(el.seg, el.sfd, SEGSINMEM);
 	as.seg = (SEGMENT *) G_malloc(sizeof(SEGMENT));
 	as.seg = (SEGMENT *) G_malloc(sizeof(SEGMENT));
-	segment_init(as.seg, as.sfd, SEGSINMEM);
+	Segment_init(as.seg, as.sfd, SEGSINMEM);
 	if (parm.dsout) {
 	if (parm.dsout) {
 	    ds.seg = (SEGMENT *) G_malloc(sizeof(SEGMENT));
 	    ds.seg = (SEGMENT *) G_malloc(sizeof(SEGMENT));
-	    segment_init(ds.seg, ds.sfd, SEGSINMEM);
+	    Segment_init(ds.seg, ds.sfd, SEGSINMEM);
 	}
 	}
     }
     }
 
 
@@ -122,11 +122,11 @@ void deallocate_heap(void)
     G_free(el.buf[-1] - 1);
     G_free(el.buf[-1] - 1);
 
 
     if (parm.seg) {
     if (parm.seg) {
-	segment_release(el.seg);
+	Segment_release(el.seg);
 	if (!parm.mem)
 	if (!parm.mem)
-	    segment_release(as.seg);
+	    Segment_release(as.seg);
 	if (parm.dsout)
 	if (parm.dsout)
-	    segment_release(ds.seg);
+	    Segment_release(ds.seg);
     }
     }
     else {
     else {
 	G_free(el.buf[region.rows] - 1);
 	G_free(el.buf[region.rows] - 1);

+ 7 - 7
raster/r.flow/mem.h

@@ -29,8 +29,8 @@ void deallocate_heap();
 void put_row_seg( /* l, row */ );
 void put_row_seg( /* l, row */ );
 
 
 #define get_row(l, row) \
 #define get_row(l, row) \
-    ((parm.seg && (segment_flush(l.seg) < 1 || \
-		   segment_get_row(l.seg, l.buf[row] - l.col_offset, \
+    ((parm.seg && (Segment_flush(l.seg) < 1 || \
+		   Segment_get_row(l.seg, l.buf[row] - l.col_offset, \
 				          row + l.row_offset) < 1)) ? \
 				          row + l.row_offset) < 1)) ? \
 	(sprintf(string, "r.flow: cannot write segment file for %s", l.name),\
 	(sprintf(string, "r.flow: cannot write segment file for %s", l.name),\
 	 G_fatal_error(string), (DCELL *) NULL) : \
 	 G_fatal_error(string), (DCELL *) NULL) : \
@@ -38,8 +38,8 @@ void put_row_seg( /* l, row */ );
 
 
 /*   This was is Astley's version 12...
 /*   This was is Astley's version 12...
    > #define get_cell_row(l, row) \
    > #define get_cell_row(l, row) \
-   >     ((parm.seg && (segment_flush(l.seg) < 1 || \
-   >                  segment_get_row(l.seg, l.buf[row] - l.col_offset, \
+   >     ((parm.seg && (Segment_flush(l.seg) < 1 || \
+   >                  Segment_get_row(l.seg, l.buf[row] - l.col_offset, \
    >                                         row + l.row_offset) < 1)) ? \
    >                                         row + l.row_offset) < 1)) ? \
    >       (sprintf(string, "r.flow: cannot write segment file for %s", l.name),\
    >       (sprintf(string, "r.flow: cannot write segment file for %s", l.name),\
    >        G_fatal_error(string), (CELL *) NULL) : \
    >        G_fatal_error(string), (CELL *) NULL) : \
@@ -49,7 +49,7 @@ void put_row_seg( /* l, row */ );
 
 
 #define aspect(row, col) \
 #define aspect(row, col) \
     (parm.seg ? \
     (parm.seg ? \
-	(segment_get(as.seg, &v, \
+	(Segment_get(as.seg, &v, \
 			row + as.row_offset, col + as.col_offset) < 1 ? \
 			row + as.row_offset, col + as.col_offset) < 1 ? \
 	  (sprintf(string,"r.flow: cannot read segment file for %s",as.name), \
 	  (sprintf(string,"r.flow: cannot read segment file for %s",as.name), \
 	   G_fatal_error(string), 0) :					\
 	   G_fatal_error(string), 0) :					\
@@ -62,7 +62,7 @@ void put_row_seg( /* l, row */ );
 
 
 #define get(l, row, col) \
 #define get(l, row, col) \
     (parm.seg ? \
     (parm.seg ? \
-	(segment_get(l.seg, &v, row + l.row_offset, col + l.col_offset) < 1 ? \
+	(Segment_get(l.seg, &v, row + l.row_offset, col + l.col_offset) < 1 ? \
 	  (sprintf(string,"r.flow: cannot read segment file for %s",l.name),\
 	  (sprintf(string,"r.flow: cannot read segment file for %s",l.name),\
 	   G_fatal_error(string), 0) : \
 	   G_fatal_error(string), 0) : \
 	 v) : \
 	 v) : \
@@ -71,7 +71,7 @@ void put_row_seg( /* l, row */ );
 #define put(l, row, col, w) \
 #define put(l, row, col, w) \
     (parm.seg ? \
     (parm.seg ? \
 	(v = w, \
 	(v = w, \
-	 segment_put(l.seg, &v, row + l.row_offset, col + l.col_offset) < 1 ? \
+	 Segment_put(l.seg, &v, row + l.row_offset, col + l.col_offset) < 1 ? \
 	  (sprintf(string,"r.flow: cannot write segment file for %s",l.name), \
 	  (sprintf(string,"r.flow: cannot write segment file for %s",l.name), \
 	   G_fatal_error(string), 0) : \
 	   G_fatal_error(string), 0) : \
 	 0) : \
 	 0) : \

+ 15 - 15
raster/r.resamp.bspline/main.c

@@ -304,12 +304,12 @@ int main(int argc, char *argv[])
 
 
     in_file = G_tempfile();
     in_file = G_tempfile();
     in_fd = creat(in_file, 0666);
     in_fd = creat(in_file, 0666);
-    if (segment_format(in_fd, nrows, ncols, SEGSIZE, SEGSIZE, sizeof(double)) != 1)
+    if (Segment_format(in_fd, nrows, ncols, SEGSIZE, SEGSIZE, sizeof(double)) != 1)
 	G_fatal_error(_("Can not create temporary file"));
 	G_fatal_error(_("Can not create temporary file"));
     close(in_fd);
     close(in_fd);
 
 
     in_fd = open(in_file, 2);
     in_fd = open(in_file, 2);
-    if (segment_init(&in_seg, in_fd, segments_in_memory) != 1)
+    if (Segment_init(&in_seg, in_fd, segments_in_memory) != 1)
     	G_fatal_error(_("Can not initialize temporary file"));
     	G_fatal_error(_("Can not initialize temporary file"));
 
 
     /* read raster input */
     /* read raster input */
@@ -332,7 +332,7 @@ int main(int argc, char *argv[])
 		    got_one++;
 		    got_one++;
 		}
 		}
 	    }
 	    }
-	    segment_put_row(&in_seg, drastbuf, row);
+	    Segment_put_row(&in_seg, drastbuf, row);
 	    
 	    
 	}
 	}
 	if (!got_one)
 	if (!got_one)
@@ -366,7 +366,7 @@ int main(int argc, char *argv[])
 
 
 	    G_done_msg(_("Cross validation finished for ew_step = %f and ns_step = %f"), stepE, stepN);
 	    G_done_msg(_("Cross validation finished for ew_step = %f and ns_step = %f"), stepE, stepN);
 
 
-	    segment_release(&in_seg);	/* release memory  */
+	    Segment_release(&in_seg);	/* release memory  */
 	    close(in_fd);
 	    close(in_fd);
 	    unlink(in_file);
 	    unlink(in_file);
 
 
@@ -390,12 +390,12 @@ int main(int argc, char *argv[])
 
 
 	mask_file = G_tempfile();
 	mask_file = G_tempfile();
 	mask_fd = creat(mask_file, 0666);
 	mask_fd = creat(mask_file, 0666);
-	if (segment_format(mask_fd, nrows, ncols, SEGSIZE, SEGSIZE, sizeof(char)) != 1)
+	if (Segment_format(mask_fd, nrows, ncols, SEGSIZE, SEGSIZE, sizeof(char)) != 1)
 	    G_fatal_error(_("Can not create temporary file"));
 	    G_fatal_error(_("Can not create temporary file"));
 	close(mask_fd);
 	close(mask_fd);
 
 
 	mask_fd = open(mask_file, 2);
 	mask_fd = open(mask_file, 2);
-	if (segment_init(&mask_seg, mask_fd, segments_in_memory) != 1)
+	if (Segment_init(&mask_seg, mask_fd, segments_in_memory) != 1)
 	    G_fatal_error(_("Can not initialize temporary file"));
 	    G_fatal_error(_("Can not initialize temporary file"));
 
 
 	if (mask_opt->answer) {
 	if (mask_opt->answer) {
@@ -441,7 +441,7 @@ int main(int argc, char *argv[])
 		    else
 		    else
 			null_count++;
 			null_count++;
 		}
 		}
-		segment_put(&mask_seg, &mask_val, row, col);
+		Segment_put(&mask_seg, &mask_val, row, col);
 	    }
 	    }
 	}
 	}
 
 
@@ -461,12 +461,12 @@ int main(int argc, char *argv[])
 
 
     out_file = G_tempfile();
     out_file = G_tempfile();
     out_fd = creat(out_file, 0666);
     out_fd = creat(out_file, 0666);
-    if (segment_format(out_fd, nrows, ncols, SEGSIZE, SEGSIZE, sizeof(double)) != 1)
+    if (Segment_format(out_fd, nrows, ncols, SEGSIZE, SEGSIZE, sizeof(double)) != 1)
 	G_fatal_error(_("Can not create temporary file"));
 	G_fatal_error(_("Can not create temporary file"));
     close(out_fd);
     close(out_fd);
 
 
     out_fd = open(out_file, 2);
     out_fd = open(out_file, 2);
-    if (segment_init(&out_seg, out_fd, segments_in_memory) != 1)
+    if (Segment_init(&out_seg, out_fd, segments_in_memory) != 1)
     	G_fatal_error(_("Can not initialize temporary file"));
     	G_fatal_error(_("Can not initialize temporary file"));
 
 
     /* initialize output */
     /* initialize output */
@@ -476,7 +476,7 @@ int main(int argc, char *argv[])
     Rast_set_d_null_value(drastbuf, ncols);
     Rast_set_d_null_value(drastbuf, ncols);
     for (row = 0; row < nrows; row++) {
     for (row = 0; row < nrows; row++) {
 	G_percent(row, nrows, 9);
 	G_percent(row, nrows, 9);
-	segment_put_row(&out_seg, drastbuf, row);
+	Segment_put_row(&out_seg, drastbuf, row);
     }
     }
     G_percent(row, nrows, 2);
     G_percent(row, nrows, 2);
 
 
@@ -723,12 +723,12 @@ int main(int argc, char *argv[])
 	}			/*! END WHILE; last_column = TRUE */
 	}			/*! END WHILE; last_column = TRUE */
     }				/*! END WHILE; last_row = TRUE */
     }				/*! END WHILE; last_row = TRUE */
 
 
-    segment_release(&in_seg);	/* release memory  */
+    Segment_release(&in_seg);	/* release memory  */
     close(in_fd);
     close(in_fd);
     unlink(in_file);
     unlink(in_file);
     
     
     if (have_mask) {
     if (have_mask) {
-	segment_release(&mask_seg);	/* release memory  */
+	Segment_release(&mask_seg);	/* release memory  */
 	close(mask_fd);
 	close(mask_fd);
 	unlink(mask_file);
 	unlink(mask_file);
     }
     }
@@ -742,12 +742,12 @@ int main(int argc, char *argv[])
     {
     {
 	int nonulls = 0;
 	int nonulls = 0;
 
 
-	segment_flush(&out_seg);
+	Segment_flush(&out_seg);
 	drastbuf = Rast_allocate_d_buf();
 	drastbuf = Rast_allocate_d_buf();
 
 
 	for (row = 0; row < dest_reg.rows; row++) {
 	for (row = 0; row < dest_reg.rows; row++) {
 	    G_percent(row, dest_reg.rows, 9);
 	    G_percent(row, dest_reg.rows, 9);
-	    segment_get_row(&out_seg, drastbuf, row);
+	    Segment_get_row(&out_seg, drastbuf, row);
 	    for (col = 0; col < dest_reg.cols; col++) {
 	    for (col = 0; col < dest_reg.cols; col++) {
 		dval = drastbuf[col];
 		dval = drastbuf[col];
 		if (!Rast_is_d_null_value(&dval))
 		if (!Rast_is_d_null_value(&dval))
@@ -760,7 +760,7 @@ int main(int argc, char *argv[])
 	    G_warning("only NULL cells in output raster");
 	    G_warning("only NULL cells in output raster");
     }
     }
 
 
-    segment_release(&out_seg);	/* release memory  */
+    Segment_release(&out_seg);	/* release memory  */
     close(out_fd);
     close(out_fd);
     unlink(out_file);
     unlink(out_file);
 
 

+ 3 - 3
raster/r.resamp.bspline/resamp.c

@@ -78,7 +78,7 @@ struct Point *P_Read_Raster_Region_masked(SEGMENT *mask_seg,
     for (row = startrow; row < endrow; row++) {
     for (row = startrow; row < endrow; row++) {
 	for (col = startcol; col < endcol; col++) {
 	for (col = startcol; col < endcol; col++) {
 
 
-	    segment_get(mask_seg, &mask_val, row, col);
+	    Segment_get(mask_seg, &mask_val, row, col);
 	    if (!mask_val)
 	    if (!mask_val)
 		continue;
 		continue;
 
 
@@ -160,7 +160,7 @@ int P_Sparse_Raster_Points(SEGMENT *out_seg, struct Cell_head *Elaboration,
 	    dval = interpolation;
 	    dval = interpolation;
 	}
 	}
 	else {
 	else {
-	    segment_get(out_seg, &dval, row, col);
+	    Segment_get(out_seg, &dval, row, col);
 	    if ((X > Overlap.E) && (X < General.E)) {
 	    if ((X > Overlap.E) && (X < General.E)) {
 		if ((Y > Overlap.N) && (Y < General.N)) {	/* (3) */
 		if ((Y > Overlap.N) && (Y < General.N)) {	/* (3) */
 		    csi = (General.E - X) / overlap;
 		    csi = (General.E - X) / overlap;
@@ -216,7 +216,7 @@ int P_Sparse_Raster_Points(SEGMENT *out_seg, struct Cell_head *Elaboration,
 		}
 		}
 	    }
 	    }
 	} /* end not in overlap */
 	} /* end not in overlap */
-	segment_put(out_seg, &dval, row, col);
+	Segment_put(out_seg, &dval, row, col);
     }  /* for num_points */
     }  /* for num_points */
 
 
     return 1;
     return 1;

+ 4 - 4
raster/r.spreadpath/drawline.c

@@ -41,7 +41,7 @@ void drawline(int x1, int y1, int x2, int y2)
     value = (char *)&data;
     value = (char *)&data;
 
 
     if (dx > dy) {
     if (dx > dy) {
-	segment_put(&out_seg, value, x, y);
+	Segment_put(&out_seg, value, x, y);
 	/*debug: printf("put1-(%d,%d) ",x,y); */
 	/*debug: printf("put1-(%d,%d) ",x,y); */
 	e = 2 * dy - dx;
 	e = 2 * dy - dx;
 	inc1 = 2 * (dy - dx);
 	inc1 = 2 * (dy - dx);
@@ -54,12 +54,12 @@ void drawline(int x1, int y1, int x2, int y2)
 	    else
 	    else
 		e += inc2;
 		e += inc2;
 	    x += incx;
 	    x += incx;
-	    segment_put(&out_seg, value, x, y);
+	    Segment_put(&out_seg, value, x, y);
 	    /*debug:printf("put2-(%d,%d) ",x,y); */
 	    /*debug:printf("put2-(%d,%d) ",x,y); */
 	}
 	}
     }
     }
     else {
     else {
-	segment_put(&out_seg, value, x, y);
+	Segment_put(&out_seg, value, x, y);
 	/*debug:printf("put3-(%d,%d) ",x,y); */
 	/*debug:printf("put3-(%d,%d) ",x,y); */
 	e = 2 * dx - dy;
 	e = 2 * dx - dy;
 	inc1 = 2 * (dx - dy);
 	inc1 = 2 * (dx - dy);
@@ -72,7 +72,7 @@ void drawline(int x1, int y1, int x2, int y2)
 	    else
 	    else
 		e += inc2;
 		e += inc2;
 	    y += incy;
 	    y += incy;
-	    segment_put(&out_seg, value, x, y);
+	    Segment_put(&out_seg, value, x, y);
 	    /*debug:rintf("put4-(%d,%d) ",x,y); */
 	    /*debug:rintf("put4-(%d,%d) ",x,y); */
 	}
 	}
     }
     }

+ 18 - 18
raster/r.spreadpath/main.c

@@ -186,24 +186,24 @@ int main(int argc, char **argv)
 
 
     /* Create segmented files for back cell and output layers  */
     /* Create segmented files for back cell and output layers  */
     in_row_fd = creat(in_row_file, 0666);
     in_row_fd = creat(in_row_file, 0666);
-    segment_format(in_row_fd, nrows, ncols, srows, scols, len);
+    Segment_format(in_row_fd, nrows, ncols, srows, scols, len);
     close(in_row_fd);
     close(in_row_fd);
     in_col_fd = creat(in_col_file, 0666);
     in_col_fd = creat(in_col_file, 0666);
-    segment_format(in_col_fd, nrows, ncols, srows, scols, len);
+    Segment_format(in_col_fd, nrows, ncols, srows, scols, len);
     close(in_col_fd);
     close(in_col_fd);
 
 
     out_fd = creat(out_file, 0666);
     out_fd = creat(out_file, 0666);
-    segment_format(out_fd, nrows, ncols, srows, scols, len);
+    Segment_format(out_fd, nrows, ncols, srows, scols, len);
     close(out_fd);
     close(out_fd);
 
 
     /*   Open initialize and segment all files  */
     /*   Open initialize and segment all files  */
     in_row_fd = open(in_row_file, 2);
     in_row_fd = open(in_row_file, 2);
-    segment_init(&in_row_seg, in_row_fd, 4);
+    Segment_init(&in_row_seg, in_row_fd, 4);
     in_col_fd = open(in_col_file, 2);
     in_col_fd = open(in_col_file, 2);
-    segment_init(&in_col_seg, in_col_fd, 4);
+    Segment_init(&in_col_seg, in_col_fd, 4);
 
 
     out_fd = open(out_file, 2);
     out_fd = open(out_file, 2);
-    segment_init(&out_seg, out_fd, 4);
+    Segment_init(&out_seg, out_fd, 4);
 
 
     /*   Write the back cell layers in the segmented files, and  
     /*   Write the back cell layers in the segmented files, and  
      *   Change UTM coordinates to ROWs and COLUMNs */
      *   Change UTM coordinates to ROWs and COLUMNs */
@@ -216,14 +216,14 @@ int main(int argc, char **argv)
 		    (window.north - cell[col]) / window.ns_res /* - 0.5 */ ;
 		    (window.north - cell[col]) / window.ns_res /* - 0.5 */ ;
 	    else
 	    else
 		cell[col] = -1;
 		cell[col] = -1;
-	segment_put_row(&in_row_seg, cell, row);
+	Segment_put_row(&in_row_seg, cell, row);
 	Rast_get_c_row(backcol_fd, cell, row);
 	Rast_get_c_row(backcol_fd, cell, row);
 
 
 	for (col = 0; col < ncols; col++)
 	for (col = 0; col < ncols; col++)
 	    if (cell[col] > 0)
 	    if (cell[col] > 0)
 		cell[col] =
 		cell[col] =
 		    (cell[col] - window.west) / window.ew_res /* - 0.5 */ ;
 		    (cell[col] - window.west) / window.ew_res /* - 0.5 */ ;
-	segment_put_row(&in_col_seg, cell, row);
+	Segment_put_row(&in_col_seg, cell, row);
     }
     }
 
 
     /* Convert easting and northing from the command line to row and col */
     /* Convert easting and northing from the command line to row and col */
@@ -242,7 +242,7 @@ int main(int argc, char **argv)
 	    }
 	    }
 
 
 	    value = (char *)&backrow;
 	    value = (char *)&backrow;
-	    segment_get(&in_row_seg, value, row, col);
+	    Segment_get(&in_row_seg, value, row, col);
 	    /* ignore pt in no-data area */
 	    /* ignore pt in no-data area */
 	    if (backrow < 0) {
 	    if (backrow < 0) {
 		G_warning("Ignoring point in NO-DATA area :");
 		G_warning("Ignoring point in NO-DATA area :");
@@ -250,7 +250,7 @@ int main(int argc, char **argv)
 		continue;
 		continue;
 	    }
 	    }
 	    value = (char *)&backcol;
 	    value = (char *)&backcol;
-	    segment_get(&in_col_seg, value, row, col);
+	    Segment_get(&in_col_seg, value, row, col);
 
 
 	    insert(&PRESENT_PT, row, col, backrow, backcol);
 	    insert(&PRESENT_PT, row, col, backrow, backcol);
 	}
 	}
@@ -281,7 +281,7 @@ int main(int argc, char **argv)
 	    for (col = 0; col < ncols; col++) {
 	    for (col = 0; col < ncols; col++) {
 		if (cell[col] > 0) {
 		if (cell[col] > 0) {
 		    value = (char *)&backrow;
 		    value = (char *)&backrow;
-		    segment_get(&in_row_seg, value, row, col);
+		    Segment_get(&in_row_seg, value, row, col);
 		    /* ignore pt in no-data area */
 		    /* ignore pt in no-data area */
 		    if (backrow < 0) {
 		    if (backrow < 0) {
 			G_warning("Ignoring point in NO-DATA area:");
 			G_warning("Ignoring point in NO-DATA area:");
@@ -291,7 +291,7 @@ int main(int argc, char **argv)
 			continue;
 			continue;
 		    }
 		    }
 		    value = (char *)&backcol;
 		    value = (char *)&backcol;
-		    segment_get(&in_col_seg, value, row, col);
+		    Segment_get(&in_col_seg, value, row, col);
 		    insert(&PRESENT_PT, row, col, backrow, backcol);
 		    insert(&PRESENT_PT, row, col, backrow, backcol);
 		}
 		}
 	    }			/* loop over cols */
 	    }			/* loop over cols */
@@ -314,24 +314,24 @@ int main(int argc, char **argv)
 	G_free(OLD_PT);
 	G_free(OLD_PT);
     }
     }
 
 
-    /* Write pending updates by segment_put() to outputmap */
-    segment_flush(&out_seg);
+    /* Write pending updates by Segment_put() to outputmap */
+    Segment_flush(&out_seg);
 
 
     if (verbose)
     if (verbose)
 	G_message("\nWriting the output map  -%s-...", path_layer);
 	G_message("\nWriting the output map  -%s-...", path_layer);
 
 
     path_fd = Rast_open_c_new(path_layer);
     path_fd = Rast_open_c_new(path_layer);
     for (row = 0; row < nrows; row++) {
     for (row = 0; row < nrows; row++) {
-	segment_get_row(&out_seg, cell, row);
+	Segment_get_row(&out_seg, cell, row);
 	Rast_put_row(path_fd, cell, CELL_TYPE);
 	Rast_put_row(path_fd, cell, CELL_TYPE);
     }
     }
 
 
     if (verbose)
     if (verbose)
 	G_message("finished.");
 	G_message("finished.");
 
 
-    segment_release(&in_row_seg);	/* release memory  */
-    segment_release(&in_col_seg);
-    segment_release(&out_seg);
+    Segment_release(&in_row_seg);	/* release memory  */
+    Segment_release(&in_col_seg);
+    Segment_release(&out_seg);
 
 
     close(in_row_fd);		/* close all files */
     close(in_row_fd);		/* close all files */
     close(in_col_fd);
     close(in_col_fd);

+ 3 - 3
raster/r.spreadpath/path_finder.c

@@ -21,7 +21,7 @@ void path_finder(int row, int col, int backrow, int backcol)
 
 
     /* if the pt has already been traversed, return */
     /* if the pt has already been traversed, return */
     value = (char *)&data;
     value = (char *)&data;
-    segment_get(&out_seg, value, row, col);
+    Segment_get(&out_seg, value, row, col);
     if (data == 1)
     if (data == 1)
 	return;			/* already traversed */
 	return;			/* already traversed */
 
 
@@ -37,9 +37,9 @@ void path_finder(int row, int col, int backrow, int backcol)
     }				/* reach an origin */
     }				/* reach an origin */
 
 
     value = (char *)&new_backrow;
     value = (char *)&new_backrow;
-    segment_get(&in_row_seg, value, backrow, backcol);
+    Segment_get(&in_row_seg, value, backrow, backcol);
     value = (char *)&new_backcol;
     value = (char *)&new_backcol;
-    segment_get(&in_col_seg, value, backrow, backcol);
+    Segment_get(&in_col_seg, value, backrow, backcol);
 
 
     path_finder(backrow, backcol, new_backrow, new_backcol);
     path_finder(backrow, backcol, new_backrow, new_backcol);
     return;
     return;

+ 7 - 7
raster/r.stream.channel/io.c

@@ -301,7 +301,7 @@ int seg_create_map(SEG * seg, int srows, int scols, int number_of_segs,
     fd = creat(filename, 0666);
     fd = creat(filename, 0666);
 
 
     if (0 >
     if (0 >
-	segment_format(fd, seg->nrows, seg->ncols, srows, scols,
+	Segment_format(fd, seg->nrows, seg->ncols, srows, scols,
 		       seg->data_size)) {
 		       seg->data_size)) {
 	close(fd);
 	close(fd);
 	unlink(filename);
 	unlink(filename);
@@ -314,7 +314,7 @@ int seg_create_map(SEG * seg, int srows, int scols, int number_of_segs,
 	G_fatal_error(_("Unable to re-open file '%s'"), filename);
 	G_fatal_error(_("Unable to re-open file '%s'"), filename);
     }
     }
 
 
-    if (0 > (fd = segment_init(&(seg->seg), fd, number_of_segs))) {
+    if (0 > (fd = Segment_init(&(seg->seg), fd, number_of_segs))) {
 	unlink(filename);
 	unlink(filename);
 	G_fatal_error(_("Unable to init segment file or out of memory"));
 	G_fatal_error(_("Unable to init segment file or out of memory"));
     }
     }
@@ -437,7 +437,7 @@ int seg_read_map(SEG * seg, char *input_map_name, int check_res,
 		}
 		}
 	    }
 	    }
 
 
-	if (0 > segment_put_row(&(seg->seg), target_buffer, r)) {
+	if (0 > Segment_put_row(&(seg->seg), target_buffer, r)) {
 	    G_free(input_buffer);
 	    G_free(input_buffer);
 	    G_free(target_buffer);
 	    G_free(target_buffer);
 	    Rast_close(input_fd);
 	    Rast_close(input_fd);
@@ -466,7 +466,7 @@ int seg_reset_map(SEG * seg, int value)
 
 
     for (r = 0; r < seg->nrows; ++r)
     for (r = 0; r < seg->nrows; ++r)
 	for (c = 0; c < seg->ncols; ++c)
 	for (c = 0; c < seg->ncols; ++c)
-	    segment_put(&(seg->seg), &value, r, c);
+	    Segment_put(&(seg->seg), &value, r, c);
 
 
     return 0;
     return 0;
 }
 }
@@ -498,13 +498,13 @@ int seg_write_map(SEG * seg, char *output_map_name,
     G_message(_("Writing raster map <%s>..."), output_map_name);
     G_message(_("Writing raster map <%s>..."), output_map_name);
     output_fd = Rast_open_new(output_map_name, output_data_type);
     output_fd = Rast_open_new(output_map_name, output_data_type);
     output_buffer = Rast_allocate_buf(output_data_type);
     output_buffer = Rast_allocate_buf(output_data_type);
-    segment_flush(&(seg->seg));
+    Segment_flush(&(seg->seg));
 
 
     /* writing */
     /* writing */
     for (r = 0; r < seg->nrows; ++r) {
     for (r = 0; r < seg->nrows; ++r) {
 
 
 	G_percent(r, seg->nrows, 2);
 	G_percent(r, seg->nrows, 2);
-	if (0 > segment_get_row(&(seg->seg), output_buffer, r))
+	if (0 > Segment_get_row(&(seg->seg), output_buffer, r))
 	    G_warning(_("Unable to segment read row %d for raster map <%s>"),
 	    G_warning(_("Unable to segment read row %d for raster map <%s>"),
 		      r, output_map_name);
 		      r, output_map_name);
 
 
@@ -550,7 +550,7 @@ int seg_release_map(SEG * seg)
     /* 
     /* 
      * release segment close files, set pointers to null;
      * release segment close files, set pointers to null;
      */
      */
-    segment_release(&(seg->seg));
+    Segment_release(&(seg->seg));
     close(seg->fd);
     close(seg->fd);
     unlink(seg->filename);
     unlink(seg->filename);
 
 

+ 21 - 21
raster/r.stream.channel/stream_topology.c

@@ -189,7 +189,7 @@ int seg_trib_nums(int r, int c, SEGMENT * streams, SEGMENT * dirs)
     int next_r, next_c;
     int next_r, next_c;
     int streams_cell, streams_next_cell, dirs_next_cell;
     int streams_cell, streams_next_cell, dirs_next_cell;
 
 
-    segment_get(streams, &streams_cell, r, c);
+    Segment_get(streams, &streams_cell, r, c);
     for (i = 1; i < 9; ++i) {
     for (i = 1; i < 9; ++i) {
 	if (NOT_IN_REGION(i))
 	if (NOT_IN_REGION(i))
 	    continue;
 	    continue;
@@ -197,8 +197,8 @@ int seg_trib_nums(int r, int c, SEGMENT * streams, SEGMENT * dirs)
 	j = DIAG(i);
 	j = DIAG(i);
 	next_r = NR(i);
 	next_r = NR(i);
 	next_c = NC(i);
 	next_c = NC(i);
-	segment_get(streams, &streams_next_cell, next_r, next_c);
-	segment_get(dirs, &dirs_next_cell, next_r, next_c);
+	Segment_get(streams, &streams_next_cell, next_r, next_c);
+	Segment_get(dirs, &dirs_next_cell, next_r, next_c);
 	if (streams_next_cell > 0 && dirs_next_cell == j)
 	if (streams_next_cell > 0 && dirs_next_cell == j)
 	    trib_num++;
 	    trib_num++;
     }
     }
@@ -211,8 +211,8 @@ int seg_trib_nums(int r, int c, SEGMENT * streams, SEGMENT * dirs)
 	    j = DIAG(i);
 	    j = DIAG(i);
 	    next_r = NR(i);
 	    next_r = NR(i);
 	    next_c = NC(i);
 	    next_c = NC(i);
-	    segment_get(streams, &streams_next_cell, next_r, next_c);
-	    segment_get(dirs, &dirs_next_cell, next_r, next_c);
+	    Segment_get(streams, &streams_next_cell, next_r, next_c);
+	    Segment_get(dirs, &dirs_next_cell, next_r, next_c);
 	    if (streams_next_cell == streams_cell && dirs_next_cell == j)
 	    if (streams_next_cell == streams_cell && dirs_next_cell == j)
 		trib_num--;
 		trib_num--;
 	}
 	}
@@ -233,7 +233,7 @@ int seg_number_of_streams(SEGMENT *streams, SEGMENT *dirs)
 
 
     for (r = 0; r < nrows; ++r)
     for (r = 0; r < nrows; ++r)
 	for (c = 0; c < ncols; ++c) {
 	for (c = 0; c < ncols; ++c) {
-	    segment_get(streams, &streams_cell, r, c);
+	    Segment_get(streams, &streams_cell, r, c);
 	    if (streams_cell > 0)
 	    if (streams_cell > 0)
 		if (seg_trib_nums(r, c, streams, dirs) != 1)
 		if (seg_trib_nums(r, c, streams, dirs) != 1)
 		    stream_num++;
 		    stream_num++;
@@ -265,7 +265,7 @@ int seg_build_streamlines(SEGMENT *streams, SEGMENT *dirs,
     /* finding inits */
     /* finding inits */
     for (r = 0; r < nrows; ++r)
     for (r = 0; r < nrows; ++r)
 	for (c = 0; c < ncols; ++c) {
 	for (c = 0; c < ncols; ++c) {
-	    segment_get(streams, &streams_cell, r, c);
+	    Segment_get(streams, &streams_cell, r, c);
 
 
 	    if (streams_cell)
 	    if (streams_cell)
 		if (seg_trib_nums(r, c, streams, dirs) != 1) {	/* adding inits */
 		if (seg_trib_nums(r, c, streams, dirs) != 1) {	/* adding inits */
@@ -283,20 +283,20 @@ int seg_build_streamlines(SEGMENT *streams, SEGMENT *dirs,
 
 
 	r = SA[i].init_r;
 	r = SA[i].init_r;
 	c = SA[i].init_c;
 	c = SA[i].init_c;
-	segment_get(streams, &(SA[i].order), r, c);
+	Segment_get(streams, &(SA[i].order), r, c);
 	//segment_get(streams,&streams_cell,r,c);
 	//segment_get(streams,&streams_cell,r,c);
 	SA[i].number_of_cells = 0;
 	SA[i].number_of_cells = 0;
 
 
 	do {
 	do {
 	    SA[i].number_of_cells++;
 	    SA[i].number_of_cells++;
-	    segment_get(dirs, &dirs_cell, r, c);
+	    Segment_get(dirs, &dirs_cell, r, c);
 
 
 	    d = abs(dirs_cell);
 	    d = abs(dirs_cell);
 	    if (NOT_IN_REGION(d) || d == 0)
 	    if (NOT_IN_REGION(d) || d == 0)
 		break;
 		break;
 	    r = NR(d);
 	    r = NR(d);
 	    c = NC(d);
 	    c = NC(d);
-	    segment_get(streams, &streams_cell, r, c);
+	    Segment_get(streams, &streams_cell, r, c);
 	} while (streams_cell == SA[i].order);
 	} while (streams_cell == SA[i].order);
 
 
 	SA[i].number_of_cells += 2;	/* add two extra points for init+ and outlet+ */
 	SA[i].number_of_cells += 2;	/* add two extra points for init+ and outlet+ */
@@ -322,25 +322,25 @@ int seg_build_streamlines(SEGMENT *streams, SEGMENT *dirs,
 	/* what to do if there is no contributing points? */
 	/* what to do if there is no contributing points? */
 	SA[i].points[0] = (contrib_cell == 0) ? -1 : INDEX(prev_r, prev_c);
 	SA[i].points[0] = (contrib_cell == 0) ? -1 : INDEX(prev_r, prev_c);
 
 
-	segment_get(elevation, &elevation_prev_cell, prev_r, prev_c);
+	Segment_get(elevation, &elevation_prev_cell, prev_r, prev_c);
 	SA[i].elevation[0] = (contrib_cell == 0) ? -99999 :
 	SA[i].elevation[0] = (contrib_cell == 0) ? -99999 :
 	    elevation_prev_cell;
 	    elevation_prev_cell;
 
 
 	if (contrib_cell == 0)
 	if (contrib_cell == 0)
-	    segment_get(dirs, &d, r, c);
+	    Segment_get(dirs, &d, r, c);
 	else
 	else
-	    segment_get(dirs, &d, prev_r, prev_c);
+	    Segment_get(dirs, &d, prev_r, prev_c);
 	SA[i].distance[0] = (contrib_cell == 0) ? get_distance(r, c, d) :
 	SA[i].distance[0] = (contrib_cell == 0) ? get_distance(r, c, d) :
 	    get_distance(prev_r, prev_c, d);
 	    get_distance(prev_r, prev_c, d);
 
 
 	SA[i].points[1] = INDEX(r, c);
 	SA[i].points[1] = INDEX(r, c);
-	segment_get(elevation, &(SA[i].elevation[1]), r, c);
-	segment_get(dirs, &d, r, c);
+	Segment_get(elevation, &(SA[i].elevation[1]), r, c);
+	Segment_get(dirs, &d, r, c);
 	SA[i].distance[1] = get_distance(r, c, d);
 	SA[i].distance[1] = get_distance(r, c, d);
 
 
 	cell_num = 2;
 	cell_num = 2;
 	do {
 	do {
-	    segment_get(dirs, &dirs_cell, r, c);
+	    Segment_get(dirs, &dirs_cell, r, c);
 	    d = abs(dirs_cell);
 	    d = abs(dirs_cell);
 
 
 	    if (NOT_IN_REGION(d) || d == 0) {
 	    if (NOT_IN_REGION(d) || d == 0) {
@@ -354,12 +354,12 @@ int seg_build_streamlines(SEGMENT *streams, SEGMENT *dirs,
 	    r = NR(d);
 	    r = NR(d);
 	    c = NC(d);
 	    c = NC(d);
 	    SA[i].points[cell_num] = INDEX(r, c);
 	    SA[i].points[cell_num] = INDEX(r, c);
-	    segment_get(elevation, &(SA[i].elevation[cell_num]), r, c);
-	    segment_get(dirs, &next_d, r, c);
+	    Segment_get(elevation, &(SA[i].elevation[cell_num]), r, c);
+	    Segment_get(dirs, &next_d, r, c);
 	    next_d = (abs(next_d) == 0) ? d : abs(next_d);
 	    next_d = (abs(next_d) == 0) ? d : abs(next_d);
 	    SA[i].distance[cell_num] = get_distance(r, c, next_d);
 	    SA[i].distance[cell_num] = get_distance(r, c, next_d);
 	    cell_num++;
 	    cell_num++;
-	    segment_get(streams, &streams_cell, r, c);
+	    Segment_get(streams, &streams_cell, r, c);
 	    if (cell_num > SA[i].number_of_cells)
 	    if (cell_num > SA[i].number_of_cells)
 		G_fatal_error(_("To much points in stream line..."));
 		G_fatal_error(_("To much points in stream line..."));
 	} while (streams_cell == SA[i].order);
 	} while (streams_cell == SA[i].order);
@@ -406,8 +406,8 @@ int seg_find_contributing_cell(int r, int c, SEGMENT *dirs,
 	    continue;
 	    continue;
 	next_r = NR(i);
 	next_r = NR(i);
 	next_c = NC(i);
 	next_c = NC(i);
-	segment_get(dirs, &dirs_next_cell, next_r, next_c);
-	segment_get(elevation, &elevation_next_cell, next_r, next_c);
+	Segment_get(dirs, &dirs_next_cell, next_r, next_c);
+	Segment_get(elevation, &elevation_next_cell, next_r, next_c);
 	if (dirs_next_cell == DIAG(i) && elevation_next_cell < elev_min) {
 	if (dirs_next_cell == DIAG(i) && elevation_next_cell < elev_min) {
 	    elev_min = elevation_next_cell;
 	    elev_min = elevation_next_cell;
 	    j = i;
 	    j = i;

+ 13 - 13
raster/r.stream.channel/stream_write.c

@@ -17,7 +17,7 @@ int seg_set_null_output(SEGMENT *output)
     for (r = 0; r < nrows; ++r) {
     for (r = 0; r < nrows; ++r) {
 	for (c = 0; c < ncols; ++c) {
 	for (c = 0; c < ncols; ++c) {
 	    Rast_set_d_null_value(&output_cell, 1);
 	    Rast_set_d_null_value(&output_cell, 1);
-	    segment_put(output, &output_cell, r, c);
+	    Segment_put(output, &output_cell, r, c);
 	}
 	}
     }
     }
 
 
@@ -59,7 +59,7 @@ int seg_calculate_identifiers(SEGMENT *identifier, int number_of_streams,
 	for (j = 1; j < SA[i].number_of_cells - 1; ++j) {
 	for (j = 1; j < SA[i].number_of_cells - 1; ++j) {
 	    r = (int)SA[i].points[j] / ncols;
 	    r = (int)SA[i].points[j] / ncols;
 	    c = (int)SA[i].points[j] % ncols;
 	    c = (int)SA[i].points[j] % ncols;
-	    segment_put(identifier, &(SA[i].stream_num), r, c);
+	    Segment_put(identifier, &(SA[i].stream_num), r, c);
 	}
 	}
     }
     }
 
 
@@ -115,14 +115,14 @@ int seg_calculate_distance(SEGMENT *output, int number_of_streams,
 		cum_length += SA[i].distance[j];
 		cum_length += SA[i].distance[j];
 		r = (int)SA[i].points[j] / ncols;
 		r = (int)SA[i].points[j] / ncols;
 		c = (int)SA[i].points[j] % ncols;
 		c = (int)SA[i].points[j] % ncols;
-		segment_put(output, &cum_length, r, c);
+		Segment_put(output, &cum_length, r, c);
 	    }
 	    }
 	else
 	else
 	    for (j = SA[i].number_of_cells - 2; j > 0; --j) {
 	    for (j = SA[i].number_of_cells - 2; j > 0; --j) {
 		cum_length += SA[i].distance[j];
 		cum_length += SA[i].distance[j];
 		r = (int)SA[i].points[j] / ncols;
 		r = (int)SA[i].points[j] / ncols;
 		c = (int)SA[i].points[j] % ncols;
 		c = (int)SA[i].points[j] % ncols;
-		segment_put(output, &cum_length, r, c);
+		Segment_put(output, &cum_length, r, c);
 	    }
 	    }
     }
     }
 
 
@@ -167,7 +167,7 @@ int seg_calculate_cell(SEGMENT *output, int number_of_streams,
 	    r = (int)SA[i].points[j] / ncols;
 	    r = (int)SA[i].points[j] / ncols;
 	    c = (int)SA[i].points[j] % ncols;
 	    c = (int)SA[i].points[j] % ncols;
 	    output_cell = downstream ? k : j;
 	    output_cell = downstream ? k : j;
-	    segment_put(output, &output_cell, r, c);
+	    Segment_put(output, &output_cell, r, c);
 	}
 	}
     }
     }
 
 
@@ -217,7 +217,7 @@ int seg_calculate_difference(SEGMENT *output, int number_of_streams,
 		SA[i].elevation[j] - SA[i].elevation[j + 1];
 		SA[i].elevation[j] - SA[i].elevation[j + 1];
 	    r = (int)SA[i].points[j] / ncols;
 	    r = (int)SA[i].points[j] / ncols;
 	    c = (int)SA[i].points[j] % ncols;
 	    c = (int)SA[i].points[j] % ncols;
-	    segment_put(output, &output_cell, r, c);
+	    Segment_put(output, &output_cell, r, c);
 	}
 	}
     }
     }
 
 
@@ -273,7 +273,7 @@ int seg_calculate_drop(SEGMENT *output, int number_of_streams,
 		r = (int)SA[i].points[j] / ncols;
 		r = (int)SA[i].points[j] / ncols;
 		c = (int)SA[i].points[j] % ncols;
 		c = (int)SA[i].points[j] % ncols;
 		output_cell = init - SA[i].elevation[j];
 		output_cell = init - SA[i].elevation[j];
-		segment_put(output, &output_cell, r, c);
+		Segment_put(output, &output_cell, r, c);
 	    }
 	    }
 	}
 	}
 	else {
 	else {
@@ -282,7 +282,7 @@ int seg_calculate_drop(SEGMENT *output, int number_of_streams,
 		r = (int)SA[i].points[j] / ncols;
 		r = (int)SA[i].points[j] / ncols;
 		c = (int)SA[i].points[j] % ncols;
 		c = (int)SA[i].points[j] % ncols;
 		output_cell = SA[i].elevation[j] - init;
 		output_cell = SA[i].elevation[j] - init;
-		segment_put(output, &output_cell, r, c);
+		Segment_put(output, &output_cell, r, c);
 	    }
 	    }
 	}
 	}
     }
     }
@@ -347,7 +347,7 @@ int seg_calculate_gradient(SEGMENT *output, int number_of_streams,
 		r = (int)SA[i].points[j] / ncols;
 		r = (int)SA[i].points[j] / ncols;
 		c = (int)SA[i].points[j] % ncols;
 		c = (int)SA[i].points[j] % ncols;
 		output_cell = (init - SA[i].elevation[j]) / cum_length;
 		output_cell = (init - SA[i].elevation[j]) / cum_length;
-		segment_put(output, &output_cell, r, c);
+		Segment_put(output, &output_cell, r, c);
 
 
 	    }
 	    }
 	}
 	}
@@ -358,7 +358,7 @@ int seg_calculate_gradient(SEGMENT *output, int number_of_streams,
 		r = (int)SA[i].points[j] / ncols;
 		r = (int)SA[i].points[j] / ncols;
 		c = (int)SA[i].points[j] % ncols;
 		c = (int)SA[i].points[j] % ncols;
 		output_cell = (SA[i].elevation[j] - init) / cum_length;
 		output_cell = (SA[i].elevation[j] - init) / cum_length;
-		segment_put(output, &output_cell, r, c);
+		Segment_put(output, &output_cell, r, c);
 	    }
 	    }
 	}
 	}
     }
     }
@@ -411,7 +411,7 @@ int seg_calculate_local_gradient(SEGMENT *output, int number_of_streams,
 		(SA[i].elevation[j] - SA[i].elevation[j + 1]) <
 		(SA[i].elevation[j] - SA[i].elevation[j + 1]) <
 		0 ? 0 : (SA[i].elevation[j] - SA[i].elevation[j + 1]);
 		0 ? 0 : (SA[i].elevation[j] - SA[i].elevation[j + 1]);
 	    output_cell = elev_diff / SA[i].distance[j];
 	    output_cell = elev_diff / SA[i].distance[j];
-	    segment_put(output, &output_cell, r, c);
+	    Segment_put(output, &output_cell, r, c);
 	}
 	}
     }
     }
 
 
@@ -456,7 +456,7 @@ int seg_calculate_local_distance(SEGMENT *output, int number_of_streams,
 	    r = (int)SA[i].points[j] / ncols;
 	    r = (int)SA[i].points[j] / ncols;
 	    c = (int)SA[i].points[j] % ncols;
 	    c = (int)SA[i].points[j] % ncols;
 	    output_cell = SA[i].distance[j];
 	    output_cell = SA[i].distance[j];
-	    segment_put(output, &output_cell, r, c);
+	    Segment_put(output, &output_cell, r, c);
 	}
 	}
     }
     }
 
 
@@ -524,7 +524,7 @@ int seg_calculate_curvature(SEGMENT *output, int number_of_streams,
 	    output_cell =
 	    output_cell =
 		first_derivative /
 		first_derivative /
 		pow((1 + second_derivative * second_derivative), 1.5);
 		pow((1 + second_derivative * second_derivative), 1.5);
-	    segment_put(output, &output_cell, r, c);
+	    Segment_put(output, &output_cell, r, c);
 	}
 	}
     }
     }
 
 

+ 34 - 34
raster/r.stream.distance/distance_calc.c

@@ -152,8 +152,8 @@ int seg_calculate_downstream(SEGMENT *dirs, SEGMENT * distance,
     c = outlet.c;
     c = outlet.c;
 
 
     if (elevation) {
     if (elevation) {
-	segment_get(elevation, &target_elev, r, c);
-	segment_put(elevation, &zero_cell, r, c);
+	Segment_get(elevation, &target_elev, r, c);
+	Segment_put(elevation, &zero_cell, r, c);
     }
     }
 
 
     while (tail != head) {
     while (tail != head) {
@@ -169,11 +169,11 @@ int seg_calculate_downstream(SEGMENT *dirs, SEGMENT * distance,
 	    next_r = NR(i);
 	    next_r = NR(i);
 	    next_c = NC(i);
 	    next_c = NC(i);
 
 
-	    segment_get(dirs, &dirs_cell, next_r, next_c);
+	    Segment_get(dirs, &dirs_cell, next_r, next_c);
 	    if (dirs_cell == j) {	/* countributing cell, reset distance and elevation */
 	    if (dirs_cell == j) {	/* countributing cell, reset distance and elevation */
 
 
 		if (outs) {	/* outlet mode */
 		if (outs) {	/* outlet mode */
-		    segment_get(distance, &distance_cell, next_r, next_c);
+		    Segment_get(distance, &distance_cell, next_r, next_c);
 		    if (distance_cell == 0)
 		    if (distance_cell == 0)
 			continue;	/* continue loop, point is not added to the queue! */
 			continue;	/* continue loop, point is not added to the queue! */
 		    else {
 		    else {
@@ -185,17 +185,17 @@ int seg_calculate_downstream(SEGMENT *dirs, SEGMENT * distance,
 			    tmp_dist + G_distance(easting, northing,
 			    tmp_dist + G_distance(easting, northing,
 						  cell_easting,
 						  cell_easting,
 						  cell_northing);
 						  cell_northing);
-			segment_put(distance, &cur_dist, next_r, next_c);
+			Segment_put(distance, &cur_dist, next_r, next_c);
 
 
 		    }
 		    }
 
 
 		}
 		}
 		else {		/* stream mode */
 		else {		/* stream mode */
-		    segment_get(distance, &distance_cell, next_r, next_c);
+		    Segment_get(distance, &distance_cell, next_r, next_c);
 		    if (distance_cell == 0) {
 		    if (distance_cell == 0) {
 			cur_dist = 0;
 			cur_dist = 0;
 			if (elevation)
 			if (elevation)
-			    segment_get(elevation, &target_elev, next_r,
+			    Segment_get(elevation, &target_elev, next_r,
 					next_c);
 					next_c);
 		    }
 		    }
 		    else {
 		    else {
@@ -207,14 +207,14 @@ int seg_calculate_downstream(SEGMENT *dirs, SEGMENT * distance,
 			    tmp_dist + G_distance(easting, northing,
 			    tmp_dist + G_distance(easting, northing,
 						  cell_easting,
 						  cell_easting,
 						  cell_northing);
 						  cell_northing);
-			segment_put(distance, &cur_dist, next_r, next_c);
+			Segment_put(distance, &cur_dist, next_r, next_c);
 		    }
 		    }
 		}		/* end stream mode */
 		}		/* end stream mode */
 
 
 		if (elevation) {
 		if (elevation) {
-		    segment_get(elevation, &elevation_cell, next_r, next_c);
+		    Segment_get(elevation, &elevation_cell, next_r, next_c);
 		    elevation_cell -= target_elev;
 		    elevation_cell -= target_elev;
-		    segment_put(elevation, &elevation_cell, next_r, next_c);
+		    Segment_put(elevation, &elevation_cell, next_r, next_c);
 		    n_cell.target_elev = target_elev;
 		    n_cell.target_elev = target_elev;
 		}
 		}
 
 
@@ -297,7 +297,7 @@ int seg_fill_basins(OUTLET outlet, SEGMENT * distance, SEGMENT * dirs)
     val = 1;
     val = 1;
     stop = 0;
     stop = 0;
 
 
-    segment_put(distance, &stop, r, c);
+    Segment_put(distance, &stop, r, c);
 
 
     while (tail != head) {
     while (tail != head) {
 
 
@@ -309,13 +309,13 @@ int seg_fill_basins(OUTLET outlet, SEGMENT * distance, SEGMENT * dirs)
 	    next_r = NR(i);
 	    next_r = NR(i);
 	    next_c = NC(i);
 	    next_c = NC(i);
 
 
-	    segment_get(dirs, &dirs_cell, next_r, next_c);
+	    Segment_get(dirs, &dirs_cell, next_r, next_c);
 
 
 	    if (dirs_cell == j) {	/* countributing cell */
 	    if (dirs_cell == j) {	/* countributing cell */
 
 
-		segment_get(distance, &distance_cell, next_r, next_c);
+		Segment_get(distance, &distance_cell, next_r, next_c);
 		distance_cell = (distance_cell == stop) ? stop : val;
 		distance_cell = (distance_cell == stop) ? stop : val;
-		segment_put(distance, &distance_cell, next_r, next_c);
+		Segment_put(distance, &distance_cell, next_r, next_c);
 		n_cell.r = next_r;
 		n_cell.r = next_r;
 		n_cell.c = next_c;
 		n_cell.c = next_c;
 		fifo_insert(n_cell);
 		fifo_insert(n_cell);
@@ -495,15 +495,15 @@ int seg_calculate_upstream(SEGMENT * distance, SEGMENT * dirs,
         /* elevation_data_size = Rast_cell_size(DCELL_TYPE); */
         /* elevation_data_size = Rast_cell_size(DCELL_TYPE); */
 	for (r = 0; r < nrows; ++r)
 	for (r = 0; r < nrows; ++r)
 	    for (c = 0; c < ncols; ++c) {
 	    for (c = 0; c < ncols; ++c) {
-		segment_get(elevation, &elevation_cell, r, c);
-		segment_put(tmp_elevation, &elevation_cell, r, c);
+		Segment_get(elevation, &elevation_cell, r, c);
+		Segment_put(tmp_elevation, &elevation_cell, r, c);
 	    }
 	    }
     }
     }
 
 
     for (r = 0; r < nrows; ++r)
     for (r = 0; r < nrows; ++r)
 	for (c = 0; c < ncols; ++c) {
 	for (c = 0; c < ncols; ++c) {
 
 
-	    segment_get(distance, &distance_cell, r, c);
+	    Segment_get(distance, &distance_cell, r, c);
 
 
 	    for (i = 1; i < 9; ++i) {
 	    for (i = 1; i < 9; ++i) {
 		if (NOT_IN_REGION(i))
 		if (NOT_IN_REGION(i))
@@ -513,21 +513,21 @@ int seg_calculate_upstream(SEGMENT * distance, SEGMENT * dirs,
 		next_r = NR(i);
 		next_r = NR(i);
 		next_c = NC(i);
 		next_c = NC(i);
 
 
-		segment_get(dirs, &dirs_cell, next_r, next_c);
+		Segment_get(dirs, &dirs_cell, next_r, next_c);
 
 
 		if (dirs_cell == j && distance_cell != 0) {	/* is contributing cell */
 		if (dirs_cell == j && distance_cell != 0) {	/* is contributing cell */
-		    segment_put(distance, &minus_one_cell, r, c);
+		    Segment_put(distance, &minus_one_cell, r, c);
 		    break;
 		    break;
 		}
 		}
 	    }			/* end for i */
 	    }			/* end for i */
 
 
-	    segment_get(distance, &distance_cell, r, c);
-	    segment_get(dirs, &dirs_cell, r, c);
+	    Segment_get(distance, &distance_cell, r, c);
+	    Segment_get(dirs, &dirs_cell, r, c);
 	    if (distance_cell == 1) {
 	    if (distance_cell == 1) {
 		if (distance_cell == 1 && dirs_cell > 0)
 		if (distance_cell == 1 && dirs_cell > 0)
 		    n_inits++;
 		    n_inits++;
 		else if (dirs_cell > 0)
 		else if (dirs_cell > 0)
-		    segment_put(distance, &minus_one_cell, r, c);
+		    Segment_put(distance, &minus_one_cell, r, c);
 	    }
 	    }
 
 
 	}
 	}
@@ -538,15 +538,15 @@ int seg_calculate_upstream(SEGMENT * distance, SEGMENT * dirs,
     for (r = 0; r < nrows; ++r)
     for (r = 0; r < nrows; ++r)
 	for (c = 0; c < ncols; ++c) {
 	for (c = 0; c < ncols; ++c) {
 
 
-	    segment_get(distance, &distance_cell, r, c);
+	    Segment_get(distance, &distance_cell, r, c);
 	    if (distance_cell == 1) {
 	    if (distance_cell == 1) {
 
 
-		segment_put(distance, &zero_cell, r, c);
+		Segment_put(distance, &zero_cell, r, c);
 		if (elevation)
 		if (elevation)
-		    segment_put(elevation, &zero_cell, r, c);
+		    Segment_put(elevation, &zero_cell, r, c);
 
 
-		segment_get(dirs, &d, r, c);
-		segment_get(dirs, &d_next, NR(d), NR(d));
+		Segment_get(dirs, &d, r, c);
+		Segment_get(dirs, &d_next, NR(d), NR(d));
 
 
 		if (d_next < 0)
 		if (d_next < 0)
 		    continue;
 		    continue;
@@ -556,7 +556,7 @@ int seg_calculate_upstream(SEGMENT * distance, SEGMENT * dirs,
 		d_inits[k].cur_dist = 0;
 		d_inits[k].cur_dist = 0;
 
 
 		if (elevation)
 		if (elevation)
-		    segment_get(tmp_elevation, &(d_inits[k].target_elev), r,
+		    Segment_get(tmp_elevation, &(d_inits[k].target_elev), r,
 				c);
 				c);
 		k++;
 		k++;
 	    }
 	    }
@@ -573,7 +573,7 @@ int seg_calculate_upstream(SEGMENT * distance, SEGMENT * dirs,
 	    r = d_inits[i].r;
 	    r = d_inits[i].r;
 	    c = d_inits[i].c;
 	    c = d_inits[i].c;
 
 
-	    segment_get(dirs, &d, r, c);
+	    Segment_get(dirs, &d, r, c);
 	    next_r = NR(d);
 	    next_r = NR(d);
 	    next_c = NC(d);
 	    next_c = NC(d);
 	    tmp_dist = d_inits[i].cur_dist;
 	    tmp_dist = d_inits[i].cur_dist;
@@ -589,7 +589,7 @@ int seg_calculate_upstream(SEGMENT * distance, SEGMENT * dirs,
 	    cur_dist = tmp_dist +
 	    cur_dist = tmp_dist +
 		G_distance(easting, northing, cell_easting, cell_northing);
 		G_distance(easting, northing, cell_easting, cell_northing);
 
 
-	    segment_get(distance, &distance_cell, next_r, next_c);
+	    Segment_get(distance, &distance_cell, next_r, next_c);
 
 
 	    if (near)
 	    if (near)
 		done = (distance_cell > cur_dist ||
 		done = (distance_cell > cur_dist ||
@@ -599,16 +599,16 @@ int seg_calculate_upstream(SEGMENT * distance, SEGMENT * dirs,
 			distance_cell <= 0) ? 1 : 0;
 			distance_cell <= 0) ? 1 : 0;
 
 
 	    if (done) {
 	    if (done) {
-		segment_put(distance, &cur_dist, next_r, next_c);
+		Segment_put(distance, &cur_dist, next_r, next_c);
 		if (elevation) {
 		if (elevation) {
-		    segment_get(tmp_elevation, &tmp_elevation_cell, next_r,
+		    Segment_get(tmp_elevation, &tmp_elevation_cell, next_r,
 				next_c);
 				next_c);
 		    tmp_elevation_cell = target_elev - tmp_elevation_cell;
 		    tmp_elevation_cell = target_elev - tmp_elevation_cell;
-		    segment_put(elevation, &tmp_elevation_cell, next_r,
+		    Segment_put(elevation, &tmp_elevation_cell, next_r,
 				next_c);
 				next_c);
 		}
 		}
 
 
-		segment_get(dirs, &dirs_cell, NR(d), NC(d));
+		Segment_get(dirs, &dirs_cell, NR(d), NC(d));
 		if (dirs_cell < 1)
 		if (dirs_cell < 1)
 		    continue;
 		    continue;
 
 

+ 9 - 9
raster/r.stream.distance/distance_init.c

@@ -82,7 +82,7 @@ int seg_find_outlets(SEGMENT * streams, int number_of_streams, SEGMENT * dirs,
 
 
     for (r = 0; r < nrows; ++r)
     for (r = 0; r < nrows; ++r)
 	for (c = 0; c < ncols; ++c) {
 	for (c = 0; c < ncols; ++c) {
-	    segment_get(streams, &streams_cell, r, c);
+	    Segment_get(streams, &streams_cell, r, c);
 
 
 	    if (streams_cell > 0) {
 	    if (streams_cell > 0) {
 		if (outlets_num > (out_max - 1)) {
 		if (outlets_num > (out_max - 1)) {
@@ -94,14 +94,14 @@ int seg_find_outlets(SEGMENT * streams, int number_of_streams, SEGMENT * dirs,
 					     (out_max) * sizeof(OUTLET));
 					     (out_max) * sizeof(OUTLET));
 		}
 		}
 
 
-		segment_get(dirs, &dirs_cell, r, c);
+		Segment_get(dirs, &dirs_cell, r, c);
 		d = abs(dirs_cell);	/* r.watershed */
 		d = abs(dirs_cell);	/* r.watershed */
 
 
 		if (NOT_IN_REGION(d)) {
 		if (NOT_IN_REGION(d)) {
 		    next_stream = -1;
 		    next_stream = -1;
 		}
 		}
 		else {
 		else {
-		    segment_get(streams, &next_stream, NR(d), NC(d));
+		    Segment_get(streams, &next_stream, NR(d), NC(d));
 		    if (next_stream < 1)
 		    if (next_stream < 1)
 			next_stream = -1;
 			next_stream = -1;
 		}
 		}
@@ -164,18 +164,18 @@ int seg_init_distance(SEGMENT * streams, SEGMENT * distance, int outlets_num,
     if (!outs) {		/* stream mode */
     if (!outs) {		/* stream mode */
 	for (r = 0; r < nrows; ++r)
 	for (r = 0; r < nrows; ++r)
 	    for (c = 0; c < ncols; ++c) {
 	    for (c = 0; c < ncols; ++c) {
-		segment_get(streams, &streams_cell, r, c);
+		Segment_get(streams, &streams_cell, r, c);
 		distance_cell = (streams_cell) ? 0 : -1;
 		distance_cell = (streams_cell) ? 0 : -1;
-		segment_put(distance, &distance_cell, r, c);
+		Segment_put(distance, &distance_cell, r, c);
 	    }
 	    }
     }
     }
     else {			/* outlets mode */
     else {			/* outlets mode */
 	for (r = 0; r < nrows; ++r)
 	for (r = 0; r < nrows; ++r)
 	    for (c = 0; c < ncols; ++c)
 	    for (c = 0; c < ncols; ++c)
-		segment_put(distance, &minus_one_cell, r, c);
+		Segment_put(distance, &minus_one_cell, r, c);
 
 
 	for (i = 0; i < outlets_num; ++i)
 	for (i = 0; i < outlets_num; ++i)
-	    segment_put(distance, &zero_cell, outlets[i].r, outlets[i].c);
+	    Segment_put(distance, &zero_cell, outlets[i].r, outlets[i].c);
     }
     }
     return 0;
     return 0;
 }
 }
@@ -202,9 +202,9 @@ int seg_prep_null_elevation(SEGMENT * distance, SEGMENT * elevation)
 
 
     for (r = 0; r < nrows; ++r)
     for (r = 0; r < nrows; ++r)
 	for (c = 0; c < ncols; ++c) {
 	for (c = 0; c < ncols; ++c) {
-	    segment_get(distance, &distance_cell, r, c);
+	    Segment_get(distance, &distance_cell, r, c);
 	    if (distance_cell == -1)
 	    if (distance_cell == -1)
-		segment_put(elevation, &distance_cell, r, c);
+		Segment_put(elevation, &distance_cell, r, c);
 	}
 	}
 
 
     return 0;
     return 0;

+ 7 - 7
raster/r.stream.distance/io.c

@@ -301,7 +301,7 @@ int seg_create_map(SEG * seg, int srows, int scols, int number_of_segs,
     fd = creat(filename, 0666);
     fd = creat(filename, 0666);
 
 
     if (0 >
     if (0 >
-	segment_format(fd, seg->nrows, seg->ncols, srows, scols,
+	Segment_format(fd, seg->nrows, seg->ncols, srows, scols,
 		       seg->data_size)) {
 		       seg->data_size)) {
 	close(fd);
 	close(fd);
 	unlink(filename);
 	unlink(filename);
@@ -314,7 +314,7 @@ int seg_create_map(SEG * seg, int srows, int scols, int number_of_segs,
 	G_fatal_error(_("Unable to re-open file '%s'"), filename);
 	G_fatal_error(_("Unable to re-open file '%s'"), filename);
     }
     }
 
 
-    if (0 > (fd = segment_init(&(seg->seg), fd, number_of_segs))) {
+    if (0 > (fd = Segment_init(&(seg->seg), fd, number_of_segs))) {
 	unlink(filename);
 	unlink(filename);
 	G_fatal_error(_("Unable to init segment file or out of memory"));
 	G_fatal_error(_("Unable to init segment file or out of memory"));
     }
     }
@@ -437,7 +437,7 @@ int seg_read_map(SEG * seg, char *input_map_name, int check_res,
 		}
 		}
 	    }
 	    }
 
 
-	if (0 > segment_put_row(&(seg->seg), target_buffer, r)) {
+	if (0 > Segment_put_row(&(seg->seg), target_buffer, r)) {
 	    G_free(input_buffer);
 	    G_free(input_buffer);
 	    G_free(target_buffer);
 	    G_free(target_buffer);
 	    Rast_close(input_fd);
 	    Rast_close(input_fd);
@@ -466,7 +466,7 @@ int seg_reset_map(SEG * seg, int value)
 
 
     for (r = 0; r < seg->nrows; ++r)
     for (r = 0; r < seg->nrows; ++r)
 	for (c = 0; c < seg->ncols; ++c)
 	for (c = 0; c < seg->ncols; ++c)
-	    segment_put(&(seg->seg), &value, r, c);
+	    Segment_put(&(seg->seg), &value, r, c);
 
 
     return 0;
     return 0;
 }
 }
@@ -498,13 +498,13 @@ int seg_write_map(SEG * seg, char *output_map_name,
     G_message(_("Writing raster map <%s>..."), output_map_name);
     G_message(_("Writing raster map <%s>..."), output_map_name);
     output_fd = Rast_open_new(output_map_name, output_data_type);
     output_fd = Rast_open_new(output_map_name, output_data_type);
     output_buffer = Rast_allocate_buf(output_data_type);
     output_buffer = Rast_allocate_buf(output_data_type);
-    segment_flush(&(seg->seg));
+    Segment_flush(&(seg->seg));
 
 
     /* writing */
     /* writing */
     for (r = 0; r < seg->nrows; ++r) {
     for (r = 0; r < seg->nrows; ++r) {
 
 
 	G_percent(r, seg->nrows, 2);
 	G_percent(r, seg->nrows, 2);
-	if (0 > segment_get_row(&(seg->seg), output_buffer, r))
+	if (0 > Segment_get_row(&(seg->seg), output_buffer, r))
 	    G_warning(_("Unable to segment read row %d for raster map <%s>"),
 	    G_warning(_("Unable to segment read row %d for raster map <%s>"),
 		      r, output_map_name);
 		      r, output_map_name);
 
 
@@ -550,7 +550,7 @@ int seg_release_map(SEG * seg)
     /* 
     /* 
      * release segment close files, set pointers to null;
      * release segment close files, set pointers to null;
      */
      */
-    segment_release(&(seg->seg));
+    Segment_release(&(seg->seg));
     close(seg->fd);
     close(seg->fd);
     unlink(seg->filename);
     unlink(seg->filename);
 
 

+ 6 - 6
raster/r.stream.extract/bseg.c

@@ -19,7 +19,7 @@ int bseg_open(BSEG *bseg, int srows, int scols, int nsegs_in_memory)
 	G_warning(_("Unable to create segment file"));
 	G_warning(_("Unable to create segment file"));
 	return -2;
 	return -2;
     }
     }
-    if (0 > (errflag = segment_format(fd, Rast_window_rows(),
+    if (0 > (errflag = Segment_format(fd, Rast_window_rows(),
 				      Rast_window_cols(), srows, scols,
 				      Rast_window_cols(), srows, scols,
 				      sizeof(char)))) {
 				      sizeof(char)))) {
 	close(fd);
 	close(fd);
@@ -39,7 +39,7 @@ int bseg_open(BSEG *bseg, int srows, int scols, int nsegs_in_memory)
 	G_warning(_("Unable to re-open segment file"));
 	G_warning(_("Unable to re-open segment file"));
 	return -4;
 	return -4;
     }
     }
-    if (0 > (errflag = segment_init(&(bseg->seg), fd, nsegs_in_memory))) {
+    if (0 > (errflag = Segment_init(&(bseg->seg), fd, nsegs_in_memory))) {
 	close(fd);
 	close(fd);
 	unlink(filename);
 	unlink(filename);
 	if (errflag == -1) {
 	if (errflag == -1) {
@@ -58,7 +58,7 @@ int bseg_open(BSEG *bseg, int srows, int scols, int nsegs_in_memory)
 
 
 int bseg_close(BSEG *bseg)
 int bseg_close(BSEG *bseg)
 {
 {
-    segment_release(&(bseg->seg));
+    Segment_release(&(bseg->seg));
     close(bseg->fd);
     close(bseg->fd);
     unlink(bseg->filename);
     unlink(bseg->filename);
     if (bseg->name) {
     if (bseg->name) {
@@ -74,7 +74,7 @@ int bseg_close(BSEG *bseg)
 
 
 int bseg_put(BSEG *bseg, char *value, int row, int col)
 int bseg_put(BSEG *bseg, char *value, int row, int col)
 {
 {
-    if (segment_put(&(bseg->seg), value, row, col) < 0) {
+    if (Segment_put(&(bseg->seg), value, row, col) < 0) {
 	G_warning(_("Unable to write segment file"));
 	G_warning(_("Unable to write segment file"));
 	return -1;
 	return -1;
     }
     }
@@ -83,7 +83,7 @@ int bseg_put(BSEG *bseg, char *value, int row, int col)
 
 
 int bseg_put_row(BSEG *bseg, char *value, int row)
 int bseg_put_row(BSEG *bseg, char *value, int row)
 {
 {
-    if (segment_put_row(&(bseg->seg), value, row) < 0) {
+    if (Segment_put_row(&(bseg->seg), value, row) < 0) {
 	G_warning(_("Unable to write segment file"));
 	G_warning(_("Unable to write segment file"));
 	return -1;
 	return -1;
     }
     }
@@ -92,7 +92,7 @@ int bseg_put_row(BSEG *bseg, char *value, int row)
 
 
 int bseg_get(BSEG *bseg, char *value, int row, int col)
 int bseg_get(BSEG *bseg, char *value, int row, int col)
 {
 {
-    if (segment_get(&(bseg->seg), value, row, col) < 0) {
+    if (Segment_get(&(bseg->seg), value, row, col) < 0) {
 	G_warning(_("Unable to read segment file"));
 	G_warning(_("Unable to read segment file"));
 	return -1;
 	return -1;
     }
     }

+ 9 - 9
raster/r.stream.extract/cseg.c

@@ -21,7 +21,7 @@ int cseg_open(CSEG *cseg, int srows, int scols, int nsegs_in_memory)
     }
     }
     if (0 >
     if (0 >
 	(errflag =
 	(errflag =
-	 segment_format(fd, Rast_window_rows(), Rast_window_cols(), srows, scols,
+	 Segment_format(fd, Rast_window_rows(), Rast_window_cols(), srows, scols,
 			sizeof(CELL)))) {
 			sizeof(CELL)))) {
 	close(fd);
 	close(fd);
 	unlink(filename);
 	unlink(filename);
@@ -40,7 +40,7 @@ int cseg_open(CSEG *cseg, int srows, int scols, int nsegs_in_memory)
 	G_warning(_("Unable to re-open segment file"));
 	G_warning(_("Unable to re-open segment file"));
 	return -4;
 	return -4;
     }
     }
-    if (0 > (errflag = segment_init(&(cseg->seg), fd, nsegs_in_memory))) {
+    if (0 > (errflag = Segment_init(&(cseg->seg), fd, nsegs_in_memory))) {
 	close(fd);
 	close(fd);
 	unlink(filename);
 	unlink(filename);
 	if (errflag == -1) {
 	if (errflag == -1) {
@@ -59,7 +59,7 @@ int cseg_open(CSEG *cseg, int srows, int scols, int nsegs_in_memory)
 
 
 int cseg_close(CSEG *cseg)
 int cseg_close(CSEG *cseg)
 {
 {
-    segment_release(&(cseg->seg));
+    Segment_release(&(cseg->seg));
     close(cseg->fd);
     close(cseg->fd);
     unlink(cseg->filename);
     unlink(cseg->filename);
     if (cseg->name) {
     if (cseg->name) {
@@ -75,7 +75,7 @@ int cseg_close(CSEG *cseg)
 
 
 int cseg_put(CSEG *cseg, CELL *value, int row, int col)
 int cseg_put(CSEG *cseg, CELL *value, int row, int col)
 {
 {
-    if (segment_put(&(cseg->seg), value, row, col) < 0) {
+    if (Segment_put(&(cseg->seg), value, row, col) < 0) {
 	G_warning(_("Unable to write segment file"));
 	G_warning(_("Unable to write segment file"));
 	return -1;
 	return -1;
     }
     }
@@ -84,7 +84,7 @@ int cseg_put(CSEG *cseg, CELL *value, int row, int col)
 
 
 int cseg_put_row(CSEG *cseg, CELL *value, int row)
 int cseg_put_row(CSEG *cseg, CELL *value, int row)
 {
 {
-    if (segment_put_row(&(cseg->seg), value, row) < 0) {
+    if (Segment_put_row(&(cseg->seg), value, row) < 0) {
 	G_warning(_("Unable to write segment file"));
 	G_warning(_("Unable to write segment file"));
 	return -1;
 	return -1;
     }
     }
@@ -93,7 +93,7 @@ int cseg_put_row(CSEG *cseg, CELL *value, int row)
 
 
 int cseg_get(CSEG *cseg, CELL *value, int row, int col)
 int cseg_get(CSEG *cseg, CELL *value, int row, int col)
 {
 {
-    if (segment_get(&(cseg->seg), value, row, col) < 0) {
+    if (Segment_get(&(cseg->seg), value, row, col) < 0) {
 	G_warning(_("Unabel to read segment file"));
 	G_warning(_("Unabel to read segment file"));
 	return -1;
 	return -1;
     }
     }
@@ -114,7 +114,7 @@ int cseg_read_raster(CSEG *cseg, char *map_name, char *mapset)
     buffer = Rast_allocate_c_buf();
     buffer = Rast_allocate_c_buf();
     for (row = 0; row < nrows; row++) {
     for (row = 0; row < nrows; row++) {
 	Rast_get_c_row(map_fd, buffer, row);
 	Rast_get_c_row(map_fd, buffer, row);
-	if (segment_put_row(&(cseg->seg), buffer, row) < 0) {
+	if (Segment_put_row(&(cseg->seg), buffer, row) < 0) {
 	    G_free(buffer);
 	    G_free(buffer);
 	    Rast_close(map_fd);
 	    Rast_close(map_fd);
 	    G_warning(_("Unable to segment put row %d for raster map <%s>"),
 	    G_warning(_("Unable to segment put row %d for raster map <%s>"),
@@ -141,10 +141,10 @@ int cseg_write_raster(CSEG *cseg, char *map_name)
     map_fd = Rast_open_c_new(map_name);
     map_fd = Rast_open_c_new(map_name);
     nrows = Rast_window_rows();
     nrows = Rast_window_rows();
     buffer = Rast_allocate_c_buf();
     buffer = Rast_allocate_c_buf();
-    segment_flush(&(cseg->seg));
+    Segment_flush(&(cseg->seg));
     for (row = 0; row < nrows; row++) {
     for (row = 0; row < nrows; row++) {
 	G_percent(row, nrows, 1);
 	G_percent(row, nrows, 1);
-	segment_get_row(&(cseg->seg), buffer, row);
+	Segment_get_row(&(cseg->seg), buffer, row);
 	Rast_put_row(map_fd, buffer, CELL_TYPE);
 	Rast_put_row(map_fd, buffer, CELL_TYPE);
     }
     }
     G_percent(row, nrows, 1);    /* finish it */
     G_percent(row, nrows, 1);    /* finish it */

+ 9 - 9
raster/r.stream.extract/dseg.c

@@ -21,7 +21,7 @@ int dseg_open(DSEG *dseg, int srows, int scols, int nsegs_in_memory)
     }
     }
     if (0 >
     if (0 >
 	(errflag =
 	(errflag =
-	 segment_format(fd, Rast_window_rows(), Rast_window_cols(), srows, scols,
+	 Segment_format(fd, Rast_window_rows(), Rast_window_cols(), srows, scols,
 			sizeof(DCELL)))) {
 			sizeof(DCELL)))) {
 	close(fd);
 	close(fd);
 	unlink(filename);
 	unlink(filename);
@@ -40,7 +40,7 @@ int dseg_open(DSEG *dseg, int srows, int scols, int nsegs_in_memory)
 	G_warning(_("Unable to re-open segment file"));
 	G_warning(_("Unable to re-open segment file"));
 	return -4;
 	return -4;
     }
     }
-    if (0 > (errflag = segment_init(&(dseg->seg), fd, nsegs_in_memory))) {
+    if (0 > (errflag = Segment_init(&(dseg->seg), fd, nsegs_in_memory))) {
 	close(fd);
 	close(fd);
 	unlink(filename);
 	unlink(filename);
 	if (errflag == -1) {
 	if (errflag == -1) {
@@ -59,7 +59,7 @@ int dseg_open(DSEG *dseg, int srows, int scols, int nsegs_in_memory)
 
 
 int dseg_close(DSEG *dseg)
 int dseg_close(DSEG *dseg)
 {
 {
-    segment_release(&(dseg->seg));
+    Segment_release(&(dseg->seg));
     close(dseg->fd);
     close(dseg->fd);
     unlink(dseg->filename);
     unlink(dseg->filename);
     if (dseg->name) {
     if (dseg->name) {
@@ -75,7 +75,7 @@ int dseg_close(DSEG *dseg)
 
 
 int dseg_put(DSEG *dseg, DCELL *value, int row, int col)
 int dseg_put(DSEG *dseg, DCELL *value, int row, int col)
 {
 {
-    if (segment_put(&(dseg->seg), (DCELL *) value, row, col) < 0) {
+    if (Segment_put(&(dseg->seg), (DCELL *) value, row, col) < 0) {
 	G_warning(_("Unable to write segment file"));
 	G_warning(_("Unable to write segment file"));
 	return -1;
 	return -1;
     }
     }
@@ -84,7 +84,7 @@ int dseg_put(DSEG *dseg, DCELL *value, int row, int col)
 
 
 int dseg_put_row(DSEG *dseg, DCELL *value, int row)
 int dseg_put_row(DSEG *dseg, DCELL *value, int row)
 {
 {
-    if (segment_put_row(&(dseg->seg), (DCELL *) value, row) < 0) {
+    if (Segment_put_row(&(dseg->seg), (DCELL *) value, row) < 0) {
 	G_warning(_("Unable to write segment file"));
 	G_warning(_("Unable to write segment file"));
 	return -1;
 	return -1;
     }
     }
@@ -93,7 +93,7 @@ int dseg_put_row(DSEG *dseg, DCELL *value, int row)
 
 
 int dseg_get(DSEG *dseg, DCELL *value, int row, int col)
 int dseg_get(DSEG *dseg, DCELL *value, int row, int col)
 {
 {
-    if (segment_get(&(dseg->seg), (DCELL *) value, row, col) < 0) {
+    if (Segment_get(&(dseg->seg), (DCELL *) value, row, col) < 0) {
 	G_warning(_("Unable to read segment file"));
 	G_warning(_("Unable to read segment file"));
 	return -1;
 	return -1;
     }
     }
@@ -114,7 +114,7 @@ int dseg_read_raster(DSEG *dseg, char *map_name, char *mapset)
     dbuffer = Rast_allocate_d_buf();
     dbuffer = Rast_allocate_d_buf();
     for (row = 0; row < nrows; row++) {
     for (row = 0; row < nrows; row++) {
 	Rast_get_d_row(map_fd, dbuffer, row);
 	Rast_get_d_row(map_fd, dbuffer, row);
-	if (segment_put_row(&(dseg->seg), (DCELL *) dbuffer, row) < 0) {
+	if (Segment_put_row(&(dseg->seg), (DCELL *) dbuffer, row) < 0) {
 	    G_free(dbuffer);
 	    G_free(dbuffer);
 	    Rast_close(map_fd);
 	    Rast_close(map_fd);
 	    G_warning(_("Inable to segment put row %d for raster <%s>"),
 	    G_warning(_("Inable to segment put row %d for raster <%s>"),
@@ -141,10 +141,10 @@ int dseg_write_cellfile(DSEG *dseg, char *map_name)
     map_fd = Rast_open_new(map_name, DCELL_TYPE);
     map_fd = Rast_open_new(map_name, DCELL_TYPE);
     nrows = Rast_window_rows();
     nrows = Rast_window_rows();
     dbuffer = Rast_allocate_d_buf();
     dbuffer = Rast_allocate_d_buf();
-    segment_flush(&(dseg->seg));
+    Segment_flush(&(dseg->seg));
     for (row = 0; row < nrows; row++) {
     for (row = 0; row < nrows; row++) {
 	G_percent(row, nrows, 1);
 	G_percent(row, nrows, 1);
-	segment_get_row(&(dseg->seg), (DCELL *) dbuffer, row);
+	Segment_get_row(&(dseg->seg), (DCELL *) dbuffer, row);
 	Rast_put_row(map_fd, dbuffer, DCELL_TYPE);
 	Rast_put_row(map_fd, dbuffer, DCELL_TYPE);
     }
     }
     G_percent(row, nrows, 1);    /* finish it */
     G_percent(row, nrows, 1);    /* finish it */

+ 9 - 9
raster/r.stream.extract/seg.c

@@ -20,10 +20,10 @@ seg_open(SSEG *sseg, int nrows, int ncols, int row_in_seg, int col_in_seg,
 	return -2;
 	return -2;
     }
     }
     if (fill)
     if (fill)
-	errflag = segment_format(fd, nrows, ncols, row_in_seg,
+	errflag = Segment_format(fd, nrows, ncols, row_in_seg,
 	                         col_in_seg, size_struct);
 	                         col_in_seg, size_struct);
     else
     else
-	errflag = segment_format_nofill(fd, nrows, ncols, row_in_seg,
+	errflag = Segment_format_nofill(fd, nrows, ncols, row_in_seg,
 	                         col_in_seg, size_struct);
 	                         col_in_seg, size_struct);
 
 
     if (0 > errflag) {
     if (0 > errflag) {
@@ -44,7 +44,7 @@ seg_open(SSEG *sseg, int nrows, int ncols, int row_in_seg, int col_in_seg,
 	G_warning(_("Unable to re-open file '%s'"), filename);
 	G_warning(_("Unable to re-open file '%s'"), filename);
 	return -4;
 	return -4;
     }
     }
-    if (0 > (errflag = segment_init(&(sseg->seg), fd, nsegs_in_memory))) {
+    if (0 > (errflag = Segment_init(&(sseg->seg), fd, nsegs_in_memory))) {
 	close(fd);
 	close(fd);
 	unlink(filename);
 	unlink(filename);
 	if (errflag == -1) {
 	if (errflag == -1) {
@@ -63,7 +63,7 @@ seg_open(SSEG *sseg, int nrows, int ncols, int row_in_seg, int col_in_seg,
 
 
 int seg_close(SSEG *sseg)
 int seg_close(SSEG *sseg)
 {
 {
-    segment_release(&(sseg->seg));
+    Segment_release(&(sseg->seg));
     close(sseg->fd);
     close(sseg->fd);
     unlink(sseg->filename);
     unlink(sseg->filename);
     return 0;
     return 0;
@@ -71,7 +71,7 @@ int seg_close(SSEG *sseg)
 
 
 int seg_put(SSEG *sseg, char *value, int row, int col)
 int seg_put(SSEG *sseg, char *value, int row, int col)
 {
 {
-    if (segment_put(&(sseg->seg), value, row, col) < 0) {
+    if (Segment_put(&(sseg->seg), value, row, col) < 0) {
 	G_warning(_("Unable to write segment file"));
 	G_warning(_("Unable to write segment file"));
 	return -1;
 	return -1;
     }
     }
@@ -80,7 +80,7 @@ int seg_put(SSEG *sseg, char *value, int row, int col)
 
 
 int seg_put_row(SSEG *sseg, char *value, int row)
 int seg_put_row(SSEG *sseg, char *value, int row)
 {
 {
-    if (segment_put_row(&(sseg->seg), value, row) < 0) {
+    if (Segment_put_row(&(sseg->seg), value, row) < 0) {
 	G_warning(_("seg_put_row(): could not write segment file"));
 	G_warning(_("seg_put_row(): could not write segment file"));
 	return -1;
 	return -1;
     }
     }
@@ -89,7 +89,7 @@ int seg_put_row(SSEG *sseg, char *value, int row)
 
 
 int seg_get(SSEG *sseg, char *value, int row, int col)
 int seg_get(SSEG *sseg, char *value, int row, int col)
 {
 {
-    if (segment_get(&(sseg->seg), value, row, col) < 0) {
+    if (Segment_get(&(sseg->seg), value, row, col) < 0) {
 	G_warning(_("Unable to read segment file"));
 	G_warning(_("Unable to read segment file"));
 	return -1;
 	return -1;
     }
     }
@@ -98,7 +98,7 @@ int seg_get(SSEG *sseg, char *value, int row, int col)
 
 
 int seg_get_row(SSEG *sseg, char *value, int row)
 int seg_get_row(SSEG *sseg, char *value, int row)
 {
 {
-    if (segment_get_row(&(sseg->seg), value, row) < 0) {
+    if (Segment_get_row(&(sseg->seg), value, row) < 0) {
 	G_warning(_("Unable to read segment file"));
 	G_warning(_("Unable to read segment file"));
 	return -1;
 	return -1;
     }
     }
@@ -107,6 +107,6 @@ int seg_get_row(SSEG *sseg, char *value, int row)
 
 
 int seg_flush(SSEG *sseg)
 int seg_flush(SSEG *sseg)
 {
 {
-    segment_flush(&(sseg->seg));
+    Segment_flush(&(sseg->seg));
     return 0;
     return 0;
 }
 }

+ 7 - 7
raster/r.stream.order/io.c

@@ -301,7 +301,7 @@ int seg_create_map(SEG * seg, int srows, int scols, int number_of_segs,
     fd = creat(filename, 0666);
     fd = creat(filename, 0666);
 
 
     if (0 >
     if (0 >
-	segment_format(fd, seg->nrows, seg->ncols, srows, scols,
+	Segment_format(fd, seg->nrows, seg->ncols, srows, scols,
 		       seg->data_size)) {
 		       seg->data_size)) {
 	close(fd);
 	close(fd);
 	unlink(filename);
 	unlink(filename);
@@ -314,7 +314,7 @@ int seg_create_map(SEG * seg, int srows, int scols, int number_of_segs,
 	G_fatal_error(_("Unable to re-open file '%s'"), filename);
 	G_fatal_error(_("Unable to re-open file '%s'"), filename);
     }
     }
 
 
-    if (0 > (fd = segment_init(&(seg->seg), fd, number_of_segs))) {
+    if (0 > (fd = Segment_init(&(seg->seg), fd, number_of_segs))) {
 	unlink(filename);
 	unlink(filename);
 	G_fatal_error(_("Unable to init segment file or out of memory"));
 	G_fatal_error(_("Unable to init segment file or out of memory"));
     }
     }
@@ -437,7 +437,7 @@ int seg_read_map(SEG * seg, char *input_map_name, int check_res,
 		}
 		}
 	    }
 	    }
 
 
-	if (0 > segment_put_row(&(seg->seg), target_buffer, r)) {
+	if (0 > Segment_put_row(&(seg->seg), target_buffer, r)) {
 	    G_free(input_buffer);
 	    G_free(input_buffer);
 	    G_free(target_buffer);
 	    G_free(target_buffer);
 	    Rast_close(input_fd);
 	    Rast_close(input_fd);
@@ -466,7 +466,7 @@ int seg_reset_map(SEG * seg, int value)
 
 
     for (r = 0; r < seg->nrows; ++r)
     for (r = 0; r < seg->nrows; ++r)
 	for (c = 0; c < seg->ncols; ++c)
 	for (c = 0; c < seg->ncols; ++c)
-	    segment_put(&(seg->seg), &value, r, c);
+	    Segment_put(&(seg->seg), &value, r, c);
 
 
     return 0;
     return 0;
 }
 }
@@ -498,13 +498,13 @@ int seg_write_map(SEG * seg, char *output_map_name,
     G_message(_("Writing raster map <%s>..."), output_map_name);
     G_message(_("Writing raster map <%s>..."), output_map_name);
     output_fd = Rast_open_new(output_map_name, output_data_type);
     output_fd = Rast_open_new(output_map_name, output_data_type);
     output_buffer = Rast_allocate_buf(output_data_type);
     output_buffer = Rast_allocate_buf(output_data_type);
-    segment_flush(&(seg->seg));
+    Segment_flush(&(seg->seg));
 
 
     /* writing */
     /* writing */
     for (r = 0; r < seg->nrows; ++r) {
     for (r = 0; r < seg->nrows; ++r) {
 
 
 	G_percent(r, seg->nrows, 2);
 	G_percent(r, seg->nrows, 2);
-	if (0 > segment_get_row(&(seg->seg), output_buffer, r))
+	if (0 > Segment_get_row(&(seg->seg), output_buffer, r))
 	    G_warning(_("Unable to segment read row %d for raster map <%s>"),
 	    G_warning(_("Unable to segment read row %d for raster map <%s>"),
 		      r, output_map_name);
 		      r, output_map_name);
 
 
@@ -550,7 +550,7 @@ int seg_release_map(SEG * seg)
     /* 
     /* 
      * release segment close files, set pointers to null;
      * release segment close files, set pointers to null;
      */
      */
-    segment_release(&(seg->seg));
+    Segment_release(&(seg->seg));
     close(seg->fd);
     close(seg->fd);
     unlink(seg->filename);
     unlink(seg->filename);
 
 

+ 2 - 2
raster/r.stream.order/stream_raster_close.c

@@ -88,10 +88,10 @@ int seg_close_raster_order(SEGMENT *streams, int number_of_streams,
     data_size = Rast_cell_size(CELL_TYPE);
     data_size = Rast_cell_size(CELL_TYPE);
     output_buffer = Rast_allocate_c_buf();
     output_buffer = Rast_allocate_c_buf();
     streams_buffer = Rast_allocate_c_buf();
     streams_buffer = Rast_allocate_c_buf();
-    segment_flush(streams);
+    Segment_flush(streams);
 
 
     for (r = 0; r < nrows; ++r) {
     for (r = 0; r < nrows; ++r) {
-	if (0 > segment_get_row(streams, streams_buffer, r))
+	if (0 > Segment_get_row(streams, streams_buffer, r))
 	    G_warning(_("Unable to segment read row %d for raster map <%s>"),
 	    G_warning(_("Unable to segment read row %d for raster map <%s>"),
 		      r, output_map_names[i]);
 		      r, output_map_names[i]);
 
 

+ 11 - 11
raster/r.stream.order/stream_topology.c

@@ -214,8 +214,8 @@ int seg_number_of_tribs(int r, int c, SEGMENT *streams, SEGMENT *dirs)
 
 
 	j = DIAG(i);
 	j = DIAG(i);
 
 
-	segment_get(streams, &streams_cell, NR(i), NC(i));
-	segment_get(dirs, &dirs_cell, NR(i), NC(i));
+	Segment_get(streams, &streams_cell, NR(i), NC(i));
+	Segment_get(dirs, &dirs_cell, NR(i), NC(i));
 
 
 	if (streams_cell && dirs_cell == j)
 	if (streams_cell && dirs_cell == j)
 	    trib++;
 	    trib++;
@@ -258,8 +258,8 @@ int seg_stream_topology(SEGMENT *streams, SEGMENT *dirs,
     for (r = 0; r < nrows; ++r) {
     for (r = 0; r < nrows; ++r) {
 	G_percent(r, nrows, 2);
 	G_percent(r, nrows, 2);
 	for (c = 0; c < ncols; ++c) {
 	for (c = 0; c < ncols; ++c) {
-	    segment_get(streams, &streams_cell, r, c);
-	    segment_get(dirs, &dirs_cell, r, c);
+	    Segment_get(streams, &streams_cell, r, c);
+	    Segment_get(dirs, &dirs_cell, r, c);
 
 
 	    if (streams_cell) {
 	    if (streams_cell) {
 		trib_num = seg_number_of_tribs(r, c, streams, dirs);
 		trib_num = seg_number_of_tribs(r, c, streams, dirs);
@@ -269,12 +269,12 @@ int seg_stream_topology(SEGMENT *streams, SEGMENT *dirs,
 		if (NOT_IN_REGION(d))
 		if (NOT_IN_REGION(d))
 		    next_stream = -1;
 		    next_stream = -1;
 		else
 		else
-		    segment_get(streams, &next_streams_cell, NR(d), NC(d));
+		    Segment_get(streams, &next_streams_cell, NR(d), NC(d));
 
 
 		if (d < 1 || NOT_IN_REGION(d) || !next_streams_cell)
 		if (d < 1 || NOT_IN_REGION(d) || !next_streams_cell)
 		    next_stream = -1;
 		    next_stream = -1;
 		else
 		else
-		    segment_get(streams, &next_stream, NR(d), NC(d));
+		    Segment_get(streams, &next_stream, NR(d), NC(d));
 
 
 		cur_stream = streams_cell;
 		cur_stream = streams_cell;
 
 
@@ -313,9 +313,9 @@ int seg_stream_topology(SEGMENT *streams, SEGMENT *dirs,
 			j = DIAG(i);
 			j = DIAG(i);
 			next_r = NR(i);
 			next_r = NR(i);
 			next_c = NC(i);
 			next_c = NC(i);
-			segment_get(streams, &trib_stream_cell, next_r,
+			Segment_get(streams, &trib_stream_cell, next_r,
 				    next_c);
 				    next_c);
-			segment_get(dirs, &trib_dirs_cell, next_r, next_c);
+			Segment_get(dirs, &trib_dirs_cell, next_r, next_c);
 
 
 			if (trib_stream_cell && trib_dirs_cell == j)
 			if (trib_stream_cell && trib_dirs_cell == j)
 			    SA[cur_stream].trib[trib++] = trib_stream_cell;
 			    SA[cur_stream].trib[trib++] = trib_stream_cell;
@@ -354,7 +354,7 @@ int seg_stream_geometry(SEGMENT *streams, SEGMENT *dirs)
 	G_percent(s, init_num, 2);
 	G_percent(s, init_num, 2);
 	r = (int)init_cells[s] / ncols;
 	r = (int)init_cells[s] / ncols;
 	c = (int)init_cells[s] % ncols;
 	c = (int)init_cells[s] % ncols;
-	segment_get(streams, &cur_stream, r, c);
+	Segment_get(streams, &cur_stream, r, c);
 	cur_length = 0;
 	cur_length = 0;
 	done = 1;
 	done = 1;
 
 
@@ -367,14 +367,14 @@ int seg_stream_geometry(SEGMENT *streams, SEGMENT *dirs)
 	    cur_northing = window.north - (r + .5) * window.ns_res;
 	    cur_northing = window.north - (r + .5) * window.ns_res;
 	    cur_easting = window.west + (c + .5) * window.ew_res;
 	    cur_easting = window.west + (c + .5) * window.ew_res;
 
 
-	    segment_get(dirs, &dirs_cell, r, c);
+	    Segment_get(dirs, &dirs_cell, r, c);
 	    d = abs(dirs_cell);
 	    d = abs(dirs_cell);
 	    next_r = NR(d);
 	    next_r = NR(d);
 	    next_c = NC(d);
 	    next_c = NC(d);
 	    if (NOT_IN_REGION(d))
 	    if (NOT_IN_REGION(d))
 		Rast_set_c_null_value(&next_stream, 1);
 		Rast_set_c_null_value(&next_stream, 1);
 	    else
 	    else
-		segment_get(streams, &next_stream, next_r, next_c);
+		Segment_get(streams, &next_stream, next_r, next_c);
 
 
 	    if (d < 1 || NOT_IN_REGION(d) || !next_stream) {
 	    if (d < 1 || NOT_IN_REGION(d) || !next_stream) {
 		cur_length = (window.ns_res + window.ew_res) / 2;
 		cur_length = (window.ns_res + window.ew_res) / 2;

+ 4 - 4
raster/r.stream.order/stream_vector.c

@@ -128,10 +128,10 @@ int seg_create_vector(SEGMENT * streams, SEGMENT * dirs, char *out_vector,
 	Vect_reset_line(Segments);
 	Vect_reset_line(Segments);
 	Vect_append_point(Segments, easting, northing, 0);
 	Vect_append_point(Segments, easting, northing, 0);
 
 
-	segment_get(streams, &streams_cell, r, c);
+	Segment_get(streams, &streams_cell, r, c);
 	while (streams_cell == cur_stream) {
 	while (streams_cell == cur_stream) {
 
 
-	    segment_get(dirs, &dirs_cell, r, c);
+	    Segment_get(dirs, &dirs_cell, r, c);
 	    d = abs(dirs_cell);
 	    d = abs(dirs_cell);
 	    next_r = NR(d);
 	    next_r = NR(d);
 	    next_c = NC(d);
 	    next_c = NC(d);
@@ -143,7 +143,7 @@ int seg_create_vector(SEGMENT * streams, SEGMENT * dirs, char *out_vector,
 	    if (NOT_IN_REGION(d))
 	    if (NOT_IN_REGION(d))
 		Rast_set_c_null_value(&next_stream, 1);
 		Rast_set_c_null_value(&next_stream, 1);
 	    else
 	    else
-		segment_get(streams, &next_stream, next_r, next_c);
+		Segment_get(streams, &next_stream, next_r, next_c);
 
 
 	    if (d < 1 || NOT_IN_REGION(d) || !next_stream) {
 	    if (d < 1 || NOT_IN_REGION(d) || !next_stream) {
 		add_outlet = 1;
 		add_outlet = 1;
@@ -151,7 +151,7 @@ int seg_create_vector(SEGMENT * streams, SEGMENT * dirs, char *out_vector,
 	    }
 	    }
 	    r = next_r;
 	    r = next_r;
 	    c = next_c;
 	    c = next_c;
-	    segment_get(streams, &streams_cell, r, c);
+	    Segment_get(streams, &streams_cell, r, c);
 	}			/* end while */
 	}			/* end while */
 
 
 	Vect_cat_set(Cats, 1, cur_stream);
 	Vect_cat_set(Cats, 1, cur_stream);

+ 7 - 7
raster/r.stream.segment/io.c

@@ -301,7 +301,7 @@ int seg_create_map(SEG * seg, int srows, int scols, int number_of_segs,
     fd = creat(filename, 0666);
     fd = creat(filename, 0666);
 
 
     if (0 >
     if (0 >
-	segment_format(fd, seg->nrows, seg->ncols, srows, scols,
+	Segment_format(fd, seg->nrows, seg->ncols, srows, scols,
 		       seg->data_size)) {
 		       seg->data_size)) {
 	close(fd);
 	close(fd);
 	unlink(filename);
 	unlink(filename);
@@ -314,7 +314,7 @@ int seg_create_map(SEG * seg, int srows, int scols, int number_of_segs,
 	G_fatal_error(_("Unable to re-open file '%s'"), filename);
 	G_fatal_error(_("Unable to re-open file '%s'"), filename);
     }
     }
 
 
-    if (0 > (fd = segment_init(&(seg->seg), fd, number_of_segs))) {
+    if (0 > (fd = Segment_init(&(seg->seg), fd, number_of_segs))) {
 	unlink(filename);
 	unlink(filename);
 	G_fatal_error(_("Unable to init segment file or out of memory"));
 	G_fatal_error(_("Unable to init segment file or out of memory"));
     }
     }
@@ -437,7 +437,7 @@ int seg_read_map(SEG * seg, char *input_map_name, int check_res,
 		}
 		}
 	    }
 	    }
 
 
-	if (0 > segment_put_row(&(seg->seg), target_buffer, r)) {
+	if (0 > Segment_put_row(&(seg->seg), target_buffer, r)) {
 	    G_free(input_buffer);
 	    G_free(input_buffer);
 	    G_free(target_buffer);
 	    G_free(target_buffer);
 	    Rast_close(input_fd);
 	    Rast_close(input_fd);
@@ -466,7 +466,7 @@ int seg_reset_map(SEG * seg, int value)
 
 
     for (r = 0; r < seg->nrows; ++r)
     for (r = 0; r < seg->nrows; ++r)
 	for (c = 0; c < seg->ncols; ++c)
 	for (c = 0; c < seg->ncols; ++c)
-	    segment_put(&(seg->seg), &value, r, c);
+	    Segment_put(&(seg->seg), &value, r, c);
 
 
     return 0;
     return 0;
 }
 }
@@ -498,13 +498,13 @@ int seg_write_map(SEG * seg, char *output_map_name,
     G_message(_("Writing raster map <%s>..."), output_map_name);
     G_message(_("Writing raster map <%s>..."), output_map_name);
     output_fd = Rast_open_new(output_map_name, output_data_type);
     output_fd = Rast_open_new(output_map_name, output_data_type);
     output_buffer = Rast_allocate_buf(output_data_type);
     output_buffer = Rast_allocate_buf(output_data_type);
-    segment_flush(&(seg->seg));
+    Segment_flush(&(seg->seg));
 
 
     /* writing */
     /* writing */
     for (r = 0; r < seg->nrows; ++r) {
     for (r = 0; r < seg->nrows; ++r) {
 
 
 	G_percent(r, seg->nrows, 2);
 	G_percent(r, seg->nrows, 2);
-	if (0 > segment_get_row(&(seg->seg), output_buffer, r))
+	if (0 > Segment_get_row(&(seg->seg), output_buffer, r))
 	    G_warning(_("Unable to segment read row %d for raster map <%s>"),
 	    G_warning(_("Unable to segment read row %d for raster map <%s>"),
 		      r, output_map_name);
 		      r, output_map_name);
 
 
@@ -550,7 +550,7 @@ int seg_release_map(SEG * seg)
     /* 
     /* 
      * release segment close files, set pointers to null;
      * release segment close files, set pointers to null;
      */
      */
-    segment_release(&(seg->seg));
+    Segment_release(&(seg->seg));
     close(seg->fd);
     close(seg->fd);
     unlink(seg->filename);
     unlink(seg->filename);
 
 

+ 22 - 22
raster/r.stream.segment/stream_topology.c

@@ -65,7 +65,7 @@ int seg_trib_nums(int r, int c, SEGMENT *streams, SEGMENT *dirs)
     int next_r, next_c;
     int next_r, next_c;
     int streams_cell, streams_next_cell, dirs_next_cell;
     int streams_cell, streams_next_cell, dirs_next_cell;
 
 
-    segment_get(streams, &streams_cell, r, c);
+    Segment_get(streams, &streams_cell, r, c);
     for (i = 1; i < 9; ++i) {
     for (i = 1; i < 9; ++i) {
 	if (NOT_IN_REGION(i))
 	if (NOT_IN_REGION(i))
 	    continue;
 	    continue;
@@ -74,8 +74,8 @@ int seg_trib_nums(int r, int c, SEGMENT *streams, SEGMENT *dirs)
 	next_r = NR(i);
 	next_r = NR(i);
 	next_c = NC(i);
 	next_c = NC(i);
 
 
-	segment_get(streams, &streams_next_cell, next_r, next_c);
-	segment_get(dirs, &dirs_next_cell, next_r, next_c);
+	Segment_get(streams, &streams_next_cell, next_r, next_c);
+	Segment_get(dirs, &dirs_next_cell, next_r, next_c);
 
 
 	if (streams_next_cell > 0 && dirs_next_cell == j)
 	if (streams_next_cell > 0 && dirs_next_cell == j)
 	    trib_num++;
 	    trib_num++;
@@ -90,8 +90,8 @@ int seg_trib_nums(int r, int c, SEGMENT *streams, SEGMENT *dirs)
 	    next_r = NR(i);
 	    next_r = NR(i);
 	    next_c = NC(i);
 	    next_c = NC(i);
 
 
-	    segment_get(streams, &streams_next_cell, next_r, next_c);
-	    segment_get(dirs, &dirs_next_cell, next_r, next_c);
+	    Segment_get(streams, &streams_next_cell, next_r, next_c);
+	    Segment_get(dirs, &dirs_next_cell, next_r, next_c);
 
 
 	    if (streams_next_cell == streams_cell && dirs_next_cell == j)
 	    if (streams_next_cell == streams_cell && dirs_next_cell == j)
 		trib_num--;
 		trib_num--;
@@ -137,7 +137,7 @@ int seg_number_of_streams(SEGMENT *streams, SEGMENT *dirs, int *ordered)
 
 
     for (r = 0; r < nrows; ++r)
     for (r = 0; r < nrows; ++r)
 	for (c = 0; c < ncols; ++c) {
 	for (c = 0; c < ncols; ++c) {
-	    segment_get(streams, &streams_cell, r, c);
+	    Segment_get(streams, &streams_cell, r, c);
 	    if (streams_cell > 0)
 	    if (streams_cell > 0)
 		if (seg_trib_nums(r, c, streams, dirs) != 1) {
 		if (seg_trib_nums(r, c, streams, dirs) != 1) {
 		    stream_num++;
 		    stream_num++;
@@ -286,7 +286,7 @@ int seg_build_streamlines(SEGMENT *streams, SEGMENT *dirs,
     /* finding inits */
     /* finding inits */
     for (r = 0; r < nrows; ++r)
     for (r = 0; r < nrows; ++r)
 	for (c = 0; c < ncols; ++c) {
 	for (c = 0; c < ncols; ++c) {
-	    segment_get(streams, &streams_cell, r, c);
+	    Segment_get(streams, &streams_cell, r, c);
 
 
 	    if (streams_cell)
 	    if (streams_cell)
 		if (seg_trib_nums(r, c, streams, dirs) != 1) {	/* adding inits */
 		if (seg_trib_nums(r, c, streams, dirs) != 1) {	/* adding inits */
@@ -304,20 +304,20 @@ int seg_build_streamlines(SEGMENT *streams, SEGMENT *dirs,
 
 
 	r = (int)SA[i].init / ncols;
 	r = (int)SA[i].init / ncols;
 	c = (int)SA[i].init % ncols;
 	c = (int)SA[i].init % ncols;
-	segment_get(streams, &streams_cell, r, c);
+	Segment_get(streams, &streams_cell, r, c);
 	SA[i].order = streams_cell;
 	SA[i].order = streams_cell;
 	SA[i].number_of_cells = 0;
 	SA[i].number_of_cells = 0;
 
 
 	do {
 	do {
 	    SA[i].number_of_cells++;
 	    SA[i].number_of_cells++;
-	    segment_get(dirs, &dirs_cell, r, c);
+	    Segment_get(dirs, &dirs_cell, r, c);
 
 
 	    d = abs(dirs_cell);
 	    d = abs(dirs_cell);
 	    if (NOT_IN_REGION(d) || d == 0)
 	    if (NOT_IN_REGION(d) || d == 0)
 		break;
 		break;
 	    r = NR(d);
 	    r = NR(d);
 	    c = NC(d);
 	    c = NC(d);
-	    segment_get(streams, &streams_cell, r, c);
+	    Segment_get(streams, &streams_cell, r, c);
 	} while (streams_cell == SA[i].order);
 	} while (streams_cell == SA[i].order);
 
 
 	SA[i].number_of_cells += 2;	/* add two extra points for point before init and after outlet */
 	SA[i].number_of_cells += 2;	/* add two extra points for point before init and after outlet */
@@ -341,10 +341,10 @@ int seg_build_streamlines(SEGMENT *streams, SEGMENT *dirs,
 	/* add one point contributing to init to calculate parameters */
 	/* add one point contributing to init to calculate parameters */
 	/* what to do if there is no contributing points? */
 	/* what to do if there is no contributing points? */
 
 
-	segment_get(dirs, &dirs_cell, r, c);
-	segment_get(dirs, &dirs_prev_cell, prev_r, prev_c);
-	segment_get(elevation, &elevation_prev_cell, prev_r, prev_c);
-	segment_get(elevation, &elevation_cell, r, c);
+	Segment_get(dirs, &dirs_cell, r, c);
+	Segment_get(dirs, &dirs_prev_cell, prev_r, prev_c);
+	Segment_get(elevation, &elevation_prev_cell, prev_r, prev_c);
+	Segment_get(elevation, &elevation_cell, r, c);
 
 
 	SA[i].points[0] = (contrib_cell == 0) ? -1 : INDEX(prev_r, prev_c);
 	SA[i].points[0] = (contrib_cell == 0) ? -1 : INDEX(prev_r, prev_c);
 	SA[i].elevation[0] = (contrib_cell == 0) ? -99999 :
 	SA[i].elevation[0] = (contrib_cell == 0) ? -99999 :
@@ -360,7 +360,7 @@ int seg_build_streamlines(SEGMENT *streams, SEGMENT *dirs,
 
 
 	cell_num = 2;
 	cell_num = 2;
 	do {
 	do {
-	    segment_get(dirs, &dirs_cell, r, c);
+	    Segment_get(dirs, &dirs_cell, r, c);
 	    d = abs(dirs_cell);
 	    d = abs(dirs_cell);
 
 
 	    if (NOT_IN_REGION(d) || d == 0) {
 	    if (NOT_IN_REGION(d) || d == 0) {
@@ -375,16 +375,16 @@ int seg_build_streamlines(SEGMENT *streams, SEGMENT *dirs,
 	    }
 	    }
 	    r = NR(d);
 	    r = NR(d);
 	    c = NC(d);
 	    c = NC(d);
-	    segment_get(dirs, &dirs_cell, r, c);
+	    Segment_get(dirs, &dirs_cell, r, c);
 	    SA[i].last_cell_dir = dirs_cell;
 	    SA[i].last_cell_dir = dirs_cell;
 	    SA[i].points[cell_num] = INDEX(r, c);
 	    SA[i].points[cell_num] = INDEX(r, c);
-	    segment_get(elevation, &SA[i].elevation[cell_num], r, c);
+	    Segment_get(elevation, &SA[i].elevation[cell_num], r, c);
 	    next_d = (abs(dirs_cell) == 0) ? d : abs(dirs_cell);
 	    next_d = (abs(dirs_cell) == 0) ? d : abs(dirs_cell);
 	    SA[i].distance[cell_num] = get_distance(r, c, next_d);
 	    SA[i].distance[cell_num] = get_distance(r, c, next_d);
 	    cell_num++;
 	    cell_num++;
 	    if (cell_num > SA[i].number_of_cells)
 	    if (cell_num > SA[i].number_of_cells)
 		G_fatal_error(_("To much points in stream line"));
 		G_fatal_error(_("To much points in stream line"));
-	    segment_get(streams, &streams_cell, r, c);
+	    Segment_get(streams, &streams_cell, r, c);
 	} while (streams_cell == SA[i].order);
 	} while (streams_cell == SA[i].order);
 
 
 	if (SA[i].elevation[0] == -99999)
 	if (SA[i].elevation[0] == -99999)
@@ -429,8 +429,8 @@ int seg_find_contributing_cell(int r, int c, SEGMENT *dirs,
 	    continue;
 	    continue;
 	next_r = NR(i);
 	next_r = NR(i);
 	next_c = NC(i);
 	next_c = NC(i);
-	segment_get(elevation, &elevation_next_cell, next_r, next_c);
-	segment_get(dirs, &dirs_next_cell, next_r, next_c);
+	Segment_get(elevation, &elevation_next_cell, next_r, next_c);
+	Segment_get(dirs, &dirs_next_cell, next_r, next_c);
 
 
 	if (dirs_next_cell == DIAG(i) && elevation_next_cell < elev_min) {
 	if (dirs_next_cell == DIAG(i) && elevation_next_cell < elev_min) {
 	    elev_min = elevation_next_cell;
 	    elev_min = elevation_next_cell;
@@ -470,7 +470,7 @@ int seg_fill_streams(SEGMENT *unique_streams, int number_of_streams)
 	for (j = 1; j < SA[i].number_of_cells - 1; ++j) {
 	for (j = 1; j < SA[i].number_of_cells - 1; ++j) {
 	    r = (int)SA[i].points[j] / ncols;
 	    r = (int)SA[i].points[j] / ncols;
 	    c = (int)SA[i].points[j] % ncols;
 	    c = (int)SA[i].points[j] % ncols;
-	    segment_put(unique_streams, &SA[i].stream, r, c);
+	    Segment_put(unique_streams, &SA[i].stream, r, c);
 	}
 	}
     }
     }
     return 0;
     return 0;
@@ -515,7 +515,7 @@ int seg_identify_next_stream(SEGMENT *streams, int number_of_streams)
 	else {
 	else {
 	    r = (int)SA[i].points[SA[i].number_of_cells - 1] / ncols;
 	    r = (int)SA[i].points[SA[i].number_of_cells - 1] / ncols;
 	    c = (int)SA[i].points[SA[i].number_of_cells - 1] % ncols;
 	    c = (int)SA[i].points[SA[i].number_of_cells - 1] % ncols;
-	    segment_get(streams, &SA[i].next_stream, r, c);
+	    Segment_get(streams, &SA[i].next_stream, r, c);
 	    SA[i].outlet = SA[i].points[SA[i].number_of_cells - 1];
 	    SA[i].outlet = SA[i].points[SA[i].number_of_cells - 1];
 	}
 	}
     }
     }

+ 7 - 7
raster/r.stream.snap/io.c

@@ -301,7 +301,7 @@ int seg_create_map(SEG * seg, int srows, int scols, int number_of_segs,
     fd = creat(filename, 0666);
     fd = creat(filename, 0666);
 
 
     if (0 >
     if (0 >
-	segment_format(fd, seg->nrows, seg->ncols, srows, scols,
+	Segment_format(fd, seg->nrows, seg->ncols, srows, scols,
 		       seg->data_size)) {
 		       seg->data_size)) {
 	close(fd);
 	close(fd);
 	unlink(filename);
 	unlink(filename);
@@ -314,7 +314,7 @@ int seg_create_map(SEG * seg, int srows, int scols, int number_of_segs,
 	G_fatal_error(_("Unable to re-open file '%s'"), filename);
 	G_fatal_error(_("Unable to re-open file '%s'"), filename);
     }
     }
 
 
-    if (0 > (fd = segment_init(&(seg->seg), fd, number_of_segs))) {
+    if (0 > (fd = Segment_init(&(seg->seg), fd, number_of_segs))) {
 	unlink(filename);
 	unlink(filename);
 	G_fatal_error(_("Unable to init segment file or out of memory"));
 	G_fatal_error(_("Unable to init segment file or out of memory"));
     }
     }
@@ -437,7 +437,7 @@ int seg_read_map(SEG * seg, char *input_map_name, int check_res,
 		}
 		}
 	    }
 	    }
 
 
-	if (0 > segment_put_row(&(seg->seg), target_buffer, r)) {
+	if (0 > Segment_put_row(&(seg->seg), target_buffer, r)) {
 	    G_free(input_buffer);
 	    G_free(input_buffer);
 	    G_free(target_buffer);
 	    G_free(target_buffer);
 	    Rast_close(input_fd);
 	    Rast_close(input_fd);
@@ -466,7 +466,7 @@ int seg_reset_map(SEG * seg, int value)
 
 
     for (r = 0; r < seg->nrows; ++r)
     for (r = 0; r < seg->nrows; ++r)
 	for (c = 0; c < seg->ncols; ++c)
 	for (c = 0; c < seg->ncols; ++c)
-	    segment_put(&(seg->seg), &value, r, c);
+	    Segment_put(&(seg->seg), &value, r, c);
 
 
     return 0;
     return 0;
 }
 }
@@ -498,13 +498,13 @@ int seg_write_map(SEG * seg, char *output_map_name,
     G_message(_("Writing raster map <%s>..."), output_map_name);
     G_message(_("Writing raster map <%s>..."), output_map_name);
     output_fd = Rast_open_new(output_map_name, output_data_type);
     output_fd = Rast_open_new(output_map_name, output_data_type);
     output_buffer = Rast_allocate_buf(output_data_type);
     output_buffer = Rast_allocate_buf(output_data_type);
-    segment_flush(&(seg->seg));
+    Segment_flush(&(seg->seg));
 
 
     /* writing */
     /* writing */
     for (r = 0; r < seg->nrows; ++r) {
     for (r = 0; r < seg->nrows; ++r) {
 
 
 	G_percent(r, seg->nrows, 2);
 	G_percent(r, seg->nrows, 2);
-	if (0 > segment_get_row(&(seg->seg), output_buffer, r))
+	if (0 > Segment_get_row(&(seg->seg), output_buffer, r))
 	    G_warning(_("Unable to segment read row %d for raster map <%s>"),
 	    G_warning(_("Unable to segment read row %d for raster map <%s>"),
 		      r, output_map_name);
 		      r, output_map_name);
 
 
@@ -550,7 +550,7 @@ int seg_release_map(SEG * seg)
     /* 
     /* 
      * release segment close files, set pointers to null;
      * release segment close files, set pointers to null;
      */
      */
-    segment_release(&(seg->seg));
+    Segment_release(&(seg->seg));
     close(seg->fd);
     close(seg->fd);
     unlink(seg->filename);
     unlink(seg->filename);
 
 

+ 2 - 2
raster/r.stream.snap/points_io.c

@@ -50,11 +50,11 @@ int read_points(char *in_point, SEGMENT * streams, SEGMENT * accum)
 	points[i].dj = 0;
 	points[i].dj = 0;
 	points[i].cat = cat;
 	points[i].cat = cat;
 	if (streams)
 	if (streams)
-	    segment_get(streams, &points[i].stream, points[i].r, points[i].c);
+	    Segment_get(streams, &points[i].stream, points[i].r, points[i].c);
 	else
 	else
 	    points[i].stream = 0;
 	    points[i].stream = 0;
 	if (accum) {
 	if (accum) {
-	    segment_get(accum, &absaccum, points[i].r, points[i].c);
+	    Segment_get(accum, &absaccum, points[i].r, points[i].c);
 	    points[i].accum = fabs(absaccum);
 	    points[i].accum = fabs(absaccum);
 	}
 	}
 	else {
 	else {

+ 4 - 4
raster/r.stream.snap/snap.c

@@ -54,13 +54,13 @@ int snap_point(OUTLET *point, int radius, SEGMENT *streams, SEGMENT *accum,
 		if (!distance_mask[i + radius][j + radius])
 		if (!distance_mask[i + radius][j + radius])
 		    continue;
 		    continue;
 
 
-		segment_get(streams, &teststream, point->r + i, point->c + j);
+		Segment_get(streams, &teststream, point->r + i, point->c + j);
 		distance = distance_mask[i + radius][j + radius];
 		distance = distance_mask[i + radius][j + radius];
 
 
 		if (teststream) {	/* is stream line */
 		if (teststream) {	/* is stream line */
 
 
 		    if (accum) {
 		    if (accum) {
-			segment_get(accum, &absaccum, point->r + i,
+			Segment_get(accum, &absaccum, point->r + i,
 				    point->c + j);
 				    point->c + j);
 			absaccum = fabs(absaccum);
 			absaccum = fabs(absaccum);
 		    }
 		    }
@@ -91,7 +91,7 @@ int snap_point(OUTLET *point, int radius, SEGMENT *streams, SEGMENT *accum,
 		if (!distance_mask[i + radius][j + radius])
 		if (!distance_mask[i + radius][j + radius])
 		    continue;
 		    continue;
 
 
-		segment_get(accum, &absaccum, point->r + i, point->c + j);
+		Segment_get(accum, &absaccum, point->r + i, point->c + j);
 		absaccum = fabs(absaccum);
 		absaccum = fabs(absaccum);
 
 
 		if (absaccum > maxaccum)
 		if (absaccum > maxaccum)
@@ -118,7 +118,7 @@ int snap_point(OUTLET *point, int radius, SEGMENT *streams, SEGMENT *accum,
 		if (!distance_mask[i + radius][j + radius])
 		if (!distance_mask[i + radius][j + radius])
 		    continue;
 		    continue;
 
 
-		segment_get(accum, &absaccum, point->r + i, point->c + j);
+		Segment_get(accum, &absaccum, point->r + i, point->c + j);
 		absaccum = fabs(absaccum);
 		absaccum = fabs(absaccum);
 
 
 		if (accum_treshold > 0 && absaccum > accum_treshold)
 		if (accum_treshold > 0 && absaccum > accum_treshold)

+ 7 - 7
raster/r.stream.stats/io.c

@@ -301,7 +301,7 @@ int seg_create_map(SEG * seg, int srows, int scols, int number_of_segs,
     fd = creat(filename, 0666);
     fd = creat(filename, 0666);
 
 
     if (0 >
     if (0 >
-	segment_format(fd, seg->nrows, seg->ncols, srows, scols,
+	Segment_format(fd, seg->nrows, seg->ncols, srows, scols,
 		       seg->data_size)) {
 		       seg->data_size)) {
 	close(fd);
 	close(fd);
 	unlink(filename);
 	unlink(filename);
@@ -314,7 +314,7 @@ int seg_create_map(SEG * seg, int srows, int scols, int number_of_segs,
 	G_fatal_error(_("Unable to re-open file '%s'"), filename);
 	G_fatal_error(_("Unable to re-open file '%s'"), filename);
     }
     }
 
 
-    if (0 > (fd = segment_init(&(seg->seg), fd, number_of_segs))) {
+    if (0 > (fd = Segment_init(&(seg->seg), fd, number_of_segs))) {
 	unlink(filename);
 	unlink(filename);
 	G_fatal_error(_("Unable to init segment file or out of memory"));
 	G_fatal_error(_("Unable to init segment file or out of memory"));
     }
     }
@@ -437,7 +437,7 @@ int seg_read_map(SEG * seg, char *input_map_name, int check_res,
 		}
 		}
 	    }
 	    }
 
 
-	if (0 > segment_put_row(&(seg->seg), target_buffer, r)) {
+	if (0 > Segment_put_row(&(seg->seg), target_buffer, r)) {
 	    G_free(input_buffer);
 	    G_free(input_buffer);
 	    G_free(target_buffer);
 	    G_free(target_buffer);
 	    Rast_close(input_fd);
 	    Rast_close(input_fd);
@@ -466,7 +466,7 @@ int seg_reset_map(SEG * seg, int value)
 
 
     for (r = 0; r < seg->nrows; ++r)
     for (r = 0; r < seg->nrows; ++r)
 	for (c = 0; c < seg->ncols; ++c)
 	for (c = 0; c < seg->ncols; ++c)
-	    segment_put(&(seg->seg), &value, r, c);
+	    Segment_put(&(seg->seg), &value, r, c);
 
 
     return 0;
     return 0;
 }
 }
@@ -498,13 +498,13 @@ int seg_write_map(SEG * seg, char *output_map_name,
     G_message(_("Writing raster map <%s>..."), output_map_name);
     G_message(_("Writing raster map <%s>..."), output_map_name);
     output_fd = Rast_open_new(output_map_name, output_data_type);
     output_fd = Rast_open_new(output_map_name, output_data_type);
     output_buffer = Rast_allocate_buf(output_data_type);
     output_buffer = Rast_allocate_buf(output_data_type);
-    segment_flush(&(seg->seg));
+    Segment_flush(&(seg->seg));
 
 
     /* writing */
     /* writing */
     for (r = 0; r < seg->nrows; ++r) {
     for (r = 0; r < seg->nrows; ++r) {
 
 
 	G_percent(r, seg->nrows, 2);
 	G_percent(r, seg->nrows, 2);
-	if (0 > segment_get_row(&(seg->seg), output_buffer, r))
+	if (0 > Segment_get_row(&(seg->seg), output_buffer, r))
 	    G_warning(_("Unable to segment read row %d for raster map <%s>"),
 	    G_warning(_("Unable to segment read row %d for raster map <%s>"),
 		      r, output_map_name);
 		      r, output_map_name);
 
 
@@ -550,7 +550,7 @@ int seg_release_map(SEG * seg)
     /* 
     /* 
      * release segment close files, set pointers to null;
      * release segment close files, set pointers to null;
      */
      */
-    segment_release(&(seg->seg));
+    Segment_release(&(seg->seg));
     close(seg->fd);
     close(seg->fd);
     unlink(seg->filename);
     unlink(seg->filename);
 
 

+ 12 - 12
raster/r.stream.stats/stats_prepare.c

@@ -110,7 +110,7 @@ int seg_init_streams(SEGMENT *streams, SEGMENT *dirs, SEGMENT *elevation)
 
 
     for (r = 0; r < nrows; ++r)
     for (r = 0; r < nrows; ++r)
 	for (c = 0; c < ncols; ++c) {
 	for (c = 0; c < ncols; ++c) {
-	    segment_get(streams, &streams_cell, r, c);
+	    Segment_get(streams, &streams_cell, r, c);
 	    if (streams_cell > 0) {
 	    if (streams_cell > 0) {
 		if (outlets_num > (out_max - 1)) {
 		if (outlets_num > (out_max - 1)) {
 		    out_max *= 2;
 		    out_max *= 2;
@@ -118,12 +118,12 @@ int seg_init_streams(SEGMENT *streams, SEGMENT *dirs, SEGMENT *elevation)
 			(POINT *) G_realloc(outlets, out_max * sizeof(POINT));
 			(POINT *) G_realloc(outlets, out_max * sizeof(POINT));
 		}
 		}
 
 
-		segment_get(dirs, &dirs_cell, r, c);
+		Segment_get(dirs, &dirs_cell, r, c);
 		d = abs(dirs_cell);
 		d = abs(dirs_cell);
 		if (NOT_IN_REGION(d))
 		if (NOT_IN_REGION(d))
 		    next_stream = -1;	/* border */
 		    next_stream = -1;	/* border */
 		else {
 		else {
-		    segment_get(streams, &next_stream, NR(d), NC(d));
+		    Segment_get(streams, &next_stream, NR(d), NC(d));
 		    if (next_stream < 1)
 		    if (next_stream < 1)
 			next_stream = -1;
 			next_stream = -1;
 		}
 		}
@@ -160,9 +160,9 @@ int seg_init_streams(SEGMENT *streams, SEGMENT *dirs, SEGMENT *elevation)
 	stat_streams[i].length = 0.;
 	stat_streams[i].length = 0.;
 	stat_streams[i].elev_diff = 0.;
 	stat_streams[i].elev_diff = 0.;
 	stat_streams[i].elev_spring = 0.;
 	stat_streams[i].elev_spring = 0.;
-	segment_get(elevation, &(stat_streams[i].elev_outlet), outlets[i].r,
+	Segment_get(elevation, &(stat_streams[i].elev_outlet), outlets[i].r,
 		    outlets[i].c);
 		    outlets[i].c);
-	segment_get(streams, &(stat_streams[i].order), outlets[i].r,
+	Segment_get(streams, &(stat_streams[i].order), outlets[i].r,
 		    outlets[i].c);
 		    outlets[i].c);
 	stat_streams[i].basin_area = 0.;
 	stat_streams[i].basin_area = 0.;
 	stat_streams[i].cell_num = 0;
 	stat_streams[i].cell_num = 0;
@@ -279,7 +279,7 @@ int seg_calculate_streams(SEGMENT *streams, SEGMENT *dirs,
 	cur_northing = window.north - (r + .5) * window.ns_res;
 	cur_northing = window.north - (r + .5) * window.ns_res;
 	cur_easting = window.west + (c + .5) * window.ew_res;
 	cur_easting = window.west + (c + .5) * window.ew_res;
 
 
-	segment_get(dirs, &dirs_cell, r, c);
+	Segment_get(dirs, &dirs_cell, r, c);
 	d = (dirs_cell == 0) ? 2 : abs(dirs_cell);
 	d = (dirs_cell == 0) ? 2 : abs(dirs_cell);
 
 
 	next_northing = window.north - (NR(d) + .5) * window.ns_res;
 	next_northing = window.north - (NR(d) + .5) * window.ns_res;
@@ -297,7 +297,7 @@ int seg_calculate_streams(SEGMENT *streams, SEGMENT *dirs,
 	    cur_easting = window.west + (c + .5) * window.ew_res;
 	    cur_easting = window.west + (c + .5) * window.ew_res;
 
 
 	    stat_streams[s].cell_num++;
 	    stat_streams[s].cell_num++;
-	    segment_get(elevation, &(stat_streams[s].elev_spring), r, c);
+	    Segment_get(elevation, &(stat_streams[s].elev_spring), r, c);
 
 
 	    for (i = 1; i < 9; ++i) {
 	    for (i = 1; i < 9; ++i) {
 		if (NOT_IN_REGION(i))
 		if (NOT_IN_REGION(i))
@@ -307,8 +307,8 @@ int seg_calculate_streams(SEGMENT *streams, SEGMENT *dirs,
 		next_r = NR(i);
 		next_r = NR(i);
 		next_c = NC(i);
 		next_c = NC(i);
 
 
-		segment_get(streams, &streams_cell, next_r, next_c);
-		segment_get(dirs, &dirs_cell, next_r, next_c);
+		Segment_get(streams, &streams_cell, next_r, next_c);
+		Segment_get(dirs, &dirs_cell, next_r, next_c);
 
 
 		if (streams_cell == stat_streams[s].order && dirs_cell == j) {
 		if (streams_cell == stat_streams[s].order && dirs_cell == j) {
 
 
@@ -320,9 +320,9 @@ int seg_calculate_streams(SEGMENT *streams, SEGMENT *dirs,
 			G_distance(next_easting, next_northing, cur_easting,
 			G_distance(next_easting, next_northing, cur_easting,
 				   cur_northing);
 				   cur_northing);
 
 
-		    segment_get(elevation, &elevation_next_cell, next_r,
+		    Segment_get(elevation, &elevation_next_cell, next_r,
 				next_c);
 				next_c);
-		    segment_get(elevation, &elevation_cell, r, c);
+		    Segment_get(elevation, &elevation_cell, r, c);
 		    diff_elev = elevation_next_cell - elevation_cell;
 		    diff_elev = elevation_next_cell - elevation_cell;
 		    diff_elev = (diff_elev < 0) ? 0. : diff_elev;	/* water cannot flow up */
 		    diff_elev = (diff_elev < 0) ? 0. : diff_elev;	/* water cannot flow up */
 
 
@@ -424,7 +424,7 @@ double seg_calculate_basins_area(SEGMENT *dirs, int r, int c)
 	    next_r = NR(i);
 	    next_r = NR(i);
 	    next_c = NC(i);
 	    next_c = NC(i);
 
 
-	    segment_get(dirs, &dirs_cell, next_r, next_c);
+	    Segment_get(dirs, &dirs_cell, next_r, next_c);
 
 
 	    if (dirs_cell == j) {	/* countributing cell */
 	    if (dirs_cell == j) {	/* countributing cell */
 		area += G_area_of_cell_at_row(r);
 		area += G_area_of_cell_at_row(r);

+ 20 - 20
raster/r.walk/main.c

@@ -539,12 +539,12 @@ int main(int argc, char *argv[])
     /* Create segmented format files for cost layer and output layer */
     /* Create segmented format files for cost layer and output layer */
     G_verbose_message(_("Creating some temporary files..."));
     G_verbose_message(_("Creating some temporary files..."));
 
 
-    if (segment_open(&cost_seg, G_tempfile(), nrows, ncols, srows, scols,
+    if (Segment_open(&cost_seg, G_tempfile(), nrows, ncols, srows, scols,
 		     sizeof(struct cc), segments_in_memory) != 1)
 		     sizeof(struct cc), segments_in_memory) != 1)
 	G_fatal_error(_("Can not create temporary file"));
 	G_fatal_error(_("Can not create temporary file"));
 
 
     if (dir == 1) {
     if (dir == 1) {
-	if (segment_open(&dir_seg, G_tempfile(), nrows, ncols, srows, scols,
+	if (Segment_open(&dir_seg, G_tempfile(), nrows, ncols, srows, scols,
 		         sizeof(FCELL), segments_in_memory) != 1)
 		         sizeof(FCELL), segments_in_memory) != 1)
 	    G_fatal_error(_("Can not create temporary file"));
 	    G_fatal_error(_("Can not create temporary file"));
     }
     }
@@ -624,7 +624,7 @@ int main(int argc, char *argv[])
 		}
 		}
 
 
 		costs.dtm = p_dtm;
 		costs.dtm = p_dtm;
-		segment_put(&cost_seg, &costs, row, col);
+		Segment_put(&cost_seg, &costs, row, col);
 		ptr1 = G_incr_void_ptr(ptr1, cost_dsize);
 		ptr1 = G_incr_void_ptr(ptr1, cost_dsize);
 		ptr2 = G_incr_void_ptr(ptr2, dtm_dsize);
 		ptr2 = G_incr_void_ptr(ptr2, dtm_dsize);
 	    }
 	    }
@@ -639,7 +639,7 @@ int main(int argc, char *argv[])
 	for (row = 0; row < nrows; row++) {
 	for (row = 0; row < nrows; row++) {
 	    G_percent(row, nrows, 2);
 	    G_percent(row, nrows, 2);
 	    for (col = 0; col < ncols; col++) {
 	    for (col = 0; col < ncols; col++) {
-		segment_put(&dir_seg, &dnullval, row, col);
+		Segment_put(&dir_seg, &dnullval, row, col);
 	    }
 	    }
 	}
 	}
 	G_percent(1, 1, 1);
 	G_percent(1, 1, 1);
@@ -812,19 +812,19 @@ int main(int argc, char *argv[])
 		if (!Rast_is_null_value(ptr2, data_type2)) {
 		if (!Rast_is_null_value(ptr2, data_type2)) {
 		    double cellval;
 		    double cellval;
 
 
-		    segment_get(&cost_seg, &costs, row, col);
+		    Segment_get(&cost_seg, &costs, row, col);
 
 
 		    if (start_with_raster_vals == 1) {
 		    if (start_with_raster_vals == 1) {
 			cellval = Rast_get_d_value(ptr2, data_type2);
 			cellval = Rast_get_d_value(ptr2, data_type2);
 			insert(cellval, row, col);
 			insert(cellval, row, col);
 			costs.cost_out = cellval;
 			costs.cost_out = cellval;
-			segment_put(&cost_seg, &costs, row, col);
+			Segment_put(&cost_seg, &costs, row, col);
 		    }
 		    }
 		    else {
 		    else {
 			value = &zero;
 			value = &zero;
 			insert(zero, row, col);
 			insert(zero, row, col);
 			costs.cost_out = *value;
 			costs.cost_out = *value;
-			segment_put(&cost_seg, &costs, row, col);
+			Segment_put(&cost_seg, &costs, row, col);
 		    }
 		    }
 		    got_one = 1;
 		    got_one = 1;
 		}
 		}
@@ -853,10 +853,10 @@ int main(int argc, char *argv[])
 		|| top_start_pt->col < 0 || top_start_pt->col >= ncols)
 		|| top_start_pt->col < 0 || top_start_pt->col >= ncols)
 		G_fatal_error(_("Specified starting location outside database window"));
 		G_fatal_error(_("Specified starting location outside database window"));
 	    insert(zero, top_start_pt->row, top_start_pt->col);
 	    insert(zero, top_start_pt->row, top_start_pt->col);
-	    segment_get(&cost_seg, &costs, top_start_pt->row,
+	    Segment_get(&cost_seg, &costs, top_start_pt->row,
 			top_start_pt->col);
 			top_start_pt->col);
 	    costs.cost_out = *value;
 	    costs.cost_out = *value;
-	    segment_put(&cost_seg, &costs, top_start_pt->row,
+	    Segment_put(&cost_seg, &costs, top_start_pt->row,
 			top_start_pt->col);
 			top_start_pt->col);
 	    top_start_pt = top_start_pt->next;
 	    top_start_pt = top_start_pt->next;
 	}
 	}
@@ -896,7 +896,7 @@ int main(int argc, char *argv[])
 	    break;
 	    break;
 
 
 	/* If I've already been updated, delete me */
 	/* If I've already been updated, delete me */
-	segment_get(&cost_seg, &costs, pres_cell->row, pres_cell->col);
+	Segment_get(&cost_seg, &costs, pres_cell->row, pres_cell->col);
 	old_min_cost = costs.cost_out;
 	old_min_cost = costs.cost_out;
 	if (!Rast_is_d_null_value(&old_min_cost)) {
 	if (!Rast_is_d_null_value(&old_min_cost)) {
 	    if (pres_cell->min_cost > old_min_cost) {
 	    if (pres_cell->min_cost > old_min_cost) {
@@ -1030,7 +1030,7 @@ int main(int argc, char *argv[])
 		continue;
 		continue;
 
 
 	    min_cost = dnullval;
 	    min_cost = dnullval;
-	    segment_get(&cost_seg, &costs, row, col);
+	    Segment_get(&cost_seg, &costs, row, col);
 
 
 	    switch (neighbor) {
 	    switch (neighbor) {
 	    case 1:
 	    case 1:
@@ -1318,25 +1318,25 @@ int main(int argc, char *argv[])
 	    if (Rast_is_d_null_value(&min_cost))
 	    if (Rast_is_d_null_value(&min_cost))
 		continue;
 		continue;
 
 
-	    segment_get(&cost_seg, &costs, row, col);
+	    Segment_get(&cost_seg, &costs, row, col);
 	    old_min_cost = costs.cost_out;
 	    old_min_cost = costs.cost_out;
 
 
 	    /* add to list */
 	    /* add to list */
 	    if (Rast_is_d_null_value(&old_min_cost)) {
 	    if (Rast_is_d_null_value(&old_min_cost)) {
 		costs.cost_out = min_cost;
 		costs.cost_out = min_cost;
-		segment_put(&cost_seg, &costs, row, col);
+		Segment_put(&cost_seg, &costs, row, col);
 		insert(min_cost, row, col);
 		insert(min_cost, row, col);
 		if (dir == 1) {
 		if (dir == 1) {
-		    segment_put(&dir_seg, &cur_dir, row, col);
+		    Segment_put(&dir_seg, &cur_dir, row, col);
 		}
 		}
 	    }
 	    }
 	    /* update with lower costs */
 	    /* update with lower costs */
 	    else if (old_min_cost > min_cost) {
 	    else if (old_min_cost > min_cost) {
 		costs.cost_out = min_cost;
 		costs.cost_out = min_cost;
-		segment_put(&cost_seg, &costs, row, col);
+		Segment_put(&cost_seg, &costs, row, col);
 		insert(min_cost, row, col);
 		insert(min_cost, row, col);
 		if (dir == 1) {
 		if (dir == 1) {
-		    segment_put(&dir_seg, &cur_dir, row, col);
+		    Segment_put(&dir_seg, &cur_dir, row, col);
 		}
 		}
 	    }
 	    }
 	}
 	}
@@ -1386,7 +1386,7 @@ int main(int argc, char *argv[])
 			continue;
 			continue;
 		    }
 		    }
 		}
 		}
-		segment_get(&cost_seg, &costs, row, col);
+		Segment_get(&cost_seg, &costs, row, col);
 		min_cost = costs.cost_out;
 		min_cost = costs.cost_out;
 		if (Rast_is_d_null_value(&min_cost)) {
 		if (Rast_is_d_null_value(&min_cost)) {
 		    Rast_set_null_value((p), 1, cum_data_type);
 		    Rast_set_null_value((p), 1, cum_data_type);
@@ -1428,7 +1428,7 @@ int main(int argc, char *argv[])
 	for (row = 0; row < nrows; row++) {
 	for (row = 0; row < nrows; row++) {
 	    p = dir_cell;
 	    p = dir_cell;
 	    for (col = 0; col < ncols; col++) {
 	    for (col = 0; col < ncols; col++) {
-		segment_get(&dir_seg, &cur_dir, row, col);
+		Segment_get(&dir_seg, &cur_dir, row, col);
 		*((FCELL *) p) = cur_dir;
 		*((FCELL *) p) = cur_dir;
 		p = G_incr_void_ptr(p, dir_size);
 		p = G_incr_void_ptr(p, dir_size);
 	    }
 	    }
@@ -1439,9 +1439,9 @@ int main(int argc, char *argv[])
 	G_free(dir_cell);
 	G_free(dir_cell);
     }
     }
 
 
-    segment_close(&cost_seg);	/* release memory  */
+    Segment_close(&cost_seg);	/* release memory  */
     if (dir == 1)
     if (dir == 1)
-	segment_close(&dir_seg);
+	Segment_close(&dir_seg);
 
 
     Rast_close(dtm_fd);
     Rast_close(dtm_fd);
     Rast_close(cost_fd);
     Rast_close(cost_fd);

+ 1 - 1
raster/r.watershed/seg/bseg_close.c

@@ -4,7 +4,7 @@
 
 
 int bseg_close(BSEG * bseg)
 int bseg_close(BSEG * bseg)
 {
 {
-    segment_release(&(bseg->seg));
+    Segment_release(&(bseg->seg));
     close(bseg->fd);
     close(bseg->fd);
     unlink(bseg->filename);
     unlink(bseg->filename);
     if (bseg->name) {
     if (bseg->name) {

+ 2 - 2
raster/r.watershed/seg/bseg_get.c

@@ -4,7 +4,7 @@
 
 
 int bseg_get(BSEG * bseg, char *value, GW_LARGE_INT row, GW_LARGE_INT col)
 int bseg_get(BSEG * bseg, char *value, GW_LARGE_INT row, GW_LARGE_INT col)
 {
 {
-    if (segment_get(&(bseg->seg), value, row, col) < 0) {
+    if (Segment_get(&(bseg->seg), value, row, col) < 0) {
 	G_warning("cseg_get(): could not read segment file");
 	G_warning("cseg_get(): could not read segment file");
 	return -1;
 	return -1;
     }
     }
@@ -15,7 +15,7 @@ int bseg_get_old(BSEG * bseg, CELL *value, int row, int col)
 {
 {
     CELL x;
     CELL x;
 
 
-    if (segment_get(&(bseg->seg), &x, row, col >> 3) < 0) {
+    if (Segment_get(&(bseg->seg), &x, row, col >> 3) < 0) {
 	G_warning("bseg_get(): could not read segment file");
 	G_warning("bseg_get(): could not read segment file");
 	return -1;
 	return -1;
     }
     }

+ 2 - 2
raster/r.watershed/seg/bseg_open.c

@@ -21,7 +21,7 @@ int bseg_open(BSEG * bseg, int srows, int scols, int nsegs_in_memory)
 	G_warning("bseg_open(): unable to create segment file");
 	G_warning("bseg_open(): unable to create segment file");
 	return -2;
 	return -2;
     }
     }
-    if (0 > (errflag = segment_format(fd, Rast_window_rows(),
+    if (0 > (errflag = Segment_format(fd, Rast_window_rows(),
 				      Rast_window_cols(), srows, scols,
 				      Rast_window_cols(), srows, scols,
 				      sizeof(char)))) {
 				      sizeof(char)))) {
 	close(fd);
 	close(fd);
@@ -41,7 +41,7 @@ int bseg_open(BSEG * bseg, int srows, int scols, int nsegs_in_memory)
 	G_warning("bseg_open(): unable to re-open segment file");
 	G_warning("bseg_open(): unable to re-open segment file");
 	return -4;
 	return -4;
     }
     }
-    if (0 > (errflag = segment_init(&(bseg->seg), fd, nsegs_in_memory))) {
+    if (0 > (errflag = Segment_init(&(bseg->seg), fd, nsegs_in_memory))) {
 	close(fd);
 	close(fd);
 	unlink(filename);
 	unlink(filename);
 	if (errflag == -1) {
 	if (errflag == -1) {

+ 4 - 4
raster/r.watershed/seg/bseg_put.c

@@ -4,7 +4,7 @@
 
 
 int bseg_put(BSEG * bseg, char *value, GW_LARGE_INT row, GW_LARGE_INT col)
 int bseg_put(BSEG * bseg, char *value, GW_LARGE_INT row, GW_LARGE_INT col)
 {
 {
-    if (segment_put(&(bseg->seg), value, row, col) < 0) {
+    if (Segment_put(&(bseg->seg), value, row, col) < 0) {
 	G_warning("cseg_put(): could not write segment file");
 	G_warning("cseg_put(): could not write segment file");
 	return -1;
 	return -1;
     }
     }
@@ -13,7 +13,7 @@ int bseg_put(BSEG * bseg, char *value, GW_LARGE_INT row, GW_LARGE_INT col)
 
 
 int bseg_put_row(BSEG * bseg, char *value, GW_LARGE_INT row)
 int bseg_put_row(BSEG * bseg, char *value, GW_LARGE_INT row)
 {
 {
-    if (segment_put_row(&(bseg->seg), value, row) < 0) {
+    if (Segment_put_row(&(bseg->seg), value, row) < 0) {
 	G_warning("cseg_put(): could not write segment file");
 	G_warning("cseg_put(): could not write segment file");
 	return -1;
 	return -1;
     }
     }
@@ -24,7 +24,7 @@ int bseg_put_old(BSEG * bseg, CELL * value, int row, int col)
 {
 {
     CELL old_value;
     CELL old_value;
 
 
-    if (segment_get(&(bseg->seg), &old_value, row, col >> 3) < 0) {
+    if (Segment_get(&(bseg->seg), &old_value, row, col >> 3) < 0) {
 	G_warning("bseg_put(): could not read segment file");
 	G_warning("bseg_put(): could not read segment file");
 	return -1;
 	return -1;
     }
     }
@@ -32,7 +32,7 @@ int bseg_put_old(BSEG * bseg, CELL * value, int row, int col)
 	old_value |= (1 << (col & 7));
 	old_value |= (1 << (col & 7));
     else
     else
 	old_value &= ~(1 << (col & 7));
 	old_value &= ~(1 << (col & 7));
-    if (segment_put(&(bseg->seg), &old_value, row, col >> 3) < 0) {
+    if (Segment_put(&(bseg->seg), &old_value, row, col >> 3) < 0) {
 	G_warning("bseg_put(): could not write segment file");
 	G_warning("bseg_put(): could not write segment file");
 	return -2;
 	return -2;
     }
     }

+ 1 - 1
raster/r.watershed/seg/cseg_close.c

@@ -5,7 +5,7 @@
 
 
 int cseg_close(CSEG * cseg)
 int cseg_close(CSEG * cseg)
 {
 {
-    segment_release(&(cseg->seg));
+    Segment_release(&(cseg->seg));
     close(cseg->fd);
     close(cseg->fd);
     unlink(cseg->filename);
     unlink(cseg->filename);
     if (cseg->name) {
     if (cseg->name) {

+ 1 - 1
raster/r.watershed/seg/cseg_get.c

@@ -4,7 +4,7 @@
 
 
 int cseg_get(CSEG * cseg, CELL * value, GW_LARGE_INT row, GW_LARGE_INT col)
 int cseg_get(CSEG * cseg, CELL * value, GW_LARGE_INT row, GW_LARGE_INT col)
 {
 {
-    if (segment_get(&(cseg->seg), value, row, col) < 0) {
+    if (Segment_get(&(cseg->seg), value, row, col) < 0) {
 	G_warning("cseg_get(): could not read segment file");
 	G_warning("cseg_get(): could not read segment file");
 	return -1;
 	return -1;
     }
     }

+ 2 - 2
raster/r.watershed/seg/cseg_open.c

@@ -22,7 +22,7 @@ int cseg_open(CSEG * cseg, int srows, int scols, int nsegs_in_memory)
     }
     }
     if (0 >
     if (0 >
 	(errflag =
 	(errflag =
-	 segment_format(fd, Rast_window_rows(), Rast_window_cols(), srows, scols,
+	 Segment_format(fd, Rast_window_rows(), Rast_window_cols(), srows, scols,
 			sizeof(CELL)))) {
 			sizeof(CELL)))) {
 	close(fd);
 	close(fd);
 	unlink(filename);
 	unlink(filename);
@@ -41,7 +41,7 @@ int cseg_open(CSEG * cseg, int srows, int scols, int nsegs_in_memory)
 	G_warning("cseg_open(): unable to re-open segment file");
 	G_warning("cseg_open(): unable to re-open segment file");
 	return -4;
 	return -4;
     }
     }
-    if (0 > (errflag = segment_init(&(cseg->seg), fd, nsegs_in_memory))) {
+    if (0 > (errflag = Segment_init(&(cseg->seg), fd, nsegs_in_memory))) {
 	close(fd);
 	close(fd);
 	unlink(filename);
 	unlink(filename);
 	if (errflag == -1) {
 	if (errflag == -1) {

+ 2 - 2
raster/r.watershed/seg/cseg_put.c

@@ -4,7 +4,7 @@
 
 
 int cseg_put(CSEG * cseg, CELL * value, GW_LARGE_INT row, GW_LARGE_INT col)
 int cseg_put(CSEG * cseg, CELL * value, GW_LARGE_INT row, GW_LARGE_INT col)
 {
 {
-    if (segment_put(&(cseg->seg), value, row, col) < 0) {
+    if (Segment_put(&(cseg->seg), value, row, col) < 0) {
 	G_warning("cseg_put(): could not write segment file");
 	G_warning("cseg_put(): could not write segment file");
 	return -1;
 	return -1;
     }
     }
@@ -13,7 +13,7 @@ int cseg_put(CSEG * cseg, CELL * value, GW_LARGE_INT row, GW_LARGE_INT col)
 
 
 int cseg_put_row(CSEG * cseg, CELL * value, GW_LARGE_INT row)
 int cseg_put_row(CSEG * cseg, CELL * value, GW_LARGE_INT row)
 {
 {
-    if (segment_put_row(&(cseg->seg), value, row) < 0) {
+    if (Segment_put_row(&(cseg->seg), value, row) < 0) {
 	G_warning("cseg_put(): could not write segment file");
 	G_warning("cseg_put(): could not write segment file");
 	return -1;
 	return -1;
     }
     }

+ 1 - 1
raster/r.watershed/seg/cseg_read.c

@@ -19,7 +19,7 @@ int cseg_read_cell(CSEG * cseg, char *map_name, char *mapset)
     buffer = Rast_allocate_c_buf();
     buffer = Rast_allocate_c_buf();
     for (row = 0; row < nrows; row++) {
     for (row = 0; row < nrows; row++) {
 	Rast_get_c_row(map_fd, buffer, row);
 	Rast_get_c_row(map_fd, buffer, row);
-	if (segment_put_row(&(cseg->seg), buffer, row) < 0) {
+	if (Segment_put_row(&(cseg->seg), buffer, row) < 0) {
 	    G_free(buffer);
 	    G_free(buffer);
 	    Rast_close(map_fd);
 	    Rast_close(map_fd);
 	    G_warning("%s(): unable to segment put row for [%s] in [%s]",
 	    G_warning("%s(): unable to segment put row for [%s] in [%s]",

+ 2 - 2
raster/r.watershed/seg/cseg_write.c

@@ -12,10 +12,10 @@ int cseg_write_cellfile(CSEG * cseg, char *map_name)
     map_fd = Rast_open_c_new(map_name);
     map_fd = Rast_open_c_new(map_name);
     nrows = Rast_window_rows();
     nrows = Rast_window_rows();
     buffer = Rast_allocate_c_buf();
     buffer = Rast_allocate_c_buf();
-    segment_flush(&(cseg->seg));
+    Segment_flush(&(cseg->seg));
     for (row = 0; row < nrows; row++) {
     for (row = 0; row < nrows; row++) {
 	G_percent(row, nrows, 1);
 	G_percent(row, nrows, 1);
-	segment_get_row(&(cseg->seg), buffer, row);
+	Segment_get_row(&(cseg->seg), buffer, row);
 	Rast_put_row(map_fd, buffer, CELL_TYPE);
 	Rast_put_row(map_fd, buffer, CELL_TYPE);
     }
     }
     G_percent(row, nrows, 1);    /* finish it */
     G_percent(row, nrows, 1);    /* finish it */

+ 1 - 1
raster/r.watershed/seg/dseg_close.c

@@ -4,7 +4,7 @@
 
 
 int dseg_close(DSEG * dseg)
 int dseg_close(DSEG * dseg)
 {
 {
-    segment_release(&(dseg->seg));
+    Segment_release(&(dseg->seg));
     close(dseg->fd);
     close(dseg->fd);
     unlink(dseg->filename);
     unlink(dseg->filename);
     if (dseg->name) {
     if (dseg->name) {

+ 2 - 2
raster/r.watershed/seg/dseg_get.c

@@ -4,7 +4,7 @@
 
 
 int dseg_get(DSEG * dseg, double *value, GW_LARGE_INT row, GW_LARGE_INT col)
 int dseg_get(DSEG * dseg, double *value, GW_LARGE_INT row, GW_LARGE_INT col)
 {
 {
-    if (segment_get(&(dseg->seg), (DCELL *) value, row, col) < 0) {
+    if (Segment_get(&(dseg->seg), (DCELL *) value, row, col) < 0) {
 	G_warning("dseg_get(): could not read segment file");
 	G_warning("dseg_get(): could not read segment file");
 	return -1;
 	return -1;
     }
     }
@@ -13,6 +13,6 @@ int dseg_get(DSEG * dseg, double *value, GW_LARGE_INT row, GW_LARGE_INT col)
 
 
 int dseg_flush(DSEG * dseg)
 int dseg_flush(DSEG * dseg)
 {
 {
-    segment_flush(&(dseg->seg));
+    Segment_flush(&(dseg->seg));
     return 0;
     return 0;
 }
 }

+ 2 - 2
raster/r.watershed/seg/dseg_open.c

@@ -23,7 +23,7 @@ int dseg_open(DSEG * dseg, int srows, int scols, int nsegs_in_memory)
     }
     }
     if (0 >
     if (0 >
 	(errflag =
 	(errflag =
-	 segment_format(fd, Rast_window_rows(), Rast_window_cols(), srows, scols,
+	 Segment_format(fd, Rast_window_rows(), Rast_window_cols(), srows, scols,
 			sizeof(double)))) {
 			sizeof(double)))) {
 	close(fd);
 	close(fd);
 	unlink(filename);
 	unlink(filename);
@@ -42,7 +42,7 @@ int dseg_open(DSEG * dseg, int srows, int scols, int nsegs_in_memory)
 	G_warning("dseg_open(): unable to re-open segment file");
 	G_warning("dseg_open(): unable to re-open segment file");
 	return -4;
 	return -4;
     }
     }
-    if (0 > (errflag = segment_init(&(dseg->seg), fd, nsegs_in_memory))) {
+    if (0 > (errflag = Segment_init(&(dseg->seg), fd, nsegs_in_memory))) {
 	close(fd);
 	close(fd);
 	unlink(filename);
 	unlink(filename);
 	if (errflag == -1) {
 	if (errflag == -1) {

+ 2 - 2
raster/r.watershed/seg/dseg_put.c

@@ -4,7 +4,7 @@
 
 
 int dseg_put(DSEG * dseg, double *value, GW_LARGE_INT row, GW_LARGE_INT col)
 int dseg_put(DSEG * dseg, double *value, GW_LARGE_INT row, GW_LARGE_INT col)
 {
 {
-    if (segment_put(&(dseg->seg), (DCELL *) value, row, col) < 0) {
+    if (Segment_put(&(dseg->seg), (DCELL *) value, row, col) < 0) {
 	G_warning("dseg_put(): could not write segment file");
 	G_warning("dseg_put(): could not write segment file");
 	return -1;
 	return -1;
     }
     }
@@ -13,7 +13,7 @@ int dseg_put(DSEG * dseg, double *value, GW_LARGE_INT row, GW_LARGE_INT col)
 
 
 int dseg_put_row(DSEG * dseg, double *value, GW_LARGE_INT row)
 int dseg_put_row(DSEG * dseg, double *value, GW_LARGE_INT row)
 {
 {
-    if (segment_put_row(&(dseg->seg), (DCELL *) value, row) < 0) {
+    if (Segment_put_row(&(dseg->seg), (DCELL *) value, row) < 0) {
 	G_warning("dseg_put(): could not write segment file");
 	G_warning("dseg_put(): could not write segment file");
 	return -1;
 	return -1;
     }
     }

+ 1 - 1
raster/r.watershed/seg/dseg_read.c

@@ -20,7 +20,7 @@ int dseg_read_cell(DSEG * dseg, char *map_name, char *mapset)
     dbuffer = Rast_allocate_d_buf();
     dbuffer = Rast_allocate_d_buf();
     for (row = 0; row < nrows; row++) {
     for (row = 0; row < nrows; row++) {
 	Rast_get_d_row(map_fd, dbuffer, row);
 	Rast_get_d_row(map_fd, dbuffer, row);
-	if (segment_put_row(&(dseg->seg), (DCELL *) dbuffer, row) < 0) {
+	if (Segment_put_row(&(dseg->seg), (DCELL *) dbuffer, row) < 0) {
 	    G_free(dbuffer);
 	    G_free(dbuffer);
 	    Rast_close(map_fd);
 	    Rast_close(map_fd);
 	    G_warning("%s(): unable to segment put row for [%s] in [%s]",
 	    G_warning("%s(): unable to segment put row for [%s] in [%s]",

+ 2 - 2
raster/r.watershed/seg/dseg_write.c

@@ -13,10 +13,10 @@ int dseg_write_cellfile(DSEG * dseg, char *map_name)
     nrows = Rast_window_rows();
     nrows = Rast_window_rows();
     ncols = Rast_window_cols();
     ncols = Rast_window_cols();
     dbuffer = Rast_allocate_d_buf();
     dbuffer = Rast_allocate_d_buf();
-    segment_flush(&(dseg->seg));
+    Segment_flush(&(dseg->seg));
     for (row = 0; row < nrows; row++) {
     for (row = 0; row < nrows; row++) {
 	G_percent(row, nrows, 1);
 	G_percent(row, nrows, 1);
-	segment_get_row(&(dseg->seg), (DCELL *) dbuffer, row);
+	Segment_get_row(&(dseg->seg), (DCELL *) dbuffer, row);
 	Rast_put_row(map_fd, dbuffer, DCELL_TYPE);
 	Rast_put_row(map_fd, dbuffer, DCELL_TYPE);
     }
     }
     G_percent(row, nrows, 1);    /* finish it */
     G_percent(row, nrows, 1);    /* finish it */

+ 1 - 1
raster/r.watershed/seg/sseg_close.c

@@ -5,7 +5,7 @@
 
 
 int seg_close(SSEG * sseg)
 int seg_close(SSEG * sseg)
 {
 {
-    segment_release(&(sseg->seg));
+    Segment_release(&(sseg->seg));
     close(sseg->fd);
     close(sseg->fd);
     unlink(sseg->filename);
     unlink(sseg->filename);
     return 0;
     return 0;

+ 3 - 3
raster/r.watershed/seg/sseg_get.c

@@ -4,7 +4,7 @@
 
 
 int seg_get(SSEG * sseg, char *value, GW_LARGE_INT row, GW_LARGE_INT col)
 int seg_get(SSEG * sseg, char *value, GW_LARGE_INT row, GW_LARGE_INT col)
 {
 {
-    if (segment_get(&(sseg->seg), value, row, col) < 0) {
+    if (Segment_get(&(sseg->seg), value, row, col) < 0) {
 	G_warning("seg_get(): could not read segment file");
 	G_warning("seg_get(): could not read segment file");
 	return -1;
 	return -1;
     }
     }
@@ -13,7 +13,7 @@ int seg_get(SSEG * sseg, char *value, GW_LARGE_INT row, GW_LARGE_INT col)
 
 
 int seg_get_row(SSEG * sseg, char *value, GW_LARGE_INT row)
 int seg_get_row(SSEG * sseg, char *value, GW_LARGE_INT row)
 {
 {
-    if (segment_get_row(&(sseg->seg), value, row) < 0) {
+    if (Segment_get_row(&(sseg->seg), value, row) < 0) {
 	G_warning("seg_get(): could not read segment file");
 	G_warning("seg_get(): could not read segment file");
 	return -1;
 	return -1;
     }
     }
@@ -22,6 +22,6 @@ int seg_get_row(SSEG * sseg, char *value, GW_LARGE_INT row)
 
 
 int seg_flush(SSEG * sseg)
 int seg_flush(SSEG * sseg)
 {
 {
-    segment_flush(&(sseg->seg));
+    Segment_flush(&(sseg->seg));
     return 0;
     return 0;
 }
 }

+ 2 - 2
raster/r.watershed/seg/sseg_open.c

@@ -20,7 +20,7 @@ seg_open(SSEG * sseg, GW_LARGE_INT nrows, GW_LARGE_INT ncols, int row_in_seg, in
 	G_warning("seg_open(): unable to create segment file");
 	G_warning("seg_open(): unable to create segment file");
 	return -2;
 	return -2;
     }
     }
-    if (0 > (errflag = segment_format(fd, nrows, ncols,
+    if (0 > (errflag = Segment_format(fd, nrows, ncols,
 				      row_in_seg, col_in_seg, size_struct))) {
 				      row_in_seg, col_in_seg, size_struct))) {
 	close(fd);
 	close(fd);
 	unlink(filename);
 	unlink(filename);
@@ -39,7 +39,7 @@ seg_open(SSEG * sseg, GW_LARGE_INT nrows, GW_LARGE_INT ncols, int row_in_seg, in
 	G_warning("seg_open(): unable to re-open segment file");
 	G_warning("seg_open(): unable to re-open segment file");
 	return -4;
 	return -4;
     }
     }
-    if (0 > (errflag = segment_init(&(sseg->seg), fd, nsegs_in_memory))) {
+    if (0 > (errflag = Segment_init(&(sseg->seg), fd, nsegs_in_memory))) {
 	close(fd);
 	close(fd);
 	unlink(filename);
 	unlink(filename);
 	if (errflag == -1) {
 	if (errflag == -1) {

+ 2 - 2
raster/r.watershed/seg/sseg_put.c

@@ -4,7 +4,7 @@
 
 
 int seg_put(SSEG * sseg, char *value, GW_LARGE_INT row, GW_LARGE_INT col)
 int seg_put(SSEG * sseg, char *value, GW_LARGE_INT row, GW_LARGE_INT col)
 {
 {
-    if (segment_put(&(sseg->seg), value, row, col) < 0) {
+    if (Segment_put(&(sseg->seg), value, row, col) < 0) {
 	G_warning("seg_put(): could not write segment file");
 	G_warning("seg_put(): could not write segment file");
 	return -1;
 	return -1;
     }
     }
@@ -13,7 +13,7 @@ int seg_put(SSEG * sseg, char *value, GW_LARGE_INT row, GW_LARGE_INT col)
 
 
 int seg_put_row(SSEG * sseg, char *value, GW_LARGE_INT row)
 int seg_put_row(SSEG * sseg, char *value, GW_LARGE_INT row)
 {
 {
-    if (segment_put_row(&(sseg->seg), value, row) < 0) {
+    if (Segment_put_row(&(sseg->seg), value, row) < 0) {
 	G_warning("seg_put(): could not write segment file");
 	G_warning("seg_put(): could not write segment file");
 	return -1;
 	return -1;
     }
     }

+ 9 - 9
vector/v.surf.bspline/main.c

@@ -459,12 +459,12 @@ int main(int argc, char *argv[])
 
 
 	out_file = G_tempfile();
 	out_file = G_tempfile();
 	out_fd = creat(out_file, 0666);
 	out_fd = creat(out_file, 0666);
-	if (segment_format(out_fd, nrows, ncols, SEGSIZE, SEGSIZE, sizeof(double)) != 1)
+	if (Segment_format(out_fd, nrows, ncols, SEGSIZE, SEGSIZE, sizeof(double)) != 1)
 	    G_fatal_error(_("Can not create temporary file"));
 	    G_fatal_error(_("Can not create temporary file"));
 	close(out_fd);
 	close(out_fd);
 
 
 	out_fd = open(out_file, 2);
 	out_fd = open(out_file, 2);
-	if (segment_init(&out_seg, out_fd, segments_in_memory) != 1)
+	if (Segment_init(&out_seg, out_fd, segments_in_memory) != 1)
 	    G_fatal_error(_("Can not initialize temporary file"));
 	    G_fatal_error(_("Can not initialize temporary file"));
 
 
 	/* initialize output */
 	/* initialize output */
@@ -474,7 +474,7 @@ int main(int argc, char *argv[])
 	Rast_set_d_null_value(drastbuf, ncols);
 	Rast_set_d_null_value(drastbuf, ncols);
 	for (row = 0; row < nrows; row++) {
 	for (row = 0; row < nrows; row++) {
 	    G_percent(row, nrows, 2);
 	    G_percent(row, nrows, 2);
-	    segment_put_row(&out_seg, drastbuf, row);
+	    Segment_put_row(&out_seg, drastbuf, row);
 	}
 	}
 	G_percent(row, nrows, 2);
 	G_percent(row, nrows, 2);
 
 
@@ -487,12 +487,12 @@ int main(int argc, char *argv[])
 
 
 	    mask_file = G_tempfile();
 	    mask_file = G_tempfile();
 	    mask_fd = creat(mask_file, 0666);
 	    mask_fd = creat(mask_file, 0666);
-	    if (segment_format(mask_fd, nrows, ncols, SEGSIZE, SEGSIZE, sizeof(char)) != 1)
+	    if (Segment_format(mask_fd, nrows, ncols, SEGSIZE, SEGSIZE, sizeof(char)) != 1)
 		G_fatal_error(_("Can not create temporary file"));
 		G_fatal_error(_("Can not create temporary file"));
 	    close(mask_fd);
 	    close(mask_fd);
 
 
 	    mask_fd = open(mask_file, 2);
 	    mask_fd = open(mask_file, 2);
-	    if (segment_init(&mask_seg, mask_fd, segments_in_memory) != 1)
+	    if (Segment_init(&mask_seg, mask_fd, segments_in_memory) != 1)
 		G_fatal_error(_("Can not initialize temporary file"));
 		G_fatal_error(_("Can not initialize temporary file"));
 
 
 	    maskfd = Rast_open_old(mask_opt->answer, "");
 	    maskfd = Rast_open_old(mask_opt->answer, "");
@@ -508,7 +508,7 @@ int main(int argc, char *argv[])
 		    else
 		    else
 			mask_val = 1;
 			mask_val = 1;
 			
 			
-		    segment_put(&mask_seg, &mask_val, row, col);
+		    Segment_put(&mask_seg, &mask_val, row, col);
 		}
 		}
 	    }
 	    }
 
 
@@ -893,7 +893,7 @@ int main(int argc, char *argv[])
 
 
 
 
 	if (have_mask) {
 	if (have_mask) {
-	    segment_release(&mask_seg);	/* release memory  */
+	    Segment_release(&mask_seg);	/* release memory  */
 	    close(mask_fd);
 	    close(mask_fd);
 	    unlink(mask_file);
 	    unlink(mask_file);
 	}
 	}
@@ -902,7 +902,7 @@ int main(int argc, char *argv[])
 	for (row = 0; row < nrows; row++) {
 	for (row = 0; row < nrows; row++) {
 	    G_percent(row, nrows, 2);
 	    G_percent(row, nrows, 2);
 	    for (col = 0; col < ncols; col++) {
 	    for (col = 0; col < ncols; col++) {
-		segment_get(&out_seg, &dval, row, col);
+		Segment_get(&out_seg, &dval, row, col);
 		drastbuf[col] = dval;
 		drastbuf[col] = dval;
 	    }
 	    }
 	    Rast_put_d_row(raster, drastbuf);
 	    Rast_put_d_row(raster, drastbuf);
@@ -910,7 +910,7 @@ int main(int argc, char *argv[])
 
 
 	Rast_close(raster);
 	Rast_close(raster);
 
 
-	segment_release(&out_seg);	/* release memory  */
+	Segment_release(&out_seg);	/* release memory  */
 	close(out_fd);
 	close(out_fd);
 	unlink(out_file);
 	unlink(out_file);
 	/* set map title */
 	/* set map title */

+ 3 - 3
vector/v.surf.bspline/resamp.c

@@ -80,7 +80,7 @@ struct Point *P_Read_Raster_Region_masked(SEGMENT *mask_seg,
     for (row = startrow; row < endrow; row++) {
     for (row = startrow; row < endrow; row++) {
 	for (col = startcol; col < endcol; col++) {
 	for (col = startcol; col < endcol; col++) {
 
 
-	    segment_get(mask_seg, &mask_val, row, col);
+	    Segment_get(mask_seg, &mask_val, row, col);
 	    if (!mask_val)
 	    if (!mask_val)
 		continue;
 		continue;
 
 
@@ -162,7 +162,7 @@ int P_Sparse_Raster_Points(SEGMENT *out_seg, struct Cell_head *Elaboration,
 	    dval = interpolation;
 	    dval = interpolation;
 	}
 	}
 	else {
 	else {
-	    segment_get(out_seg, &dval, row, col);
+	    Segment_get(out_seg, &dval, row, col);
 	    if ((X > Overlap.E) && (X < General.E)) {
 	    if ((X > Overlap.E) && (X < General.E)) {
 		if ((Y > Overlap.N) && (Y < General.N)) {	/* (3) */
 		if ((Y > Overlap.N) && (Y < General.N)) {	/* (3) */
 		    csi = (General.E - X) / overlap;
 		    csi = (General.E - X) / overlap;
@@ -218,7 +218,7 @@ int P_Sparse_Raster_Points(SEGMENT *out_seg, struct Cell_head *Elaboration,
 		}
 		}
 	    }
 	    }
 	} /* end not in overlap */
 	} /* end not in overlap */
-	segment_put(out_seg, &dval, row, col);
+	Segment_put(out_seg, &dval, row, col);
     }  /* for num_points */
     }  /* for num_points */
 
 
     return 1;
     return 1;