Browse Source

rasterlib: raster-related fns moved from gislib to rasterlib (step 1)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@38003 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 16 years ago
parent
commit
2f7a38363b
100 changed files with 650 additions and 559 deletions
  1. 7 7
      display/d.colors/curses.c
  2. 2 2
      display/d.colors/get_info.c
  3. 18 18
      display/d.colors/interact.c
  4. 1 1
      display/d.colors/main.c
  5. 8 8
      display/d.colors/tbl_toggle.c
  6. 8 7
      display/d.colortable/main.c
  7. 2 2
      display/d.extract/main.c
  8. 4 3
      display/d.graph/do_graph.c
  9. 1 0
      display/d.graph/graphics.c
  10. 2 1
      display/d.graph/main.c
  11. 2 1
      display/d.grid/fiducial.c
  12. 1 0
      display/d.grid/main.c
  13. 1 0
      display/d.grid/plot.c
  14. 1 0
      display/d.grid/plotborder.c
  15. 3 2
      display/d.his/his.c
  16. 19 18
      display/d.his/main.c
  17. 13 10
      display/d.histogram/bar.c
  18. 1 0
      display/d.histogram/draw_slice.c
  19. 5 4
      display/d.histogram/get_stats.c
  20. 4 3
      display/d.histogram/main.c
  21. 12 9
      display/d.histogram/pie.c
  22. 2 1
      display/d.labels/color.c
  23. 1 0
      display/d.labels/do_labels.c
  24. 1 0
      display/d.labels/main.c
  25. 19 18
      display/d.legend/main.c
  26. 13 12
      display/d.nviz/main.c
  27. 4 3
      display/d.path/main.c
  28. 1 0
      display/d.path/select.c
  29. 20 19
      display/d.profile/main.c
  30. 24 23
      display/d.rast.arrow/main.c
  31. 11 10
      display/d.rast.num/main.c
  32. 13 9
      display/d.rast/display.c
  33. 2 1
      display/d.rast/main.c
  34. 3 2
      display/d.rast/mask.c
  35. 7 6
      display/d.rgb/main.c
  36. 1 0
      display/d.thematic.area/area.c
  37. 3 2
      display/d.thematic.area/main.c
  38. 2 1
      display/d.thematic.area/plot1.c
  39. 1 0
      display/d.title/fancy.c
  40. 3 2
      display/d.title/main.c
  41. 1 0
      display/d.title/normal.c
  42. 1 0
      display/d.vect.chart/bar.c
  43. 3 2
      display/d.vect.chart/main.c
  44. 1 0
      display/d.vect.chart/pie.c
  45. 1 0
      display/d.vect.chart/plot.c
  46. 4 3
      display/d.vect/area.c
  47. 1 0
      display/d.vect/attr.c
  48. 1 0
      display/d.vect/dir.c
  49. 1 0
      display/d.vect/label.c
  50. 6 5
      display/d.vect/main.c
  51. 4 3
      display/d.vect/plot1.c
  52. 1 0
      display/d.vect/topo.c
  53. 1 0
      display/d.vect/utils.c
  54. 1 0
      display/d.vect/zcoor.c
  55. 1 1
      display/d.what.rast/main.c
  56. 1 1
      display/d.what.rast/opencell.c
  57. 5 5
      display/d.what.rast/show.c
  58. 9 9
      display/d.what.rast/what.c
  59. 1 1
      display/d.zoom/main.c
  60. 1 1
      display/d.zoom/set.c
  61. 14 14
      doc/raster/r.example/main.c
  62. 6 3
      general/g.mremove/check_reclass.c
  63. 1 0
      general/g.mremove/wc2regex.c
  64. 2 1
      general/g.region/adjust.c
  65. 4 3
      general/g.region/main.c
  66. 1 0
      general/g.region/printwindow.c
  67. 10 9
      general/g.region/zoom.c
  68. 5 3
      general/g.remove/main.c
  69. 2 1
      general/g.rename/main.c
  70. 2 1
      general/manage/lister/cell.c
  71. 1 0
      general/manage/lister/vector.c
  72. 19 18
      imagery/i.albedo/main.c
  73. 30 29
      imagery/i.atcorr/main.cpp
  74. 8 7
      imagery/i.cca/main.c
  75. 1 0
      imagery/i.cca/matrix.c
  76. 1 0
      imagery/i.cca/stats.c
  77. 4 3
      imagery/i.cca/transform.c
  78. 3 3
      imagery/i.class/band_files.c
  79. 8 8
      imagery/i.class/draw_cell.c
  80. 3 3
      imagery/i.class/main.c
  81. 1 1
      imagery/i.class/readbands.c
  82. 8 8
      imagery/i.class/signature.c
  83. 1 0
      imagery/i.cluster/checkpt.c
  84. 4 3
      imagery/i.cluster/main.c
  85. 3 2
      imagery/i.cluster/open_files.c
  86. 1 0
      imagery/i.cluster/print1.c
  87. 1 0
      imagery/i.cluster/print2.c
  88. 1 0
      imagery/i.cluster/print3.c
  89. 1 0
      imagery/i.cluster/print4.c
  90. 1 0
      imagery/i.cluster/print5.c
  91. 1 0
      imagery/i.cluster/print6.c
  92. 1 0
      imagery/i.cluster/timer.c
  93. 24 23
      imagery/i.eb.eta/main.c
  94. 32 31
      imagery/i.eb.evapfr/main.c
  95. 46 45
      imagery/i.eb.h_SEBAL01/main.c
  96. 36 35
      imagery/i.eb.soilheatflux/main.c
  97. 14 13
      imagery/i.emissivity/main.c
  98. 39 38
      imagery/i.evapo.time_integration/main.c
  99. 19 18
      imagery/i.fft/main.c
  100. 0 0
      imagery/i.gensig/alloc.c

+ 7 - 7
display/d.colors/curses.c

@@ -63,11 +63,11 @@ int Write_cats(struct Categories *pcats, int current_cat)
     CELL tmp = current_cat;
     int start_cat, end_cat, at_cat, at_line;
 
-    if (G_is_c_null_value(&tmp))
+    if (Rast_is_c_null_value(&tmp))
 	current_cat = 0;
     else
 	current_cat++;
-    G_set_c_null_value(&tmp, 1);
+    Rast_set_c_null_value(&tmp, 1);
     start_cat = current_cat - 2;
     start_cat = start_cat > 0 ? start_cat : 0;
     end_cat = start_cat + 4;
@@ -85,18 +85,18 @@ int Write_cats(struct Categories *pcats, int current_cat)
 	if (at_cat == current_cat) {
 	    if (!at_cat)
 		sprintf(buffer, "-> %3s %s", "N",
-			G_get_c_raster_cat(&tmp, pcats));
+			Rast_get_c_raster_cat(&tmp, pcats));
 	    else
 		sprintf(buffer, "-> %3d %s", at_cat - 1,
-			G_get_cat(at_cat - 1, pcats));
+			Rast_get_cat(at_cat - 1, pcats));
 	}
 	else {
 	    if (!at_cat)
 		sprintf(buffer, "   %3s %s", "N",
-			G_get_c_raster_cat(&tmp, pcats));
+			Rast_get_c_raster_cat(&tmp, pcats));
 	    else
 		sprintf(buffer, "   %3d %s", at_cat - 1,
-			G_get_cat(at_cat - 1, pcats));
+			Rast_get_cat(at_cat - 1, pcats));
 	}
 	wmove(CAT_WIN, at_line++, 1);
 	waddstr(CAT_WIN, buffer);
@@ -155,7 +155,7 @@ Write_status(int red, int grn, int blu, int shift_incr, int at_cat,
     if (hi_mode)
 	sprintf(buffer, "HIGHLIGHT COLOR");
     else {
-	if (!G_is_c_null_value(&tmp))
+	if (!Rast_is_c_null_value(&tmp))
 	    sprintf(buffer, "CATEGORY NUMBER: %d", at_cat);
 	else
 	    sprintf(buffer, "CATEGORY NUMBER: N");

+ 2 - 2
display/d.colors/get_info.c

@@ -18,13 +18,13 @@ int get_map_info(char *name, char *mapset)
 	exit(0);
 
     /* Reading color lookup table */
-    if (G_read_cats(name, mapset, &categories) == -1) {
+    if (Rast_read_cats(name, mapset, &categories) == -1) {
 	sprintf(buff, "category file for [%s] not available", name);
 	G_fatal_error(buff);
     }
 
     /* Reading color lookup table */
-    if (G_read_colors(name, mapset, &colors) == -1) {
+    if (Rast_read_colors(name, mapset, &colors) == -1) {
 	sprintf(buff, "color file for [%s] not available", name);
 	G_fatal_error(buff);
     }

+ 18 - 18
display/d.colors/interact.c

@@ -43,8 +43,8 @@ interact(struct Categories *categories, struct Colors *colors, char *name,
     hi_save_mode = 0;
 
     colors_changed = 0;
-    G_set_c_null_value(&at_cat, 1);
-    G_get_color(at_cat, &cur_red, &cur_grn, &cur_blu, colors);
+    Rast_set_c_null_value(&at_cat, 1);
+    Rast_get_color(at_cat, &cur_red, &cur_grn, &cur_blu, colors);
     shift_incr = 10;
 
     Initialize_curses();
@@ -89,10 +89,10 @@ interact(struct Categories *categories, struct Colors *colors, char *name,
 	case 'd':
 	case 'u':
 	    if (hi_mode && !hi_save_mode) {
-		G_get_color(at_cat, &cur_red, &cur_grn, &cur_blu, colors);
+		Rast_get_color(at_cat, &cur_red, &cur_grn, &cur_blu, colors);
 	    }
 	    /*              tmark_category(at_cat, 0) ; */
-	    if (G_is_c_null_value(&at_cat))
+	    if (Rast_is_c_null_value(&at_cat))
 		tmp = 0;
 	    else
 		tmp = at_cat + 1;
@@ -115,7 +115,7 @@ interact(struct Categories *categories, struct Colors *colors, char *name,
 	    }
 	    tmp = tmp % (categories->num + 2);	/* changed 11/99 M.N. */
 	    if (!tmp)
-		G_set_c_null_value(&at_cat, 1);
+		Rast_set_c_null_value(&at_cat, 1);
 	    else
 		at_cat = tmp - 1;
 
@@ -124,12 +124,12 @@ interact(struct Categories *categories, struct Colors *colors, char *name,
 		cur_grn = grn_hi;
 		cur_blu = blu_hi;
 		if (hi_save_mode) {
-		    G_set_color(at_cat, cur_red, cur_grn, cur_blu, colors);
+		    Rast_set_color(at_cat, cur_red, cur_grn, cur_blu, colors);
 		    colors_changed = 1;
 		}
 	    }
 	    else {
-		G_get_color(at_cat, &cur_red, &cur_grn, &cur_blu, colors);
+		Rast_get_color(at_cat, &cur_red, &cur_grn, &cur_blu, colors);
 	    }
 
 	    WRITE_CATS;
@@ -167,12 +167,12 @@ interact(struct Categories *categories, struct Colors *colors, char *name,
 		cur_grn = grn_hi;
 		cur_blu = blu_hi;
 		if (hi_save_mode) {
-		    G_set_color(at_cat, cur_red, cur_grn, cur_blu, colors);
+		    Rast_set_color(at_cat, cur_red, cur_grn, cur_blu, colors);
 		    colors_changed = 1;
 		}
 	    }
 	    else {
-		G_get_color(at_cat, &cur_red, &cur_grn, &cur_blu, colors);
+		Rast_get_color(at_cat, &cur_red, &cur_grn, &cur_blu, colors);
 		switch (cur_char) {
 		case 'r':
 		    cur_red = shift_color(cur_red, -shift_incr);
@@ -193,7 +193,7 @@ interact(struct Categories *categories, struct Colors *colors, char *name,
 		    cur_blu = shift_color(cur_blu, shift_incr);
 		    break;
 		}
-		G_set_color(at_cat, cur_red, cur_grn, cur_blu, colors);
+		Rast_set_color(at_cat, cur_red, cur_grn, cur_blu, colors);
 		colors_changed = 1;
 	    }
 	    WRITE_STATUS;
@@ -207,25 +207,25 @@ interact(struct Categories *categories, struct Colors *colors, char *name,
 	    WRITE_STATUS;
 	    break;
 	case '+':
-	    G_shift_colors(1, colors);
+	    Rast_shift_colors(1, colors);
 	    if (hi_mode) {
 		cur_red = red_hi;
 		cur_grn = grn_hi;
 		cur_blu = blu_hi;
 		if (hi_save_mode)
-		    G_set_color(at_cat, cur_red, cur_grn, cur_blu, colors);
+		    Rast_set_color(at_cat, cur_red, cur_grn, cur_blu, colors);
 	    }
 	    colors_changed = 1;
 	    WRITE_STATUS;
 	    break;
 	case '-':
-	    G_shift_colors(-1, colors);
+	    Rast_shift_colors(-1, colors);
 	    if (hi_mode) {
 		cur_red = red_hi;
 		cur_grn = grn_hi;
 		cur_blu = blu_hi;
 		if (hi_save_mode)
-		    G_set_color(at_cat, cur_red, cur_grn, cur_blu, colors);
+		    Rast_set_color(at_cat, cur_red, cur_grn, cur_blu, colors);
 	    }
 	    colors_changed = 1;
 	    WRITE_STATUS;
@@ -245,14 +245,14 @@ interact(struct Categories *categories, struct Colors *colors, char *name,
 		cur_grn = grn_hi;
 		cur_blu = blu_hi;
 		if (hi_save_mode)
-		    G_set_color(at_cat, cur_red, cur_grn, cur_blu, colors);
+		    Rast_set_color(at_cat, cur_red, cur_grn, cur_blu, colors);
 	    }
 	    colors_changed = 1;
 	    break;
 	case 'h':
 	case 'H':
 	    if (hi_mode) {
-		G_get_color(at_cat, &cur_red, &cur_grn, &cur_blu, colors);
+		Rast_get_color(at_cat, &cur_red, &cur_grn, &cur_blu, colors);
 		hi_mode = 0;
 		hi_save_mode = 0;
 	    }
@@ -262,7 +262,7 @@ interact(struct Categories *categories, struct Colors *colors, char *name,
 		cur_blu = blu_hi;
 		hi_mode = 1;
 		if (cur_char == 'H') {
-		    G_set_color(at_cat, cur_red, cur_grn, cur_blu, colors);
+		    Rast_set_color(at_cat, cur_red, cur_grn, cur_blu, colors);
 		    hi_save_mode = 1;
 		    colors_changed = 1;
 		}
@@ -319,7 +319,7 @@ static int save_colors(char *name, char *mapset, struct Colors *colors)
     Clear_message();
     Write_message(2, "Writing color table      ");
 
-    if (G_write_colors(name, mapset, colors) == -1) {
+    if (Rast_write_colors(name, mapset, colors) == -1) {
 	G_sleep(1);
 	Write_message(2, "Can't write color table  ");
 	G_sleep(2);

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

@@ -69,7 +69,7 @@ int main(int argc, char **argv)
 	G_fatal_error(msg);
     }
 
-    if (G_raster_map_is_fp(map->answer, mapset)) {
+    if (Rast_raster_map_is_fp(map->answer, mapset)) {
 	sprintf(buff,
 		"Raster file [%s] is floating point! \nd.colors only works with integer maps",
 		map->answer);

+ 8 - 8
display/d.colors/tbl_toggle.c

@@ -9,8 +9,8 @@ int table_toggle(char *name, char *mapset, struct Colors *colors)
     char *msg = '\0';
     char info[100];
 
-    G_get_color_range(&min, &max, colors);
-    G_free_colors(colors);
+    Rast_get_color_range(&min, &max, colors);
+    Rast_free_colors(colors);
     sprintf(info, "Color range: %d to %d\n", min, max);
 
     toggle_number++;
@@ -18,27 +18,27 @@ int table_toggle(char *name, char *mapset, struct Colors *colors)
     switch (toggle_number) {
     case 0:
 	msg = "Original colors";
-	G_read_colors(name, mapset, colors);
+	Rast_read_colors(name, mapset, colors);
 	break;
     case 1:
 	msg = "Ramp colors";
-	G_make_ramp_colors(colors, min, max);
+	Rast_make_ramp_colors(colors, min, max);
 	break;
     case 2:
 	msg = "Grey scale colors";
-	G_make_grey_scale_colors(colors, min, max);
+	Rast_make_grey_scale_colors(colors, min, max);
 	break;
     case 3:
 	msg = "Random colors";
-	G_make_random_colors(colors, min, max);
+	Rast_make_random_colors(colors, min, max);
 	break;
     case 4:
 	msg = "Wave colors";
-	G_make_wave_colors(colors, min, max);
+	Rast_make_wave_colors(colors, min, max);
 	break;
     case 5:
 	msg = "Aspect colors";
-	G_make_aspect_colors(colors, min, max);
+	Rast_make_aspect_colors(colors, min, max);
 	break;
     }
     Write_message(2, msg);

+ 8 - 7
display/d.colortable/main.c

@@ -24,6 +24,7 @@
 #include <math.h>
 #include <grass/display.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/display_raster.h>
 #include <grass/glocale.h>
 
@@ -96,7 +97,7 @@ int main(int argc, char **argv)
 	exit(EXIT_FAILURE);
 
     map_name = opt1->answer;
-    fp = G_raster_map_is_fp(map_name, "");
+    fp = Rast_raster_map_is_fp(map_name, "");
 
     if (opt2->answer != NULL) {
 	new_colr = D_translate_color(opt2->answer);
@@ -128,9 +129,9 @@ int main(int argc, char **argv)
     }
 
     /* Make sure map is available */
-    if (G_read_colors(map_name, "", &colors) == -1)
+    if (Rast_read_colors(map_name, "", &colors) == -1)
 	G_fatal_error(_("Color file for <%s> not available"), map_name);
-    if (G_read_fp_range(map_name, "", &fp_range) == -1)
+    if (Rast_read_fp_range(map_name, "", &fp_range) == -1)
 	G_fatal_error(_("Range file for <%s> not available"), map_name);
     if (R_open_driver() != 0)
 	G_fatal_error(_("No graphics device selected"));
@@ -138,8 +139,8 @@ int main(int argc, char **argv)
     D_setup_unity(0);
     D_get_src(&t, &b, &l, &r);
 
-    G_get_fp_range_min_max(&fp_range, &dmin, &dmax);
-    if (G_is_d_null_value(&dmin) || G_is_d_null_value(&dmax))
+    Rast_get_fp_range_min_max(&fp_range, &dmin, &dmax);
+    if (Rast_is_d_null_value(&dmin) || Rast_is_d_null_value(&dmax))
 	G_fatal_error("Data range is empty");
     cats_num = (int)dmax - (int)dmin + 1;
     if (lines <= 0 && cols <= 0) {
@@ -173,7 +174,7 @@ int main(int argc, char **argv)
 
     white = D_translate_color("white");
     black = D_translate_color("black");
-    G_set_c_null_value(&atcat, 1);
+    Rast_set_c_null_value(&atcat, 1);
     if (!fp) {
 	for (atcol = 0; atcol < cols; atcol++) {
 	    cur_dot_row = t;
@@ -250,7 +251,7 @@ int main(int argc, char **argv)
 	fprintf(stdout, "dots_per_line: %d\n", dots_per_line);
 	for (r = 0; r < dots_per_line - 6; r++) {
 	    if (r <= 4)
-		G_set_d_null_value(&dval, 1);
+		Rast_set_d_null_value(&dval, 1);
 	    else
 		dval =
 		    dmin + (r - 1) * (dmax - dmin) / (dots_per_line - 6 - 5);

+ 2 - 2
display/d.extract/main.c

@@ -79,14 +79,14 @@ int main(int argc, char **argv)
 	G_fatal_error(_("No graphics device selected"));
 
     color = G_standard_color_rgb(BLACK);
-    if (G_str_to_color(color_opt->answer, &r, &g, &b)) {
+    if (Rast_str_to_color(color_opt->answer, &r, &g, &b)) {
 	color.r = r;
 	color.g = g;
 	color.b = b;
     }
 
     hcolor = G_standard_color_rgb(RED);
-    if (G_str_to_color(hcolor_opt->answer, &r, &g, &b)) {
+    if (Rast_str_to_color(hcolor_opt->answer, &r, &g, &b)) {
 	hcolor.r = r;
 	hcolor.g = g;
 	hcolor.b = b;

+ 4 - 3
display/d.graph/do_graph.c

@@ -1,6 +1,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/display.h>
 #include <grass/display_raster.h>
 #include <grass/symbol.h>
@@ -99,7 +100,7 @@ int do_color(const char *str)
     }
 
     /* Parse and select color */
-    color = G_str_to_color(in_color, &R, &G, &B);
+    color = Rast_str_to_color(in_color, &R, &G, &B);
     if (color == 0) {
 	G_warning(_("[%s]: No such color"), in_color);
 	/* store for backup */
@@ -339,7 +340,7 @@ int do_symbol(const char *str)
     size *= yincr;
 
     /* parse line color */
-    ret = G_str_to_color(line_color_str, &R, &G, &B);
+    ret = Rast_str_to_color(line_color_str, &R, &G, &B);
     line_color->r = (unsigned char)R;
     line_color->g = (unsigned char)G;
     line_color->b = (unsigned char)B;
@@ -356,7 +357,7 @@ int do_symbol(const char *str)
     }
 
     /* parse fill color */
-    ret = G_str_to_color(fill_color_str, &R, &G, &B);
+    ret = Rast_str_to_color(fill_color_str, &R, &G, &B);
     fill_color->r = (unsigned char)R;
     fill_color->g = (unsigned char)G;
     fill_color->b = (unsigned char)B;

+ 1 - 0
display/d.graph/graphics.c

@@ -1,5 +1,6 @@
 #include <string.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/glocale.h>
 
 #include "local_proto.h"

+ 2 - 1
display/d.graph/main.c

@@ -31,6 +31,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/display.h>
 #include <grass/display_raster.h>
 #include <grass/glocale.h>
@@ -100,7 +101,7 @@ int main(int argc, char **argv)
 
     /* Parse and select color */
     if (opt2->answer != NULL) {
-	color = G_str_to_color(opt2->answer, &R, &G, &B);
+	color = Rast_str_to_color(opt2->answer, &R, &G, &B);
 
 	if (color == 0)
 	    G_fatal_error(_("[%s]: No such color"), opt2->answer);

+ 2 - 1
display/d.grid/fiducial.c

@@ -1,4 +1,5 @@
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/display.h>
 #include <grass/symbol.h>
 #include <grass/colors.h>
@@ -33,7 +34,7 @@ void plot_symbol(double easting, double northing, int color, double rotation,
 
     if (D_color_number_to_RGB(color, &R, &G, &B) == 0)
 	/* fall back to black on failure */
-	G_str_to_color(DEFAULT_FG_COLOR, &R, &G, &B);
+	Rast_str_to_color(DEFAULT_FG_COLOR, &R, &G, &B);
 
     line_color->r = (unsigned char)R;
     line_color->g = (unsigned char)G;

+ 1 - 0
display/d.grid/main.c

@@ -21,6 +21,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/display.h>
 #include <grass/display_raster.h>
 #include <grass/gprojects.h>

+ 1 - 0
display/d.grid/plot.c

@@ -2,6 +2,7 @@
 #include <string.h>
 
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/display.h>
 #include <grass/display_raster.h>
 #include <grass/gprojects.h>

+ 1 - 0
display/d.grid/plotborder.c

@@ -1,5 +1,6 @@
 #include <math.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/display.h>
 
 int plot_border(double grid_size, double east, double north)

+ 3 - 2
display/d.his/his.c

@@ -1,5 +1,6 @@
 
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include "his.h"
 
 /****************************************************************************
@@ -65,10 +66,10 @@ int make_gray_scale(struct Colors *gray)
 {
     int i;
 
-    G_init_colors(gray);
+    Rast_init_colors(gray);
 
     for (i = 0; i < 256; i++)
-	G_set_color((CELL) i, i, i, i, gray);
+	Rast_set_color((CELL) i, i, i, i, gray);
 
     return 0;
 }

+ 19 - 18
display/d.his/main.c

@@ -23,6 +23,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/display.h>
 #include <grass/display_raster.h>
 #include <grass/glocale.h>
@@ -121,7 +122,7 @@ int main(int argc, char **argv)
     name_h = opt_h->answer;
 
     /* Make sure map is available */
-    if ((hue_file = G_open_cell_old(name_h, "")) == -1)
+    if ((hue_file = Rast_open_cell_old(name_h, "")) == -1)
 	G_fatal_error(_("Unable to open raster map <%s>"), name_h);
 
     hue_r = G_malloc(window.cols);
@@ -132,7 +133,7 @@ int main(int argc, char **argv)
     dummy = G_malloc(window.cols);
 
     /* Reading color lookup table */
-    if (G_read_colors(name_h, "", &hue_colors) == -1)
+    if (Rast_read_colors(name_h, "", &hue_colors) == -1)
 	G_fatal_error(_("Color file for <%s> not available"), name_h);
 
     int_used = 0;
@@ -143,14 +144,14 @@ int main(int argc, char **argv)
 	int_used = 1;
 
 	/* Make sure map is available */
-	if ((int_file = G_open_cell_old(name_i, "")) == -1)
+	if ((int_file = Rast_open_cell_old(name_i, "")) == -1)
 	    G_fatal_error(_("Unable to open raster map <%s>"), name_i);
 
 	int_r = G_malloc(window.cols);
 	int_n = G_malloc(window.cols);
 
 	/* Reading color lookup table */
-	if (G_read_colors(name_i, "", &int_colors) == -1)
+	if (Rast_read_colors(name_i, "", &int_colors) == -1)
 	    G_fatal_error(_("Color file for <%s> not available"), name_i);
     }
 
@@ -162,20 +163,20 @@ int main(int argc, char **argv)
 	sat_used = 1;
 
 	/* Make sure map is available */
-	if ((sat_file = G_open_cell_old(name_s, "")) == -1)
+	if ((sat_file = Rast_open_cell_old(name_s, "")) == -1)
 	    G_fatal_error("Unable to open raster map <%s>", name_s);
 
 	sat_r = G_malloc(window.cols);
 	sat_n = G_malloc(window.cols);
 
 	/* Reading color lookup table */
-	if (G_read_colors(name_s, "", &sat_colors) == -1)
+	if (Rast_read_colors(name_s, "", &sat_colors) == -1)
 	    G_fatal_error(_("Color file for <%s> not available"), name_s);
     }
 
-    r_array = G_allocate_cell_buf();
-    g_array = G_allocate_cell_buf();
-    b_array = G_allocate_cell_buf();
+    r_array = Rast_allocate_cell_buf();
+    g_array = Rast_allocate_cell_buf();
+    b_array = Rast_allocate_cell_buf();
 
     /* Make color table */
     make_gray_scale(&gray_colors);
@@ -190,17 +191,17 @@ int main(int argc, char **argv)
     for (atrow = 0; atrow < window.rows;) {
 	G_percent(atrow, window.rows, 2);
 
-	if (G_get_raster_row_colors
+	if (Rast_get_raster_row_colors
 	    (hue_file, atrow, &hue_colors, hue_r, hue_g, hue_b, hue_n) < 0)
 	    G_fatal_error(_("Error reading hue data"));
 
 	if (int_used &&
-	    (G_get_raster_row_colors
+	    (Rast_get_raster_row_colors
 	     (int_file, atrow, &int_colors, int_r, dummy, dummy, int_n) < 0))
 	    G_fatal_error(_("Error reading intensity data"));
 
 	if (sat_used &&
-	    (G_get_raster_row_colors
+	    (Rast_get_raster_row_colors
 	     (sat_file, atrow, &sat_colors, sat_r, dummy, dummy, sat_n) < 0))
 	    G_fatal_error(_("Error reading saturation data"));
 
@@ -209,9 +210,9 @@ int main(int argc, char **argv)
 		if (hue_n[atcol]
 		    || (int_used && int_n[atcol])
 		    || (sat_used && sat_n[atcol])) {
-		    G_set_c_null_value(&r_array[atcol], 1);
-		    G_set_c_null_value(&g_array[atcol], 1);
-		    G_set_c_null_value(&b_array[atcol], 1);
+		    Rast_set_c_null_value(&r_array[atcol], 1);
+		    Rast_set_c_null_value(&g_array[atcol], 1);
+		    Rast_set_c_null_value(&b_array[atcol], 1);
 		    continue;
 		}
 	    }
@@ -246,11 +247,11 @@ int main(int argc, char **argv)
     R_close_driver();
 
     /* Close the raster maps */
-    G_close_cell(hue_file);
+    Rast_close_cell(hue_file);
     if (int_used)
-	G_close_cell(int_file);
+	Rast_close_cell(int_file);
     if (sat_used)
-	G_close_cell(sat_file);
+	Rast_close_cell(sat_file);
 
     exit(EXIT_SUCCESS);
 }

+ 13 - 10
display/d.histogram/bar.c

@@ -27,8 +27,11 @@
  */
 
 #include <string.h>
+
+#include <grass/Rast.h>
 #include <grass/display.h>
 #include <grass/display_raster.h>
+
 #include "bar.h"
 
 int bar(struct stat_list *dist_stats,	/* list of distribution statistics */
@@ -102,9 +105,9 @@ int bar(struct stat_list *dist_stats,	/* list of distribution statistics */
 	    max_tics--;
 	i = 0;
 	if (is_fp) {
-	    G_get_fp_range_min_max(&fp_range, &range_dmin, &range_dmax);
-	    if (G_is_d_null_value(&range_dmin) ||
-		G_is_d_null_value(&range_dmax))
+	    Rast_get_fp_range_min_max(&fp_range, &range_dmin, &range_dmax);
+	    if (Rast_is_d_null_value(&range_dmin) ||
+		Rast_is_d_null_value(&range_dmax))
 		G_fatal_error("Floating point data range is empty");
 
 	    if ((range_dmax - range_dmin) < 1.0)
@@ -124,9 +127,9 @@ int bar(struct stat_list *dist_stats,	/* list of distribution statistics */
     }
     else {
 	if (is_fp && !cat_ranges) {
-	    G_get_fp_range_min_max(&fp_range, &range_dmin, &range_dmax);
-	    if (G_is_d_null_value(&range_dmin) ||
-		G_is_d_null_value(&range_dmax))
+	    Rast_get_fp_range_min_max(&fp_range, &range_dmin, &range_dmax);
+	    if (Rast_is_d_null_value(&range_dmin) ||
+		Rast_is_d_null_value(&range_dmax))
 		G_fatal_error("Floating point data range is empty");
 	}
 	tic_every = 1;
@@ -160,7 +163,7 @@ int bar(struct stat_list *dist_stats,	/* list of distribution statistics */
 		draw = NO;
 	    else {
 		draw = YES;
-		G_set_c_null_value(&bar_color, 1);
+		Rast_set_c_null_value(&bar_color, 1);
 		bar_height =
 		    (yoffset - yscale * (double)dist_stats->null_stat);
 	    }
@@ -212,9 +215,9 @@ int bar(struct stat_list *dist_stats,	/* list of distribution statistics */
 	if (draw == YES) {
 	    if (xscale != 1) {
 		/* draw the bar as a box */
-		if (!G_is_c_null_value(&bar_color) && is_fp) {
+		if (!Rast_is_c_null_value(&bar_color) && is_fp) {
 		    if (cat_ranges)
-			G_get_ith_d_raster_cat(&cats, bar_color,
+			Rast_get_ith_d_raster_cat(&cats, bar_color,
 					       &dmin, &dmax);
 		    else {
 			dmin = range_dmin + i * (range_dmax - range_dmin) / nsteps;
@@ -267,7 +270,7 @@ int bar(struct stat_list *dist_stats,	/* list of distribution statistics */
 		/* draw the bar as a line */
 		if (is_fp) {
 		    if (cat_ranges)
-			G_get_ith_d_raster_cat(&cats, bar_color,
+			Rast_get_ith_d_raster_cat(&cats, bar_color,
 					       &dmin, &dmax);
 		    else {
 			dmin = range_dmin + i * (range_dmax - range_dmin) / nsteps;

+ 1 - 0
display/d.histogram/draw_slice.c

@@ -2,6 +2,7 @@
 #include <grass/display_raster.h>
 #include <grass/display.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 
 char percent[] = "%";
 

+ 5 - 4
display/d.histogram/get_stats.c

@@ -4,6 +4,7 @@
 #include <stdarg.h>
 #include <unistd.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include "options.h"
 #include "dhist.h"
 
@@ -50,17 +51,17 @@ int get_stats(const char *mapname, struct stat_list *dist_stats,	/* linked list
 
     /* write stats to a temp file */
     tempfile = G_tempfile();
-    is_fp = G_raster_map_is_fp(mapname, "");
+    is_fp = Rast_raster_map_is_fp(mapname, "");
     if (is_fp) {
 	if (cat_ranges) {
-	    if (G_read_raster_cats(mapname, "", &cats) < 0)
+	    if (Rast_read_raster_cats(mapname, "", &cats) < 0)
 		G_fatal_error("Can't read category file");
-	    if (G_number_of_raster_cats(&cats) <= 0) {
+	    if (Rast_number_of_raster_cats(&cats) <= 0) {
 		G_warning("There are no labeled cats, using nsteps argument");
 		cat_ranges = 0;
 	    }
 	}
-	if (G_read_fp_range(map_name, "", &fp_range) <= 0)
+	if (Rast_read_fp_range(map_name, "", &fp_range) <= 0)
 	    G_fatal_error("Can't read frange file");
     }
     if (cat_ranges) {

+ 4 - 3
display/d.histogram/main.c

@@ -34,6 +34,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/display.h>
 #include <grass/display_raster.h>
 #include <grass/glocale.h>
@@ -168,13 +169,13 @@ int main(int argc, char **argv)
     nodata = flag1->answer;
     quiet = flag2->answer ? YES : NO;
 
-    if (G_read_colors(map_name, "", &pcolors) == -1)
+    if (Rast_read_colors(map_name, "", &pcolors) == -1)
 	G_fatal_error(_("Color file for <%s> not available"), map_name);
 
-    if (G_read_cats(map_name, "", &cats) == -1)
+    if (Rast_read_cats(map_name, "", &cats) == -1)
 	G_fatal_error(_("Category file for <%s> not available"), map_name);
 
-    if (G_read_range(map_name, "", &range) == -1)
+    if (Rast_read_range(map_name, "", &range) == -1)
 	G_fatal_error(_("Range information for <%s> not available"),
 		      map_name);
 

+ 12 - 9
display/d.histogram/pie.c

@@ -29,8 +29,11 @@
  */
 
 #include <string.h>
+
+#include <grass/Rast.h>
 #include <grass/display.h>
 #include <grass/display_raster.h>
+
 #include "pie.h"
 
 /*#define DEBUG */
@@ -108,9 +111,9 @@ int pie(struct stat_list *dist_stats,	/* list of distribution statistics */
 	max_tics = (x_line[2] - x_line[1]) / XTIC_DIST;
 	i = 0;
 	if (is_fp) {
-	    G_get_fp_range_min_max(&fp_range, &range_dmin, &range_dmax);
-	    if (G_is_d_null_value(&range_dmin) ||
-		G_is_d_null_value(&range_dmax))
+	    Rast_get_fp_range_min_max(&fp_range, &range_dmin, &range_dmax);
+	    if (Rast_is_d_null_value(&range_dmin) ||
+		Rast_is_d_null_value(&range_dmax))
 		G_fatal_error("Floating point data range is empty");
 
 	    while ((range_dmax - range_dmin) / tics[i].every > max_tics)
@@ -125,9 +128,9 @@ int pie(struct stat_list *dist_stats,	/* list of distribution statistics */
     }
     else {
 	if (is_fp && !cat_ranges) {
-	    G_get_fp_range_min_max(&fp_range, &range_dmin, &range_dmax);
-	    if (G_is_d_null_value(&range_dmin) ||
-		G_is_d_null_value(&range_dmax))
+	    Rast_get_fp_range_min_max(&fp_range, &range_dmin, &range_dmax);
+	    if (Rast_is_d_null_value(&range_dmin) ||
+		Rast_is_d_null_value(&range_dmax))
 		G_fatal_error("Floating point data range is empty");
 	}
 	tic_every = 1;
@@ -165,7 +168,7 @@ int pie(struct stat_list *dist_stats,	/* list of distribution statistics */
 		draw = NO;
 	    else {
 		draw = YES;
-		G_set_d_null_value(&dval, 1);
+		Rast_set_d_null_value(&dval, 1);
 		arc = 360.0 *((double)dist_stats->null_stat
 				    / (double)dist_stats->sumstat);
 		draw_slice_filled(colors, dval, color, ORIGIN_X,
@@ -185,7 +188,7 @@ int pie(struct stat_list *dist_stats,	/* list of distribution statistics */
 		draw = YES;
 		if (is_fp) {
 		    if (cat_ranges)
-			G_get_ith_d_raster_cat(&cats, (CELL) i, &dmin, &dmax);
+			Rast_get_ith_d_raster_cat(&cats, (CELL) i, &dmin, &dmax);
 		    else {
 			dmin = range_dmin + i * (range_dmax - range_dmin) / nsteps;
 			dmax = range_dmin + (i + 1) * (range_dmax - range_dmin) / nsteps;
@@ -225,7 +228,7 @@ int pie(struct stat_list *dist_stats,	/* list of distribution statistics */
 		    draw = YES;
 		    if (is_fp) {
 			if (cat_ranges)
-			    G_get_ith_d_raster_cat(&cats, (CELL) i, &dmin, &dmax);
+			    Rast_get_ith_d_raster_cat(&cats, (CELL) i, &dmin, &dmax);
 			else {
 			    dmin = range_dmin + i * (range_dmax - range_dmin) / nsteps;
 			    dmax = range_dmin + (i + 1) * (range_dmax - range_dmin) / nsteps;

+ 2 - 1
display/d.labels/color.c

@@ -16,6 +16,7 @@
 /**  ??? move these into libgis ??? (libraster for set_color_from_RGBA()) **/
 
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/display.h>
 #include <grass/glocale.h>
 
@@ -52,7 +53,7 @@ int set_RGBA_from_str(RGBA_Color * color, const char *clr_str)
     int r, g, b;
     int ret;
 
-    ret = G_str_to_color(clr_str, &r, &g, &b);
+    ret = Rast_str_to_color(clr_str, &r, &g, &b);
 
     if (ret == 1) {
 	color->a = RGBA_COLOR_OPAQUE;

+ 1 - 0
display/d.labels/do_labels.c

@@ -3,6 +3,7 @@
 #include <stdlib.h>
 #include <math.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/display.h>
 #include <grass/display_raster.h>
 #include <grass/glocale.h>

+ 1 - 0
display/d.labels/main.c

@@ -19,6 +19,7 @@
 #include <stdlib.h>
 #include <math.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/display.h>
 #include <grass/display_raster.h>
 #include "local_proto.h"

+ 19 - 18
display/d.legend/main.c

@@ -29,6 +29,7 @@
 #include <string.h>
 #include <math.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/display_raster.h>
 #include <grass/display.h>
 #include <grass/glocale.h>
@@ -243,20 +244,20 @@ int main(int argc, char **argv)
     }
 
 
-    if (G_read_colors(map_name, "", &colors) == -1)
+    if (Rast_read_colors(map_name, "", &colors) == -1)
 	G_fatal_error(_("Color file for <%s> not available"), map_name);
 
-    fp = G_raster_map_is_fp(map_name, "");
+    fp = Rast_raster_map_is_fp(map_name, "");
     if (fp && !use_catlist) {
 	do_smooth = TRUE;
 	/* fprintf(stderr, "FP map found - switching gradient legend on\n"); */
 	flip = !flip;
     }
 
-    if (G_read_cats(map_name, "", &cats) == -1)
+    if (Rast_read_cats(map_name, "", &cats) == -1)
 	G_warning(_("Category file for <%s> not available"), map_name);
 
-    G_set_c_null_value(&null_cell, 1);
+    Rast_set_c_null_value(&null_cell, 1);
 
     if (R_open_driver() != 0)
 	G_fatal_error(_("No graphics device selected"));
@@ -318,15 +319,15 @@ int main(int argc, char **argv)
 
     /* How many categories to show */
     if (!fp) {
-	if (G_read_range(map_name, "", &range) == -1)
+	if (Rast_read_range(map_name, "", &range) == -1)
 	    G_fatal_error(_("Range information for <%s> not available (run r.support)"),
 			  map_name);
 
-	G_get_range_min_max(&range, &min_ind, &max_ind);
-	if (G_is_c_null_value(&min_ind))
+	Rast_get_range_min_max(&range, &min_ind, &max_ind);
+	if (Rast_is_c_null_value(&min_ind))
 	    G_fatal_error(_("Input map contains no data"));
 
-	G_get_color_range(&min_colr, &max_colr, &colors);
+	Rast_get_color_range(&min_colr, &max_colr, &colors);
 
 	if (UserRange) {
 	    if (min_ind < UserRangeMin)
@@ -371,9 +372,9 @@ int main(int argc, char **argv)
 	for (i = min_ind, j = 1, k = 0; j <= do_cats && i <= max_ind;
 	     j++, i += thin) {
 	    if (!flip)
-		cstr = G_get_cat(i, &cats);
+		cstr = Rast_get_cat(i, &cats);
 	    else
-		cstr = G_get_cat((max_ind - (i - min_ind)), &cats);
+		cstr = Rast_get_cat((max_ind - (i - min_ind)), &cats);
 
 	    if (!use_catlist)
 		catlist[j - 1] = (double)i;
@@ -404,7 +405,7 @@ int main(int argc, char **argv)
 				  opt8->answers[i], min_ind, max_ind);
 		}
 
-		cstr = G_get_cat(catlist[i], &cats);
+		cstr = Rast_get_cat(catlist[i], &cats);
 		if (!cstr[0]) {	/* no cat label found, skip str output */
 		    if (hide_nodata)
 			continue;
@@ -464,7 +465,7 @@ int main(int argc, char **argv)
 	}
 
 	/*      R_text_size((int)(dots_per_line*4/5), (int)(dots_per_line*4/5)) ;    redundant */
-	/* if(G_is_c_null_value(&min_ind) && G_is_c_null_value(&max_ind))
+	/* if(Rast_is_c_null_value(&min_ind) && Rast_is_c_null_value(&max_ind))
 	   {
 	   min_ind = 1;
 	   max_ind = 0;
@@ -480,13 +481,13 @@ int main(int argc, char **argv)
 	}
     }
     else {			/* is fp */
-	if (G_read_fp_range(map_name, "", &fprange) == -1)
+	if (Rast_read_fp_range(map_name, "", &fprange) == -1)
 	    G_fatal_error(_("Range information for <%s> not available"),
 			  map_name);
 
-	G_get_fp_range_min_max(&fprange, &dmin, &dmax);
+	Rast_get_fp_range_min_max(&fprange, &dmin, &dmax);
 
-	G_get_d_color_range(&min_dcolr, &max_dcolr, &colors);
+	Rast_get_d_color_range(&min_dcolr, &max_dcolr, &colors);
 
 	if (UserRange) {
 	    if (dmin < UserRangeMin)
@@ -603,7 +604,7 @@ int main(int argc, char **argv)
 			max_ind - k * (double)(max_ind - min_ind) / (steps -
 								     1);
 
-		cstr = G_get_cat(tcell, &cats);
+		cstr = Rast_get_cat(tcell, &cats);
 		if (!cstr[0])	/* no cats found, disable str output */
 		    hide_catstr = 1;
 		else
@@ -779,9 +780,9 @@ int main(int argc, char **argv)
 	    /*              for(i=min_ind, j=1, k=0; j<=do_cats && i<=max_ind; j++, i+=thin)        */
 	{
 	    if (!flip)
-		cstr = G_get_cat(catlist[i], &cats);
+		cstr = Rast_get_cat(catlist[i], &cats);
 	    else
-		cstr = G_get_cat(catlist[catlistCount - i - 1], &cats);
+		cstr = Rast_get_cat(catlist[catlistCount - i - 1], &cats);
 
 
 	    if (!cstr[0]) {	/* no cat label found, skip str output */

+ 13 - 12
display/d.nviz/main.c

@@ -24,6 +24,7 @@
 #include <math.h>
 #include <string.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/display.h>
 #include <grass/display_raster.h>
 #include "local.h"
@@ -178,7 +179,7 @@ int main(int argc, char *argv[])
     /* Open Raster File */
     if (NULL == (mapset = G_find_cell2(name, "")))
 	G_fatal_error(_("Raster map <%s> not found"), name);
-    if (0 > (fd = G_open_cell_old(name, mapset)))
+    if (0 > (fd = Rast_open_cell_old(name, mapset)))
 	G_fatal_error(_("Unable to open raster map <%s>"), name);
 
     /* Set Image name */
@@ -199,7 +200,7 @@ int main(int argc, char *argv[])
 	G_fatal_error(_("Unable to open file <%s>"), outfile);
 
     /* Get Raster Type */
-    data_type = G_get_raster_map_type(fd);
+    data_type = Rast_get_raster_map_type(fd);
     /* Done with file */
 
     /* Output initial startup stuff */
@@ -315,7 +316,7 @@ int main(int argc, char *argv[])
     fprintf(fp, "SendScriptLine \"set ScriptPlaying 0\"\n");
     fprintf(fp, "puts \"DONE!\"\n");
 
-    G_close_cell(fd);
+    Rast_close_cell(fd);
     fclose(fp);
 
     sprintf(buf1, _("Created NVIZ script <%s>."), outfile);
@@ -442,31 +443,31 @@ int read_rast
 
 
     if (data_type == CELL_TYPE) {
-	cell = G_allocate_c_raster_buf();
-	if (G_get_c_raster_row(fd, cell, row) < 0)
+	cell = Rast_allocate_c_raster_buf();
+	if (Rast_get_c_raster_row(fd, cell, row) < 0)
 	    exit(1);
 
-	if (G_is_c_null_value(&cell[col]))
+	if (Rast_is_c_null_value(&cell[col]))
 	    camera_height = (double)9999.;
 	else
 	    camera_height = (double)cell[col];
     }
 
     if (data_type == FCELL_TYPE) {
-	fcell = G_allocate_f_raster_buf();
-	if (G_get_f_raster_row(fd, fcell, row) < 0)
+	fcell = Rast_allocate_f_raster_buf();
+	if (Rast_get_f_raster_row(fd, fcell, row) < 0)
 	    exit(1);
-	if (G_is_f_null_value(&fcell[col]))
+	if (Rast_is_f_null_value(&fcell[col]))
 	    camera_height = (double)9999.;
 	else
 	    camera_height = (double)fcell[col];
     }
 
     if (data_type == DCELL_TYPE) {
-	dcell = G_allocate_d_raster_buf();
-	if (G_get_d_raster_row(fd, dcell, row) < 0)
+	dcell = Rast_allocate_d_raster_buf();
+	if (Rast_get_d_raster_row(fd, dcell, row) < 0)
 	    exit(1);
-	if (G_is_d_null_value(&dcell[col]))
+	if (Rast_is_d_null_value(&dcell[col]))
 	    camera_height = (double)9999.;
 	else
 	    camera_height = (double)dcell[col];

+ 4 - 3
display/d.path/main.c

@@ -20,6 +20,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/display_raster.h>
 #include <grass/display.h>
 #include <grass/colors.h>
@@ -152,21 +153,21 @@ int main(int argc, char **argv)
 	G_fatal_error(_("No graphics device selected"));
 
     color = G_standard_color_rgb(BLACK);
-    if (G_str_to_color(color_opt->answer, &r, &g, &b)) {
+    if (Rast_str_to_color(color_opt->answer, &r, &g, &b)) {
 	color.r = r;
 	color.g = g;
 	color.b = b;
     }
 
     hcolor = G_standard_color_rgb(RED);
-    if (G_str_to_color(hcolor_opt->answer, &r, &g, &b)) {
+    if (Rast_str_to_color(hcolor_opt->answer, &r, &g, &b)) {
 	hcolor.r = r;
 	hcolor.g = g;
 	hcolor.b = b;
     }
 
     bgcolor = G_standard_color_rgb(WHITE);
-    if (G_str_to_color(bgcolor_opt->answer, &r, &g, &b)) {
+    if (Rast_str_to_color(bgcolor_opt->answer, &r, &g, &b)) {
 	bgcolor.r = r;
 	bgcolor.g = g;
 	bgcolor.b = b;

+ 1 - 0
display/d.path/select.c

@@ -3,6 +3,7 @@
 #include <unistd.h>
 #include <math.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/display_raster.h>
 #include <grass/display.h>
 #include <grass/Vect.h>

+ 20 - 19
display/d.profile/main.c

@@ -23,6 +23,7 @@
 #include <stdlib.h>
 #include <math.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/display_raster.h>
 #include <grass/display.h>
 #include <grass/glocale.h>
@@ -38,7 +39,7 @@ struct point
 
 static void get_region_range(int fd)
 {
-    DCELL *buf = G_allocate_d_raster_buf();
+    DCELL *buf = Rast_allocate_d_raster_buf();
     int nrows = G_window_rows();
     int ncols = G_window_cols();
     int row, col;
@@ -47,7 +48,7 @@ static void get_region_range(int fd)
     max = -1e300;
 
     for (row = 0; row < nrows; row++) {
-	G_get_d_raster_row(fd, buf, row);
+	Rast_get_d_raster_row(fd, buf, row);
 	for (col = 0; col < ncols; col++) {
 	    if (min > buf[col])
 		min = buf[col];
@@ -59,14 +60,14 @@ static void get_region_range(int fd)
 
 static void get_map_range(void)
 {
-    if (G_raster_map_type(mapname, "") == CELL_TYPE) {
+    if (Rast_raster_map_type(mapname, "") == CELL_TYPE) {
 	struct Range range;
 	CELL xmin, xmax;
 
-	if (G_read_range(mapname, "", &range) <= 0)
+	if (Rast_read_range(mapname, "", &range) <= 0)
 	    G_fatal_error(_("Unable to read range for %s"), mapname);
 
-	G_get_range_min_max(&range, &xmin, &xmax);
+	Rast_get_range_min_max(&range, &xmin, &xmax);
 
 	max = xmax;
 	min = xmin;
@@ -74,10 +75,10 @@ static void get_map_range(void)
     else {
 	struct FPRange fprange;
 
-	if (G_read_fp_range(mapname, "", &fprange) <= 0)
+	if (Rast_read_fp_range(mapname, "", &fprange) <= 0)
 	    G_fatal_error(_("Unable to read FP range for %s"), mapname);
 
-	G_get_fp_range_min_max(&fprange, &min, &max);
+	Rast_get_fp_range_min_max(&fprange, &min, &max);
     }
 }
 
@@ -123,8 +124,8 @@ static int get_cell(DCELL *result, int fd, double x, double y)
     DCELL *tmp;
 
     if (!row1) {
-	row1 = G_allocate_d_raster_buf();
-	row2 = G_allocate_d_raster_buf();
+	row1 = Rast_allocate_d_raster_buf();
+	row2 = Rast_allocate_d_raster_buf();
     }
 
     col = (int)floor(x - 0.5);
@@ -134,33 +135,33 @@ static int get_cell(DCELL *result, int fd, double x, double y)
 
     if (row < 0 || row + 1 >= G_window_rows() ||
 	col < 0 || col + 1 >= G_window_cols()) {
-	G_set_d_null_value(result, 1);
+	Rast_set_d_null_value(result, 1);
 	return 0;
     }
 
     if (cur_row != row) {
 	if (cur_row == row + 1) {
 	    tmp = row1; row1 = row2; row2 = tmp;
-	    G_get_d_raster_row(fd, row1, row);
+	    Rast_get_d_raster_row(fd, row1, row);
 	}
 	else if (cur_row == row - 1) {
 	    tmp = row1; row1 = row2; row2 = tmp;
-	    G_get_d_raster_row(fd, row2, row + 1);
+	    Rast_get_d_raster_row(fd, row2, row + 1);
 	}
 	else {
-	    G_get_d_raster_row(fd, row1, row);
-	    G_get_d_raster_row(fd, row2, row + 1);
+	    Rast_get_d_raster_row(fd, row1, row);
+	    Rast_get_d_raster_row(fd, row2, row + 1);
 	}
 	cur_row = row;
     }
 
-    if (G_is_d_null_value(&row1[col]) || G_is_d_null_value(&row1[col+1]) ||
-	G_is_d_null_value(&row2[col]) || G_is_d_null_value(&row2[col+1])) {
-	G_set_d_null_value(result, 1);
+    if (Rast_is_d_null_value(&row1[col]) || Rast_is_d_null_value(&row1[col+1]) ||
+	Rast_is_d_null_value(&row2[col]) || Rast_is_d_null_value(&row2[col+1])) {
+	Rast_set_d_null_value(result, 1);
 	return 0;
     }
 
-    *result = G_interp_bilinear(x, y,
+    *result = Rast_interp_bilinear(x, y,
 				row1[col], row1[col+1],
 				row2[col], row2[col+1]);
 
@@ -211,7 +212,7 @@ int main(int argc, char **argv)
 
     mapname = map->answer;
 
-    fd = G_open_cell_old(mapname, "");
+    fd = Rast_open_cell_old(mapname, "");
     if (fd < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), mapname);
 

+ 24 - 23
display/d.rast.arrow/main.c

@@ -38,6 +38,7 @@
 #include <string.h>
 #include <math.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/display_raster.h>
 #include <grass/display.h>
 #include <grass/colors.h>
@@ -231,7 +232,7 @@ int main(int argc, char **argv)
     if (align->answer) {
 	struct Cell_head wind;
 
-	if (G_get_cellhd(layer_name, "", &wind) < 0)
+	if (Rast_get_cellhd(layer_name, "", &wind) < 0)
 	    G_fatal_error(_("Unable to read header of raster map <%s>"), layer_name);
 
 	/* expand window extent by one wind resolution */
@@ -267,10 +268,10 @@ int main(int argc, char **argv)
 
     /* figure out arrow scaling if using a magnitude map */
     if (opt7->answer) {
-	G_init_fp_range(&range);	/* really needed? */
-	if (G_read_fp_range(mag_map, "", &range) != 1)
+	Rast_init_fp_range(&range);	/* really needed? */
+	if (Rast_read_fp_range(mag_map, "", &range) != 1)
 	    G_fatal_error(_("Problem reading range file"));
-	G_get_fp_range_min_max(&range, &mag_min, &mag_max);
+	Rast_get_fp_range_min_max(&range, &mag_min, &mag_max);
 
 	scale *= 1.5 / fabs(mag_max);
 	G_debug(3, "scaling=%.2f  rast_max=%.2f", scale, mag_max);
@@ -290,26 +291,26 @@ int main(int argc, char **argv)
     }
 
     /* open the raster map */
-    layer_fd = G_open_cell_old(layer_name, "");
+    layer_fd = Rast_open_cell_old(layer_name, "");
     if (layer_fd < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), layer_name);
 
-    raster_type = G_get_raster_map_type(layer_fd);
+    raster_type = Rast_get_raster_map_type(layer_fd);
 
     /* allocate the cell array */
-    raster_row = G_allocate_raster_buf(raster_type);
+    raster_row = Rast_allocate_raster_buf(raster_type);
 
 
     if (opt7->answer) {
 	/* open the magnitude raster map */
-	mag_fd = G_open_cell_old(mag_map, "");
+	mag_fd = Rast_open_cell_old(mag_map, "");
 	if (mag_fd < 0)
 	    G_fatal_error("Unable to open raster map <%s>", mag_map);
 
-	mag_raster_type = G_get_raster_map_type(mag_fd);
+	mag_raster_type = Rast_get_raster_map_type(mag_fd);
 
 	/* allocate the cell array */
-	mag_raster_row = G_allocate_raster_buf(mag_raster_type);
+	mag_raster_row = Rast_allocate_raster_buf(mag_raster_type);
     }
 
 
@@ -317,11 +318,11 @@ int main(int argc, char **argv)
        and call appropriate function to draw an arrow on the cell */
 
     for (row = 0; row < nrows; row++) {
-	G_get_raster_row(layer_fd, raster_row, row, raster_type);
+	Rast_get_raster_row(layer_fd, raster_row, row, raster_type);
 	ptr = raster_row;
 
 	if (opt7->answer) {
-	    G_get_raster_row(mag_fd, mag_raster_row, row, mag_raster_type);
+	    Rast_get_raster_row(mag_fd, mag_raster_row, row, mag_raster_type);
 	    mag_ptr = mag_raster_row;
 	}
 
@@ -355,7 +356,7 @@ int main(int argc, char **argv)
 
 		length *= scale;
 
-		if (G_is_null_value(mag_ptr, mag_raster_type)) {
+		if (Rast_is_null_value(mag_ptr, mag_raster_type)) {
 		    G_debug(5, "Invalid arrow length [NULL]. Skipping.");
 		    no_arrow = TRUE;
 		}
@@ -367,11 +368,11 @@ int main(int argc, char **argv)
 	    }
 
 	    if (no_arrow) {
-		ptr = G_incr_void_ptr(ptr, G_raster_size(raster_type));
+		ptr = Rast_incr_void_ptr(ptr, Rast_raster_size(raster_type));
 		if (opt7->answer)
 		    mag_ptr =
-			G_incr_void_ptr(mag_ptr,
-					G_raster_size(mag_raster_type));
+			Rast_incr_void_ptr(mag_ptr,
+					Rast_raster_size(mag_raster_type));
 		no_arrow = FALSE;
 		continue;
 	    }
@@ -379,7 +380,7 @@ int main(int argc, char **argv)
 	    /* treat AGNPS and ANSWERS data like old zero-as-null CELL */
 	    /*   TODO: update models */
 	    if (map_type == 2 || map_type == 3) {
-		if (G_is_null_value(ptr, raster_type))
+		if (Rast_is_null_value(ptr, raster_type))
 		    aspect_c = 0;
 		else
 		    aspect_c = (int)(aspect_f + 0.5);
@@ -393,7 +394,7 @@ int main(int argc, char **argv)
 	    if (map_type == 1) {
 		D_use_color(arrow_color);
 
-		if (G_is_null_value(ptr, raster_type)) {
+		if (Rast_is_null_value(ptr, raster_type)) {
 		    D_use_color(x_color);
 		    draw_x();
 		    D_use_color(arrow_color);
@@ -476,7 +477,7 @@ int main(int argc, char **argv)
 	    else if (map_type == 4) {
 		D_use_color(arrow_color);
 
-		if (G_is_null_value(ptr, raster_type)) {
+		if (Rast_is_null_value(ptr, raster_type)) {
 		    D_use_color(x_color);
 		    draw_x();
 		    D_use_color(arrow_color);
@@ -494,16 +495,16 @@ int main(int argc, char **argv)
 		}
 	    }
 
-	    ptr = G_incr_void_ptr(ptr, G_raster_size(raster_type));
+	    ptr = Rast_incr_void_ptr(ptr, Rast_raster_size(raster_type));
 	    if (opt7->answer)
 		mag_ptr =
-		    G_incr_void_ptr(mag_ptr, G_raster_size(mag_raster_type));
+		    Rast_incr_void_ptr(mag_ptr, Rast_raster_size(mag_raster_type));
 	}
     }
 
-    G_close_cell(layer_fd);
+    Rast_close_cell(layer_fd);
     if (opt7->answer)
-	G_close_cell(mag_fd);
+	Rast_close_cell(mag_fd);
 
     R_close_driver();
 

+ 11 - 10
display/d.rast.num/main.c

@@ -38,6 +38,7 @@
 #include <string.h>
 #include <math.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/display_raster.h>
 #include <grass/display.h>
 #include <grass/colors.h>
@@ -126,12 +127,12 @@ int main(int argc, char **argv)
     else
 	fixed_color = 1;
 
-    layer_fd = G_open_cell_old(map_name, "");
+    layer_fd = Rast_open_cell_old(map_name, "");
     if (layer_fd < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), map_name);
 
     /* determine the inputmap type (CELL/FCELL/DCELL) */
-    inmap_type = G_get_raster_map_type(layer_fd);
+    inmap_type = Rast_get_raster_map_type(layer_fd);
     map_type = DCELL_TYPE;
 
     /* Read in the map window associated with window */
@@ -141,7 +142,7 @@ int main(int argc, char **argv)
     if (align->answer) {
 	struct Cell_head wind;
 
-	if (G_get_cellhd(map_name, "", &wind) < 0)
+	if (Rast_get_cellhd(map_name, "", &wind) < 0)
 	    G_fatal_error(_("Unable to read header of raster map <%s>"), map_name);
 
 	/* expand window extent by one wind resolution */
@@ -216,10 +217,10 @@ int main(int argc, char **argv)
     }
 
     /* allocate the cell array */
-    cell = G_allocate_raster_buf(map_type);
+    cell = Rast_allocate_raster_buf(map_type);
 
     /* read the color table in the color structures of the displayed map */
-    if (G_read_colors(map_name, "", &colors) == -1)
+    if (Rast_read_colors(map_name, "", &colors) == -1)
 	G_fatal_error(_("Color file for <%s> not available"), map_name);
 
     /* fixed text color */
@@ -228,12 +229,12 @@ int main(int argc, char **argv)
 
     /* loop through cells, find value, and draw text for value */
     for (row = 0; row < nrows; row++) {
-	G_get_raster_row(layer_fd, cell, row, map_type);
+	Rast_get_raster_row(layer_fd, cell, row, map_type);
 
 	for (col = 0; col < ncols; col++) {
 
 	    if (fixed_color == 0) {
-		G_get_raster_color(&cell[col], &R, &G, &B, &colors, map_type);
+		Rast_get_raster_color(&cell[col], &R, &G, &B, &colors, map_type);
 		D_RGB_color(R, G, B);
 	    }
 
@@ -241,7 +242,7 @@ int main(int argc, char **argv)
 	}
     }
 
-    G_close_cell(layer_fd);
+    Rast_close_cell(layer_fd);
 
     R_close_driver();
 
@@ -264,13 +265,13 @@ int draw_number(int row, int col, double number, int prec, RASTER_MAP_TYPE map_t
 
     /* maybe ugly, but works */
     if (map_type == CELL_TYPE) {
-	if (!G_is_c_null_value(&cell))
+	if (!Rast_is_c_null_value(&cell))
 	    sprintf(no, "%d", (int)number);
 	else
 	    sprintf(no, "Null");
     }
     else {
-	if (!G_is_d_null_value(&dcell))
+	if (!Rast_is_d_null_value(&dcell))
 	    sprintf(no, "%.*f", prec, number);
 	else
 	    sprintf(no, "Null");

+ 13 - 9
display/d.rast/display.c

@@ -1,10 +1,14 @@
 #include <stdlib.h>
+
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/display_raster.h>
 #include <grass/display.h>
+#include <grass/glocale.h>
+
 #include "mask.h"
 #include "local_proto.h"
-#include <grass/glocale.h>
+
 
 static int cell_draw(const char *, struct Colors *, int, int, RASTER_MAP_TYPE);
 
@@ -15,15 +19,15 @@ int display(const char *name,
     struct Colors colors;
     int r, g, b;
 
-    if (G_read_colors(name, "", &colors) == -1)
+    if (Rast_read_colors(name, "", &colors) == -1)
 	G_fatal_error(_("Color file for <%s> not available"), name);
 
     if (bg) {
-	if (G_str_to_color(bg, &r, &g, &b) != 1) {
+	if (Rast_str_to_color(bg, &r, &g, &b) != 1) {
 	    G_warning(_("[%s]: No such color"), bg);
 	    r = g = b = 255;
 	}
-	G_set_null_value_color(r, g, b, &colors);
+	Rast_set_null_value_color(r, g, b, &colors);
     }
 
     D_setup(0);
@@ -32,7 +36,7 @@ int display(const char *name,
     cell_draw(name, &colors, overlay, invert, data_type);
 
     /* release the colors now */
-    G_free_colors(&colors);
+    Rast_free_colors(&colors);
 
     return 0;
 }
@@ -54,11 +58,11 @@ static int cell_draw(const char *name,
     D_set_overlay_mode(overlay);
 
     /* Make sure map is available */
-    if ((cellfile = G_open_cell_old(name, "")) == -1)
+    if ((cellfile = Rast_open_cell_old(name, "")) == -1)
 	G_fatal_error(_("Unable to open raster map <%s>"), name);
 
     /* Allocate space for cell buffer */
-    xarray = G_allocate_raster_buf(data_type);
+    xarray = Rast_allocate_raster_buf(data_type);
 
     D_cell_draw_begin();
 
@@ -66,7 +70,7 @@ static int cell_draw(const char *name,
     for (cur_A_row = 0; cur_A_row != -1;) {
 	G_percent(cur_A_row, nrows, 2);
 	/* Get window (array) row currently required */
-	G_get_raster_row(cellfile, xarray, cur_A_row, data_type);
+	Rast_get_raster_row(cellfile, xarray, cur_A_row, data_type);
 	mask_raster_array(xarray, ncols, invert, data_type);
 
 	/* Draw the cell row, and get the next row number */
@@ -78,7 +82,7 @@ static int cell_draw(const char *name,
     G_percent(nrows, nrows, 2);
 
     /* Wrap up and return */
-    G_close_cell(cellfile);
+    Rast_close_cell(cellfile);
     G_free(xarray);
     return (0);
 }

+ 2 - 1
display/d.rast/main.c

@@ -20,6 +20,7 @@
  *****************************************************************************/
 #include <stdlib.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/display_raster.h>
 
 #include "mask.h"
@@ -103,7 +104,7 @@ int main(int argc, char **argv)
     if (R_open_driver() != 0)
 	G_fatal_error(_("No graphics device selected"));
 
-    fp = G_raster_map_is_fp(name, "");
+    fp = Rast_raster_map_is_fp(name, "");
     if (catlist->answer) {
 	if (fp)
 	    G_warning(_("Ignoring catlist: map is floating point (please use 'val=')"));

+ 3 - 2
display/d.rast/mask.c

@@ -1,5 +1,6 @@
 #include <stdlib.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include "mask.h"
 #include "local_proto.h"
 
@@ -50,7 +51,7 @@ int mask_cell_array(CELL * cell, int ncols, Mask * mask, int invert)
 	if (mask_select(&x, mask, invert))
 	    *cell++ = x;
 	else
-	    G_set_c_null_value(cell++, 1);
+	    Rast_set_c_null_value(cell++, 1);
     }
     return 0;
 }
@@ -64,7 +65,7 @@ int mask_d_cell_array(DCELL * dcell, int ncols, d_Mask * mask, int invert)
 	if (mask_d_select(&x, mask, invert))
 	    *dcell++ = x;
 	else
-	    G_set_d_null_value(dcell++, 1);
+	    Rast_set_d_null_value(dcell++, 1);
     }
     return 0;
 }

+ 7 - 6
display/d.rgb/main.c

@@ -21,6 +21,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/display.h>
 #include <grass/display_raster.h>
 #include <grass/glocale.h>
@@ -89,16 +90,16 @@ int main(int argc, char **argv)
 	char *name = B[i].opt->answer;
 
 	/* Make sure map is available */
-	if ((B[i].file = G_open_cell_old(name, "")) == -1)
+	if ((B[i].file = Rast_open_cell_old(name, "")) == -1)
 	    G_fatal_error(_("Unable to open raster map <%s>"), name);
 
-	B[i].type = G_get_raster_map_type(B[i].file);
+	B[i].type = Rast_get_raster_map_type(B[i].file);
 
 	/* Reading color lookup table */
-	if (G_read_colors(name, "", &B[i].colors) == -1)
+	if (Rast_read_colors(name, "", &B[i].colors) == -1)
 	    G_fatal_error(_("Color file for <%s> not available"), name);
 
-	B[i].array = G_allocate_raster_buf(B[i].type);
+	B[i].array = Rast_allocate_raster_buf(B[i].type);
     }
 
     /* read in current window */
@@ -111,7 +112,7 @@ int main(int argc, char **argv)
 	G_percent(row, window.rows, 5);
 
 	for (i = 0; i < 3; i++)
-	    if (G_get_raster_row(B[i].file, B[i].array, row, B[i].type) < 0)
+	    if (Rast_get_raster_row(B[i].file, B[i].array, row, B[i].type) < 0)
 		G_fatal_error(_("Error reading row of data"));
 
 	if (row == next_row)
@@ -132,7 +133,7 @@ int main(int argc, char **argv)
 
     /* Close the raster maps */
     for (i = 0; i < 3; i++)
-	G_close_cell(B[i].file);
+	Rast_close_cell(B[i].file);
 
     exit(EXIT_SUCCESS);
 }

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

@@ -4,6 +4,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/Vect.h>
 #include <grass/display.h>
 #include <grass/display_raster.h>

+ 3 - 2
display/d.thematic.area/main.c

@@ -19,6 +19,7 @@
 #include <dirent.h>
 #include <grass/config.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/display_raster.h>
 #include <grass/display.h>
 #include <grass/Vect.h>
@@ -272,7 +273,7 @@ int main(int argc, char **argv)
 
     /*get border line color */
     bcolor = G_standard_color_rgb(WHITE);
-    ret = G_str_to_color(bcolor_opt->answer, &r, &g, &b);
+    ret = Rast_str_to_color(bcolor_opt->answer, &r, &g, &b);
     if (ret == 1) {
 	has_color = 1;
 	bcolor.r = r;
@@ -347,7 +348,7 @@ int main(int argc, char **argv)
 		G_fatal_error(_("Not enough colors or error in color specifications.\nNeed %i colors."),
 			      nclass);
 
-	    ret = G_str_to_color(colors_opt->answers[i], &r, &g, &b);
+	    ret = Rast_str_to_color(colors_opt->answers[i], &r, &g, &b);
 	    if (!ret)
 		G_fatal_error(_("Error interpreting color %s"),
 			      colors_opt->answers[i]);

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

@@ -2,6 +2,7 @@
 
 #include <string.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/Vect.h>
 #include <grass/display.h>
 #include <grass/display_raster.h>
@@ -267,7 +268,7 @@ int plot1(struct Map_info *Map, int type, int area, struct cat_list *Clist,
 			G_debug(3, "element %d: colorstring: %s", line,
 				colorstring);
 
-			if (G_str_to_color(colorstring, &red, &grn, &blu) ==
+			if (Rast_str_to_color(colorstring, &red, &grn, &blu) ==
 			    1) {
 			    custom_rgb = TRUE;
 			    G_debug(3, "element:%d  cat %d r:%d g:%d b:%d",

+ 1 - 0
display/d.title/fancy.c

@@ -1,4 +1,5 @@
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include "options.h"
 
 void fancy(struct Cell_head *window, struct Categories *cats, FILE * fp)

+ 3 - 2
display/d.title/main.c

@@ -21,6 +21,7 @@
 #include <grass/display.h>
 #include <grass/display_raster.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/glocale.h>
 
 #include "options.h"
@@ -103,11 +104,11 @@ int main(int argc, char **argv)
     if (!strlen(map_name))
 	G_fatal_error(_("No map name given"));
 
-    if (G_get_cellhd(map_name, "", &window) == -1)
+    if (Rast_get_cellhd(map_name, "", &window) == -1)
 	G_fatal_error(_("Unable to read header of raster map <%s>"),
 		      map_name);
 
-    if (G_read_cats(map_name, "", &cats) == -1)
+    if (Rast_read_cats(map_name, "", &cats) == -1)
 	G_fatal_error(_("Unable to read category file of raster map <%s>"),
 		      map_name);
 

+ 1 - 0
display/d.title/normal.c

@@ -1,4 +1,5 @@
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include "options.h"
 #include "local_proto.h"
 

+ 1 - 0
display/d.vect.chart/bar.c

@@ -1,4 +1,5 @@
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/Vect.h>
 #include <grass/dbmi.h>
 #include <grass/display.h>

+ 3 - 2
display/d.vect.chart/main.c

@@ -18,6 +18,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/display_raster.h>
 #include <grass/display.h>
 #include <grass/Vect.h>
@@ -170,7 +171,7 @@ int main(int argc, char **argv)
     field = atoi(field_opt->answer);
 
     /* Outline color */
-    ret = G_str_to_color(ocolor_opt->answer, &r, &g, &b);
+    ret = Rast_str_to_color(ocolor_opt->answer, &r, &g, &b);
     if (ret == 1) {
 	ocolor.none = 0;
 	ocolor.r = r;
@@ -214,7 +215,7 @@ int main(int argc, char **argv)
 	    if (colors_opt->answers[i] == NULL)
 		break;
 
-	    ret = G_str_to_color(colors_opt->answers[i], &r, &g, &b);
+	    ret = Rast_str_to_color(colors_opt->answers[i], &r, &g, &b);
 	    if (ret == 1) {
 		colors[i].none = 0;
 		colors[i].r = r;

+ 1 - 0
display/d.vect.chart/pie.c

@@ -1,5 +1,6 @@
 #include <math.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/Vect.h>
 #include <grass/dbmi.h>
 #include <grass/display.h>

+ 1 - 0
display/d.vect.chart/plot.c

@@ -1,4 +1,5 @@
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/Vect.h>
 #include <grass/dbmi.h>
 #include <grass/display.h>

+ 4 - 3
display/d.vect/area.c

@@ -4,6 +4,7 @@
  */
 #include <string.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/Vect.h>
 #include <grass/display.h>
 #include <grass/display_raster.h>
@@ -242,8 +243,8 @@ int darea(struct Map_info *Map, struct cat_list *Clist,
 		    area, centroid, cat, Points->x[0], Points->y[0],
 		    Points->z[0]);
 	    rgb = 1;
-	    G_make_fp_colors(&colors, style, box.B, box.T);
-	    G_get_raster_color(&zval, &red, &grn, &blu, &colors, DCELL_TYPE);
+	    Rast_make_fp_colors(&colors, style, box.B, box.T);
+	    Rast_get_raster_color(&zval, &red, &grn, &blu, &colors, DCELL_TYPE);
 	    G_debug(3, "b %d, g: %d, r %d", blu, grn, red);
 	}
 
@@ -267,7 +268,7 @@ int darea(struct Map_info *Map, struct cat_list *Clist,
 			G_debug(3, "area %d: colorstring: %s", area,
 				colorstring);
 
-			if (G_str_to_color(colorstring, &red, &grn, &blu) ==
+			if (Rast_str_to_color(colorstring, &red, &grn, &blu) ==
 			    1) {
 			    rgb = 1;
 			    G_debug(3, "area:%d  cat %d r:%d g:%d b:%d", area,

+ 1 - 0
display/d.vect/attr.c

@@ -1,5 +1,6 @@
 #include <string.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/Vect.h>
 #include <grass/display.h>
 #include <grass/display_raster.h>

+ 1 - 0
display/d.vect/dir.c

@@ -1,4 +1,5 @@
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/Vect.h>
 #include <grass/display.h>
 #include <grass/display_raster.h>

+ 1 - 0
display/d.vect/label.c

@@ -1,4 +1,5 @@
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/Vect.h>
 #include <grass/display.h>
 #include <grass/display_raster.h>

+ 6 - 5
display/d.vect/main.c

@@ -18,6 +18,7 @@
 #include <sys/types.h>
 #include <dirent.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/display_raster.h>
 #include <grass/display.h>
 #include <grass/Vect.h>
@@ -392,7 +393,7 @@ int main(int argc, char **argv)
     }
 
     color = G_standard_color_rgb(WHITE);
-    ret = G_str_to_color(color_opt->answer, &r, &g, &b);
+    ret = Rast_str_to_color(color_opt->answer, &r, &g, &b);
     if (ret == 1) {
 	has_color = 1;
 	color.r = r;
@@ -407,7 +408,7 @@ int main(int argc, char **argv)
     }
 
     fcolor = G_standard_color_rgb(WHITE);
-    ret = G_str_to_color(fcolor_opt->answer, &r, &g, &b);
+    ret = Rast_str_to_color(fcolor_opt->answer, &r, &g, &b);
     if (ret == 1) {
 	has_fcolor = 1;
 	fcolor.r = r;
@@ -532,20 +533,20 @@ int main(int argc, char **argv)
 	lattr.field = Clist->field;
 
     lattr.color.R = lattr.color.G = lattr.color.B = 255;
-    if (G_str_to_color(lcolor_opt->answer, &r, &g, &b)) {
+    if (Rast_str_to_color(lcolor_opt->answer, &r, &g, &b)) {
 	lattr.color.R = r;
 	lattr.color.G = g;
 	lattr.color.B = b;
     }
     lattr.has_bgcolor = 0;
-    if (G_str_to_color(bgcolor_opt->answer, &r, &g, &b) == 1) {
+    if (Rast_str_to_color(bgcolor_opt->answer, &r, &g, &b) == 1) {
 	lattr.has_bgcolor = 1;
 	lattr.bgcolor.R = r;
 	lattr.bgcolor.G = g;
 	lattr.bgcolor.B = b;
     }
     lattr.has_bcolor = 0;
-    if (G_str_to_color(bcolor_opt->answer, &r, &g, &b) == 1) {
+    if (Rast_str_to_color(bcolor_opt->answer, &r, &g, &b) == 1) {
 	lattr.has_bcolor = 1;
 	lattr.bcolor.R = r;
 	lattr.bcolor.G = g;

+ 4 - 3
display/d.vect/plot1.c

@@ -2,6 +2,7 @@
 
 #include <string.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/Vect.h>
 #include <grass/display.h>
 #include <grass/display_raster.h>
@@ -257,8 +258,8 @@ int plot1(struct Map_info *Map, int type, int area, struct cat_list *Clist,
 	    G_debug(3, "display line %d, cat %d, x: %f, y: %f, z: %f", line,
 		    cat, Points->x[0], Points->y[0], Points->z[0]);
 	    custom_rgb = TRUE;
-	    G_make_fp_colors(&colors, style, box.B, box.T);
-	    G_get_raster_color(&zval, &red, &grn, &blu, &colors, DCELL_TYPE);
+	    Rast_make_fp_colors(&colors, style, box.B, box.T);
+	    Rast_get_raster_color(&zval, &red, &grn, &blu, &colors, DCELL_TYPE);
 	    G_debug(3, "b %d, g: %d, r %d", blu, grn, red);
 	}
 
@@ -284,7 +285,7 @@ int plot1(struct Map_info *Map, int type, int area, struct cat_list *Clist,
 			G_debug(3, "element %d: colorstring: %s", line,
 				colorstring);
 
-			if (G_str_to_color(colorstring, &red, &grn, &blu) ==
+			if (Rast_str_to_color(colorstring, &red, &grn, &blu) ==
 			    1) {
 			    custom_rgb = TRUE;
 			    G_debug(3, "element:%d  cat %d r:%d g:%d b:%d",

+ 1 - 0
display/d.vect/topo.c

@@ -1,4 +1,5 @@
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/Vect.h>
 #include <grass/display.h>
 #include <grass/display_raster.h>

+ 1 - 0
display/d.vect/utils.c

@@ -1,4 +1,5 @@
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/Vect.h>
 #include <grass/display.h>
 #include <grass/display_raster.h>

+ 1 - 0
display/d.vect/zcoor.c

@@ -1,6 +1,7 @@
 /* Print z coordinate value for each node */
 
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/Vect.h>
 #include <grass/display.h>
 #include <grass/display_raster.h>

+ 1 - 1
display/d.what.rast/main.c

@@ -123,7 +123,7 @@ int main(int argc, char **argv)
 	    if (j > mwidth)
 		mwidth = j;
 
-	    if (G_read_cats(name[i], mapset[i], &cats[i]) < 0)
+	    if (Rast_read_cats(name[i], mapset[i], &cats[i]) < 0)
 		cats[i].ncats = -1;
 	}
     }

+ 1 - 1
display/d.what.rast/opencell.c

@@ -19,7 +19,7 @@ int opencell(char *fullname, char *name, char *mapset)
     else
 	strcpy(mapset, m);
 
-    fd = G_open_cell_old(name, mapset);
+    fd = Rast_open_cell_old(name, mapset);
     if (fd < 0)
 	G_warning(_("Unable to open raster map <%s>"), name);
 

+ 5 - 5
display/d.what.rast/show.c

@@ -19,7 +19,7 @@ int show_cat(int width, int mwidth,
 	sprintf(buf, " ");
     if (terse) {
 	fname = G_fully_qualified_name(name, mapset);
-	if (G_is_c_null_value(&cell_val)) {
+	if (Rast_is_c_null_value(&cell_val)) {
 	    if (!isatty(fileno(stdout)))
 		fprintf(stdout, "%s%s%sNull%s%s\n", fname, buf, fs, fs,
 			label);
@@ -33,7 +33,7 @@ int show_cat(int width, int mwidth,
 	}
     }
     else {
-	if (G_is_c_null_value(&cell_val)) {
+	if (Rast_is_c_null_value(&cell_val)) {
 	    if (!isatty(fileno(stdout)))
 		fprintf(stdout, "%*s in %-*s%s (Null)%s\n", width, name,
 			mwidth, mapset, buf, label);
@@ -63,7 +63,7 @@ int show_dval(int width, int mwidth,
     dcell_val = dval;
     if (terse) {
 	fname = G_fully_qualified_name(name, mapset);
-	if (G_is_d_null_value(&dcell_val)) {
+	if (Rast_is_d_null_value(&dcell_val)) {
 	    if (!isatty(fileno(stdout)))
 		fprintf(stdout, "%s, actual %sNull%s%s\n", fname, fs, fs,
 			label);
@@ -78,7 +78,7 @@ int show_dval(int width, int mwidth,
 	}
     }
     else {
-	if (G_is_d_null_value(&dcell_val)) {
+	if (Rast_is_d_null_value(&dcell_val)) {
 	    if (!isatty(fileno(stdout)))
 		fprintf(stdout, "%*s in %-*s, actual  (Null)%s\n", width,
 			name, mwidth, mapset, label);
@@ -120,7 +120,7 @@ int show_utm(char *name, char *mapset, double north, double east,
     if (once) {
 	/* speed up? */
 	once = 0;
-	G_get_cellhd(name, mapset, &cellhd);
+	Rast_get_cellhd(name, mapset, &cellhd);
     }
 
     n_row = (int)((cellhd.north - north) / window->ns_res);

+ 9 - 9
display/d.what.rast/what.c

@@ -23,14 +23,14 @@ int what(int once, int terse, int colrow, char *fs, int width, int mwidth)
     G_get_set_window(&window);
     nrows = window.rows;
     ncols = window.cols;
-    buf = G_allocate_c_raster_buf();
-    dbuf = G_allocate_d_raster_buf();
+    buf = Rast_allocate_c_raster_buf();
+    dbuf = Rast_allocate_d_raster_buf();
 
     screen_x = ((int)D_get_d_west() + (int)D_get_d_east()) / 2;
     screen_y = ((int)D_get_d_north() + (int)D_get_d_south()) / 2;
 
     for (i = 0; i < nrasts; i++)
-	map_type[i] = G_get_raster_map_type(fd[i]);
+	map_type[i] = Rast_get_raster_map_type(fd[i]);
 
     do {
 	if (!terse)
@@ -50,19 +50,19 @@ int what(int once, int terse, int colrow, char *fs, int width, int mwidth)
 
 	show_utm(name[0], mapset[0], north, east, &window, terse, colrow,
 		 button, fs);
-	G_set_c_null_value(&null_cell, 1);
-	G_set_d_null_value(&null_dcell, 1);
+	Rast_set_c_null_value(&null_cell, 1);
+	Rast_set_d_null_value(&null_dcell, 1);
 	for (i = 0; i < nrasts; i++) {
 	    if (row < 0 || row >= nrows || col < 0 || col >= ncols) {
 		G_message(_("You are clicking outside the map"));
 		continue;
 	    }
-	    if (G_get_c_raster_row(fd[i], buf, row) < 0)
+	    if (Rast_get_c_raster_row(fd[i], buf, row) < 0)
 		show_cat(width, mwidth, name[i], mapset[i], null_cell,
 			 "ERROR reading raster map", terse, fs, map_type[i]);
 	    else if (map_type[i] == CELL_TYPE) {
 		show_cat(width, mwidth, name[i], mapset[i], buf[col],
-			 G_get_c_raster_cat(&buf[col], &cats[i]), terse, fs,
+			 Rast_get_c_raster_cat(&buf[col], &cats[i]), terse, fs,
 			 map_type[i]);
 		continue;
 	    }
@@ -75,12 +75,12 @@ int what(int once, int terse, int colrow, char *fs, int width, int mwidth)
 	    if (map_type[i] == CELL_TYPE)
 		continue;
 
-	    if (G_get_d_raster_row(fd[i], dbuf, row) < 0)
+	    if (Rast_get_d_raster_row(fd[i], dbuf, row) < 0)
 		show_dval(width, mwidth, name[i], mapset[i], null_dcell,
 			  "ERROR reading fcell file", terse, fs);
 	    else
 		show_dval(width, mwidth, name[i], mapset[i], dbuf[col],
-			  G_get_d_raster_cat(&dbuf[col], &cats[i]), terse,
+			  Rast_get_d_raster_cat(&dbuf[col], &cats[i]), terse,
 			  fs);
 	}
     }

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

@@ -138,7 +138,7 @@ int main(int argc, char **argv)
 	nrasts = i;
 
 	for (i = 0; i < nrasts; i++) {
-	    if (G_get_cellhd(rast[i], "", &window) >= 0) {
+	    if (Rast_get_cellhd(rast[i], "", &window) >= 0) {
 		if (first) {
 		    first = 0;
 		    U_east = window.east;

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

@@ -176,7 +176,7 @@ int set_win(struct Cell_head *window, double ux1, double uy1, double ux2,
 
 	limit = print_limit(window, &defwin);
 
-	G_adjust_Cell_head3(window, 0, 0, 0);
+	Rast_adjust_Cell_head3(window, 0, 0, 0);
 	G_put_window(window);
 	G_set_window(window);
 	redraw();

+ 14 - 14
doc/raster/r.example/main.c

@@ -111,29 +111,29 @@ int main(int argc, char *argv[])
 	G_fatal_error(_("Raster map <%s> not found"), name);
 
     /* determine the inputmap type (CELL/FCELL/DCELL) */
-    data_type = G_raster_map_type(name, mapset);
+    data_type = Rast_raster_map_type(name, mapset);
 
-    /* G_open_cell_old - returns file destriptor (>0) */
-    if ((infd = G_open_cell_old(name, mapset)) < 0)
+    /* Rast_open_cell_old - returns file destriptor (>0) */
+    if ((infd = Rast_open_cell_old(name, mapset)) < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), name);
 
 
     /* controlling, if we can open input raster */
-    if (G_get_cellhd(name, mapset, &cellhd) < 0)
+    if (Rast_get_cellhd(name, mapset, &cellhd) < 0)
 	G_fatal_error(_("Unable to read file header of <%s>"), name);
 
     G_debug(3, "number of rows %d", cellhd.rows);
 
     /* Allocate input buffer */
-    inrast = G_allocate_raster_buf(data_type);
+    inrast = Rast_allocate_raster_buf(data_type);
 
     /* Allocate output buffer, use input map data_type */
     nrows = G_window_rows();
     ncols = G_window_cols();
-    outrast = G_allocate_raster_buf(data_type);
+    outrast = Rast_allocate_raster_buf(data_type);
 
     /* controlling, if we can write the raster */
-    if ((outfd = G_open_raster_new(result, data_type)) < 0)
+    if ((outfd = Rast_open_raster_new(result, data_type)) < 0)
 	G_fatal_error(_("Unable to create raster map <%s>"), result);
 
     /* for each row */
@@ -146,7 +146,7 @@ int main(int argc, char *argv[])
 	    G_percent(row, nrows, 2);
 
 	/* read input map */
-	if (G_get_raster_row(infd, inrast, row, data_type) < 0)
+	if (Rast_get_raster_row(infd, inrast, row, data_type) < 0)
 	    G_fatal_error(_("Unable to read raster map <%s> row %d"), name,
 			  row);
 
@@ -173,7 +173,7 @@ int main(int argc, char *argv[])
 	}
 
 	/* write raster row to output raster map */
-	if (G_put_raster_row(outfd, outrast, data_type) < 0)
+	if (Rast_put_raster_row(outfd, outrast, data_type) < 0)
 	    G_fatal_error(_("Failed writing raster map <%s>"), result);
     }
 
@@ -182,13 +182,13 @@ int main(int argc, char *argv[])
     G_free(outrast);
 
     /* closing raster maps */
-    G_close_cell(infd);
-    G_close_cell(outfd);
+    Rast_close_cell(infd);
+    Rast_close_cell(outfd);
 
     /* add command line incantation to history file */
-    G_short_history(result, "raster", &history);
-    G_command_history(&history);
-    G_write_history(result, &history);
+    Rast_short_history(result, "raster", &history);
+    Rast_command_history(&history);
+    Rast_write_history(result, &history);
 
 
     exit(EXIT_SUCCESS);

+ 6 - 3
general/g.mremove/check_reclass.c

@@ -1,4 +1,7 @@
 #include <string.h>
+
+#include <grass/Rast.h>
+
 #include "global.h"
 
 int check_reclass(const char *name, const char *mapset, int force)
@@ -7,7 +10,7 @@ int check_reclass(const char *name, const char *mapset, int force)
     char **rmaps;
     int nrmaps;
 
-    if (G_is_reclassed_to(name, mapset, &nrmaps, &rmaps) > 0) {
+    if (Rast_is_reclassed_to(name, mapset, &nrmaps, &rmaps) > 0) {
 	for (; *rmaps; rmaps++) {
 	    /* force remove */
 	    if (force)
@@ -23,8 +26,8 @@ int check_reclass(const char *name, const char *mapset, int force)
 	    return 1;
     }
 
-    if (G_is_reclass(name, mapset, rname, rmapset) > 0 &&
-	G_is_reclassed_to(rname, rmapset, &nrmaps, &rmaps) > 0) {
+    if (Rast_is_reclass(name, mapset, rname, rmapset) > 0 &&
+	Rast_is_reclassed_to(rname, rmapset, &nrmaps, &rmaps) > 0) {
 	char path[GPATH_MAX];
 	char *p = strchr(rname, '@');
 	char *qname = G_fully_qualified_name(name, mapset);

+ 1 - 0
general/g.mremove/wc2regex.c

@@ -1,4 +1,5 @@
 #include <grass/gis.h>
+#include <grass/Rast.h>
 
 char *wc2regex(const char *wc)
 {

+ 2 - 1
general/g.region/adjust.c

@@ -1,10 +1,11 @@
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/glocale.h>
 #include "local_proto.h"
 
 void adjust_window(struct Cell_head *window, int row_flag, int col_flag, int depth_flag)
 {
-    const char *err = G_adjust_Cell_head3(window, row_flag, col_flag, depth_flag);
+    const char *err = Rast_adjust_Cell_head3(window, row_flag, col_flag, depth_flag);
 
     if (err)
 	G_fatal_error(_("Invalid region: %s"), err);

+ 4 - 3
general/g.region/main.c

@@ -16,6 +16,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/G3d.h>
 #include <grass/Vect.h>
 #include <grass/glocale.h>
@@ -441,7 +442,7 @@ int main(int argc, char *argv[])
 	    mapset = G_find_cell2(rast_name, "");
 	    if (!mapset)
 		G_fatal_error(_("Raster map <%s> not found"), rast_name);
-	    if (G_get_cellhd(rast_name, mapset, &temp_window) < 0)
+	    if (Rast_get_cellhd(rast_name, mapset, &temp_window) < 0)
 		G_fatal_error(_("Unable to read header of raster map <%s@%s>"),
 			      rast_name, mapset);
 	    if (!first) {
@@ -459,7 +460,7 @@ int main(int argc, char *argv[])
 		    window.west : temp_window.west;
 	    }
 	}
-	G_adjust_Cell_head3(&window, 0, 0, 0);
+	Rast_adjust_Cell_head3(&window, 0, 0, 0);
     }
 
 
@@ -775,7 +776,7 @@ int main(int argc, char *argv[])
 	mapset = G_find_cell2(name, "");
 	if (!mapset)
 	    G_fatal_error(_("Raster map <%s> not found"), name);
-	if (G_get_cellhd(name, mapset, &temp_window) < 0)
+	if (Rast_get_cellhd(name, mapset, &temp_window) < 0)
 	    G_fatal_error(_("Unable to read header of raster map <%s@%s>"),
 			  name, mapset);
 	if ((err = G_align_window(&window, &temp_window)))

+ 1 - 0
general/g.region/printwindow.c

@@ -2,6 +2,7 @@
 #include <stdlib.h>
 #include <projects.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/gprojects.h>
 #include <grass/glocale.h>
 #include "local_proto.h"

+ 10 - 9
general/g.region/zoom.c

@@ -1,5 +1,6 @@
 #include <stdlib.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/glocale.h>
 #include "local_proto.h"
 
@@ -18,12 +19,12 @@ int zoom(struct Cell_head *window, const char *name, const char *mapset)
     nrows = window->rows;
     ncols = window->cols;
 
-    fd = G_open_cell_old(name, mapset);
+    fd = Rast_open_cell_old(name, mapset);
     if (fd < 0)
 	G_fatal_error(_("Unable to open raster map <%s> in <%s>"),
 		      name, mapset);
-    map_type = G_get_raster_map_type(fd);
-    raster = G_allocate_raster_buf(map_type);
+    map_type = Rast_get_raster_map_type(fd);
+    raster = Rast_allocate_raster_buf(map_type);
 
     /* find first non-null row */
     top = nrows;
@@ -31,12 +32,12 @@ int zoom(struct Cell_head *window, const char *name, const char *mapset)
     left = ncols;
     right = -1;
     for (row = 0; row < nrows; row++) {
-	if (G_get_raster_row(fd, rast_ptr = raster, row, map_type) < 0)
+	if (Rast_get_raster_row(fd, rast_ptr = raster, row, map_type) < 0)
 	    G_fatal_error(_("Could not read from <%s>"), name);
 	for (col = 0; col < ncols; col++) {
-	    if (!G_is_null_value(rast_ptr, map_type))
+	    if (!Rast_is_null_value(rast_ptr, map_type))
 		break;
-	    rast_ptr = G_incr_void_ptr(rast_ptr, G_raster_size(map_type));
+	    rast_ptr = Rast_incr_void_ptr(rast_ptr, Rast_raster_size(map_type));
 	}
 	if (col == ncols)
 	    continue;
@@ -47,14 +48,14 @@ int zoom(struct Cell_head *window, const char *name, const char *mapset)
 	if (col < left)
 	    left = col;
 	for (mark = col; col < ncols; col++) {
-	    if (!G_is_null_value(rast_ptr, map_type))
+	    if (!Rast_is_null_value(rast_ptr, map_type))
 		mark = col;
-	    rast_ptr = G_incr_void_ptr(rast_ptr, G_raster_size(map_type));
+	    rast_ptr = Rast_incr_void_ptr(rast_ptr, Rast_raster_size(map_type));
 	}
 	if (mark > right)
 	    right = mark;
     }
-    G_close_cell(fd);
+    Rast_close_cell(fd);
     G_free(raster);
 
     /* no data everywhere? */

+ 5 - 3
general/g.remove/main.c

@@ -20,6 +20,8 @@
  *****************************************************************************/
 #include <stdlib.h>
 #include <string.h>
+
+#include <grass/Rast.h>
 #include <grass/glocale.h>
 #include <grass/list.h>
 
@@ -29,7 +31,7 @@ static int check_reclass(const char *name, const char *mapset, int force)
     char **rmaps;
     int nrmaps;
 
-    if (G_is_reclassed_to(name, mapset, &nrmaps, &rmaps) > 0) {
+    if (Rast_is_reclassed_to(name, mapset, &nrmaps, &rmaps) > 0) {
 	for (; *rmaps; rmaps++) {
 	    /* force remove */
 	    if (force)
@@ -44,8 +46,8 @@ static int check_reclass(const char *name, const char *mapset, int force)
 	    return 1;
     }
 
-    if (G_is_reclass(name, mapset, rname, rmapset) > 0 &&
-	G_is_reclassed_to(rname, rmapset, &nrmaps, &rmaps) > 0) {
+    if (Rast_is_reclass(name, mapset, rname, rmapset) > 0 &&
+	Rast_is_reclassed_to(rname, rmapset, &nrmaps, &rmaps) > 0) {
 	char path[GPATH_MAX];
 	char *p = strchr(rname, '@');
 	char *qname = G_fully_qualified_name(name, mapset);

+ 2 - 1
general/g.rename/main.c

@@ -20,6 +20,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/glocale.h>
 #include <grass/list.h>
 
@@ -93,7 +94,7 @@ int main(int argc, char *argv[])
 		continue;
 	    }
 
-	    if (G_is_reclassed_to(old, mapset, &nrmaps, &rmaps) > 0) {
+	    if (Rast_is_reclassed_to(old, mapset, &nrmaps, &rmaps) > 0) {
 		int ptr, l;
 		char buf1[256], buf2[256], buf3[256], *str;
 		FILE *fp;

+ 2 - 1
general/manage/lister/cell.c

@@ -1,6 +1,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 
 int main(int argc, char *argv[])
 {
@@ -16,7 +17,7 @@ int lister(char *name, char *mapset, char *title)
 {
     *title = 0;
     if (*name)
-	strcpy(title, G_get_cell_title(name, mapset));
+	strcpy(title, Rast_get_cell_title(name, mapset));
 
     return 0;
 }

+ 1 - 0
general/manage/lister/vector.c

@@ -1,6 +1,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/Vect.h>
 
 int main(int argc, char *argv[])

+ 19 - 18
imagery/i.albedo/main.c

@@ -18,6 +18,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/glocale.h>
 
 #define MAXFILES 8
@@ -146,19 +147,19 @@ int main(int argc, char *argv[])
 	    G_fatal_error(_("Too many input maps. Only %d allowed."), MAXFILES);
 	name = *ptr;
 	
-	infd[nfiles] = G_open_cell_old(name, "");
+	infd[nfiles] = Rast_open_cell_old(name, "");
 	if (infd[nfiles] < 0)
 	    continue;
 
 	/* Allocate input buffer */
-	in_data_type[nfiles] = G_raster_map_type(name, "");
-	if ((infd[nfiles] = G_open_cell_old(name, "")) < 0)
+	in_data_type[nfiles] = Rast_raster_map_type(name, "");
+	if ((infd[nfiles] = Rast_open_cell_old(name, "")) < 0)
 	    G_fatal_error(_("Unable to open raster map <%s>"), name);
 
-	if ((G_get_cellhd(name, "", &cellhd)) < 0)
+	if ((Rast_get_cellhd(name, "", &cellhd)) < 0)
 	    G_fatal_error(_("Unable to read header of raster map <%s>"), name);
 
-	inrast[nfiles] = G_allocate_raster_buf(in_data_type[nfiles]);
+	inrast[nfiles] = Rast_allocate_raster_buf(in_data_type[nfiles]);
 	nfiles++;
     }
     nfiles--;
@@ -168,10 +169,10 @@ int main(int argc, char *argv[])
     /* Allocate output buffer, use input map data_type */
     nrows = G_window_rows();
     ncols = G_window_cols();
-    outrast = G_allocate_raster_buf(out_data_type);
+    outrast = Rast_allocate_raster_buf(out_data_type);
 
     /* Create New raster files */
-    if ((outfd = G_open_raster_new(result, 1)) < 0)
+    if ((outfd = Rast_open_raster_new(result, 1)) < 0)
 	G_fatal_error(_("Unable to create raster map <%s>"), result);
 
     /*START ALBEDO HISTOGRAM STRETCH */
@@ -189,7 +190,7 @@ int main(int argc, char *argv[])
 	    G_percent(row, nrows, 2);
 	    /* read input map */
 	    for (i = 1; i <= nfiles; i++) {
-		if ((G_get_raster_row(
+		if ((Rast_get_raster_row(
 			 infd[i], inrast[i], row, in_data_type[i])) < 0)
 		    G_fatal_error(_("Unable to read raster map <%s> row %d >"),
 				  name, row);
@@ -222,7 +223,7 @@ int main(int argc, char *argv[])
 		else if (aster) {
 		    de = bb_alb_aster(d[1], d[2], d[3], d[4], d[5], d[6]);
 		}
-		if (G_is_d_null_value(&de)) {
+		if (Rast_is_d_null_value(&de)) {
 		    /*Do nothing */
 		}
 		else {
@@ -347,7 +348,7 @@ int main(int argc, char *argv[])
 	G_percent(row, nrows, 2);
 	/* read input map */
 	for (i = 1; i <= nfiles; i++) {
-	    if ((G_get_raster_row(
+	    if ((Rast_get_raster_row(
 		     infd[i], inrast[i], row, in_data_type[i])) < 0)
 		G_fatal_error(_("Unable to read raster map <%s> row %d"),
 			      name, row);
@@ -385,24 +386,24 @@ int main(int argc, char *argv[])
 	    }
 	    ((DCELL *) outrast)[col] = de;
 	}
-	if (G_put_raster_row(outfd, outrast, out_data_type) < 0)
+	if (Rast_put_raster_row(outfd, outrast, out_data_type) < 0)
 	    G_fatal_error(_("Failed writing raster map <%s> row %d"),
 			  result, row);
     }
     for (i = 1; i <= nfiles; i++) {
 	G_free(inrast[i]);
-	G_close_cell(infd[i]);
+	Rast_close_cell(infd[i]);
     }
     G_free(outrast);
-    G_close_cell(outfd);
+    Rast_close_cell(outfd);
 
     /* Color table from 0.0 to 1.0 */
-    G_init_colors(&colors);
-    G_add_color_rule(0.0, 0, 0, 0, 1.0, 255, 255, 255, &colors);
+    Rast_init_colors(&colors);
+    Rast_add_color_rule(0.0, 0, 0, 0, 1.0, 255, 255, 255, &colors);
     /* Metadata */
-    G_short_history(result, "raster", &history);
-    G_command_history(&history);
-    G_write_history(result, &history);
+    Rast_short_history(result, "raster", &history);
+    Rast_command_history(&history);
+    Rast_write_history(result, &history);
 
     exit(EXIT_SUCCESS);
 }

+ 30 - 29
imagery/i.atcorr/main.cpp

@@ -37,6 +37,7 @@ TODO: use dynamic allocation for TiCache
 
 extern "C" {
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/glocale.h>
 }
 
@@ -95,7 +96,7 @@ static void adjust_region (char *name, const char *mapset)
 {
     struct Cell_head iimg_head;	/* the input image header file */
 
-    if(G_get_cellhd(name, mapset, &iimg_head) < 0) 
+    if(Rast_get_cellhd(name, mapset, &iimg_head) < 0) 
 	G_fatal_error (_("Unable to read header of raster map <%s>"),
 		       G_fully_qualified_name(name, mapset));
 
@@ -120,10 +121,10 @@ static void write_fp_to_cell (int ofd, FCELL* buf)
     CELL* cbuf;
     int col;
 
-    cbuf = (CELL*)G_allocate_raster_buf(CELL_TYPE);
+    cbuf = (CELL*)Rast_allocate_raster_buf(CELL_TYPE);
 
     for(col = 0; col < G_window_cols(); col++) cbuf[col] = round_c(buf[col]);
-    G_put_raster_row(ofd, cbuf, CELL_TYPE);
+    Rast_put_raster_row(ofd, cbuf, CELL_TYPE);
 }
 
 
@@ -292,9 +293,9 @@ static void process_raster (int ifd, InputMask imask, ScaleRange iscale,
     TICache ticache;    /* use this to increase computation speed when an elevation map with categories are given */
 	
     /* allocate memory for buffers */
-    buf = (FCELL*)G_allocate_raster_buf(FCELL_TYPE);
-    if(ialt_fd >= 0) alt = (FCELL*)G_allocate_raster_buf(FCELL_TYPE);
-    if(ivis_fd >= 0) vis = (FCELL*)G_allocate_raster_buf(FCELL_TYPE);
+    buf = (FCELL*)Rast_allocate_raster_buf(FCELL_TYPE);
+    if(ialt_fd >= 0) alt = (FCELL*)Rast_allocate_raster_buf(FCELL_TYPE);
+    if(ivis_fd >= 0) vis = (FCELL*)Rast_allocate_raster_buf(FCELL_TYPE);
 
     G_verbose_message(_("Percent complete..."));
     nrows = G_window_rows();
@@ -305,30 +306,30 @@ static void process_raster (int ifd, InputMask imask, ScaleRange iscale,
 	G_percent(row, nrows, 1);     /* keep the user informed of our progress */
 		
         /* read the next row */
-	if(G_get_raster_row(ifd, buf, row, FCELL_TYPE) < 0)
+	if(Rast_get_raster_row(ifd, buf, row, FCELL_TYPE) < 0)
 	    G_fatal_error (_("Unable to read input raster map row %d"),
 			     row);
 
         /* read the next row of elevation values */
         if(ialt_fd >= 0)
-	    if(G_get_raster_row(ialt_fd, alt, row, FCELL_TYPE) < 0)
+	    if(Rast_get_raster_row(ialt_fd, alt, row, FCELL_TYPE) < 0)
 		G_fatal_error (_("Unable to read elevation raster map row %d"),
 			       row);
 
         /* read the next row of elevation values */
         if(ivis_fd >= 0)
-	    if(G_get_raster_row(ivis_fd, vis, row, FCELL_TYPE) < 0)
+	    if(Rast_get_raster_row(ivis_fd, vis, row, FCELL_TYPE) < 0)
 		G_fatal_error (_("Unable to read visibility raster map row %d"),
 			       row);
 
         /* loop over all the values in the row */
 	for(col = 0; col < ncols; col++)
 	{
-	    if(vis && G_is_f_null_value(&vis[col]) || 
-	       alt && G_is_f_null_value(&alt[col]) || 
-	              G_is_f_null_value(&buf[col]))
+	    if(vis && Rast_is_f_null_value(&vis[col]) || 
+	       alt && Rast_is_f_null_value(&alt[col]) || 
+	              Rast_is_f_null_value(&buf[col]))
 	    {
-	        G_set_f_null_value(&buf[col], 1);
+	        Rast_set_f_null_value(&buf[col], 1);
 	        continue;
 	    }
 	    alt[col] /= 1000.0f; /* converting to km from input which should be in meter */
@@ -404,7 +405,7 @@ static void process_raster (int ifd, InputMask imask, ScaleRange iscale,
 	}
 
         /* write output */
-	if(oflt) G_put_raster_row(ofd, buf, FCELL_TYPE);
+	if(oflt) Rast_put_raster_row(ofd, buf, FCELL_TYPE);
 	else write_fp_to_cell(ofd, buf);
     }
 
@@ -421,8 +422,8 @@ static void copy_colors (char *iname, const char *imapset, char *oname)
 {
     struct Colors colors;
 
-    G_read_colors(iname, imapset, &colors);
-    G_write_colors(oname, G_mapset(), &colors);
+    Rast_read_colors(iname, imapset, &colors);
+    Rast_write_colors(oname, G_mapset(), &colors);
 }
 
 
@@ -588,7 +589,7 @@ int main(int argc, char* argv[])
     /* open input raster */
     if ( (iimg_mapset = G_find_cell2 ( opts.iimg->answer, "") ) == NULL )
 	G_fatal_error ( _("Raster map <%s> not found"), opts.iimg->answer);
-    if((iimg_fd = G_open_cell_old(opts.iimg->answer, iimg_mapset)) < 0)
+    if((iimg_fd = Rast_open_cell_old(opts.iimg->answer, iimg_mapset)) < 0)
 	G_fatal_error (_("Unable to open raster map <%s>"),
 		       G_fully_qualified_name(opts.iimg->answer, iimg_mapset));
 
@@ -597,7 +598,7 @@ int main(int argc, char* argv[])
     if(opts.ialt->answer) {
 	if ( (ialt_mapset = G_find_cell2 ( opts.ialt->answer, "") ) == NULL )
 	    G_fatal_error ( _("Raster map <%s> not found"), opts.ialt->answer);
-	if((ialt_fd = G_open_cell_old(opts.ialt->answer, ialt_mapset)) < 0)
+	if((ialt_fd = Rast_open_cell_old(opts.ialt->answer, ialt_mapset)) < 0)
             G_fatal_error (_("Unable to open raster map <%s>"),
 			   G_fully_qualified_name(opts.ialt->answer, ialt_mapset));
     }
@@ -605,7 +606,7 @@ int main(int argc, char* argv[])
     if(opts.ivis->answer) {
 	if ( (iviz_mapset = G_find_cell2 ( opts.ivis->answer, "") ) == NULL )
 	    G_fatal_error ( _("Raster map <%s> not found"), opts.ivis->answer);
-	if((ivis_fd = G_open_cell_old(opts.ivis->answer, iviz_mapset)) < 0)
+	if((ivis_fd = Rast_open_cell_old(opts.ivis->answer, iviz_mapset)) < 0)
             G_fatal_error (_("Unable to open raster map <%s>"),
 			   G_fully_qualified_name(opts.ivis->answer, iviz_mapset));
     }
@@ -613,13 +614,13 @@ int main(int argc, char* argv[])
     /* open a floating point raster or not? */
     if(opts.oflt->answer)
     {
-	if((oimg_fd = G_open_fp_cell_new(opts.oimg->answer)) < 0)
+	if((oimg_fd = Rast_open_fp_cell_new(opts.oimg->answer)) < 0)
 	    G_fatal_error (_("Unable to create raster map <%s>"),
 			   opts.oimg->answer);
     }
     else
     {
-	if((oimg_fd = G_open_raster_new(opts.oimg->answer, CELL_TYPE)) < 0)
+	if((oimg_fd = Rast_open_raster_new(opts.oimg->answer, CELL_TYPE)) < 0)
 	    G_fatal_error (_("Unable to create raster map <%s>"),
 			   opts.oimg->answer);
     }
@@ -644,14 +645,14 @@ int main(int argc, char* argv[])
 
 
     /* Close the input and output file descriptors */
-    G_short_history(opts.oimg->answer, "raster", &hist);
-    G_close_cell(iimg_fd);
-    if(opts.ialt->answer) G_close_cell(ialt_fd);
-    if(opts.ivis->answer) G_close_cell(ivis_fd);
-    G_close_cell(oimg_fd);
-
-    G_command_history(&hist);
-    G_write_history(opts.oimg->answer, &hist);
+    Rast_short_history(opts.oimg->answer, "raster", &hist);
+    Rast_close_cell(iimg_fd);
+    if(opts.ialt->answer) Rast_close_cell(ialt_fd);
+    if(opts.ivis->answer) Rast_close_cell(ivis_fd);
+    Rast_close_cell(oimg_fd);
+
+    Rast_command_history(&hist);
+    Rast_write_history(opts.oimg->answer, &hist);
 
     /* Copy the colors of the input raster to the output raster.
        Scaling is ignored and color ranges might not be correct. */

+ 8 - 7
imagery/i.cca/main.c

@@ -38,6 +38,7 @@
 #include <string.h>
 #include <math.h>
 
+#include <grass/Rast.h>
 #include <grass/imagery.h>
 #include <grass/gmath.h>
 #include <grass/glocale.h>
@@ -167,14 +168,14 @@ int main(int argc, char *argv[])
 	outbandmax[i] = (CELL) 0;
 	outbandmin[i] = (CELL) 0;
 
-	if ((datafds[i] = G_open_cell_old(refs.file[i - 1].name,
+	if ((datafds[i] = Rast_open_cell_old(refs.file[i - 1].name,
 					  refs.file[i - 1].mapset)) < 0) {
 	    G_fatal_error(_("Cannot open raster map <%s>"),
 			  refs.file[i - 1].name);
 	}
 
 	sprintf(tempname, "%s.%d", out_opt->answer, i);
-	if ((outfds[i] = G_open_cell_new(tempname)) < 0)
+	if ((outfds[i] = Rast_open_cell_new(tempname)) < 0)
 	    G_fatal_error(_("Cannot create raster map <%s>"), tempname);
     }
 
@@ -183,23 +184,23 @@ int main(int argc, char *argv[])
 	      outbandmin, outbandmax);
 
     /* make grey scale color table */
-    G_init_colors(&color_tbl);
+    Rast_init_colors(&color_tbl);
 
     /* close the cell maps */
     for (i = 1; i <= bands; i++) {
-	G_close_cell(datafds[i]);
-	G_close_cell(outfds[i]);
+	Rast_close_cell(datafds[i]);
+	Rast_close_cell(outfds[i]);
 
 	if (outbandmin[i] < (CELL) 0 || outbandmax[i] > (CELL) 255) {
 	    G_warning(_("The output cell map <%s.%d> has values "
 			"outside the 0-255 range."), out_opt->answer, i);
 	}
 
-	G_make_grey_scale_colors(&color_tbl, 0, outbandmax[i]);
+	Rast_make_grey_scale_colors(&color_tbl, 0, outbandmax[i]);
 	sprintf(tempname, "%s.%d", out_opt->answer, i);
 
 	/* write a color table */
-	G_write_colors(tempname, G_mapset(), &color_tbl);
+	Rast_write_colors(tempname, G_mapset(), &color_tbl);
     }
 
     I_free_signatures(&sigs);

+ 1 - 0
imagery/i.cca/matrix.c

@@ -1,5 +1,6 @@
 #include <math.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/gmath.h>
 #include "local_proto.h"
 

+ 1 - 0
imagery/i.cca/stats.c

@@ -1,4 +1,5 @@
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include "local_proto.h"
 
 

+ 4 - 3
imagery/i.cca/transform.c

@@ -1,5 +1,6 @@
 #include <stdlib.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/glocale.h>
 #include "local_proto.h"
 
@@ -14,13 +15,13 @@ transform(int datafds[MX], int outfds[MX], int rows, int cols,
 
     /* allocate row buffers for each band */
     for (i = 1; i <= bands; i++)
-	if ((rowbufs[i] = G_allocate_cell_buf()) == NULL)
+	if ((rowbufs[i] = Rast_allocate_cell_buf()) == NULL)
 	    G_fatal_error(_("Unable to allocate cell buffers."));
 
     for (i = 0; i < rows; i++) {
 	/* get one row of data */
 	for (j = 1; j <= bands; j++)
-	    if (G_get_map_row(datafds[j], rowbufs[j], i) < 0)
+	    if (Rast_get_map_row(datafds[j], rowbufs[j], i) < 0)
 		G_fatal_error(_("Error reading cell map during transform."));
 
 	/* transform each cell in the row */
@@ -42,7 +43,7 @@ transform(int datafds[MX], int outfds[MX], int rows, int cols,
 
 	/* output the row of data */
 	for (j = 1; j <= bands; j++)
-	    if (G_put_raster_row(outfds[j], rowbufs[j], CELL_TYPE) < 0)
+	    if (Rast_put_raster_row(outfds[j], rowbufs[j], CELL_TYPE) < 0)
 		G_fatal_error(_("Error writing cell map during transform."));
     }
     for (i = 1; i <= bands; i++)

+ 3 - 3
imagery/i.class/band_files.c

@@ -15,10 +15,10 @@ int open_band_files(void)
     Bandbuf = (CELL **) G_malloc(nbands * sizeof(CELL *));
     Bandfd = (int *)G_malloc(nbands * sizeof(int));
     for (n = 0; n < nbands; n++) {
-	Bandbuf[n] = G_allocate_cell_buf();
+	Bandbuf[n] = Rast_allocate_cell_buf();
 	name = Refer.file[n].name;
 	mapset = Refer.file[n].mapset;
-	if ((Bandfd[n] = G_open_cell_old(name, mapset)) < 0)
+	if ((Bandfd[n] = Rast_open_cell_old(name, mapset)) < 0)
 	    G_fatal_error(_("Unable to open band files."));
     }
 
@@ -34,7 +34,7 @@ int close_band_files(void)
     nbands = Refer.nfiles;
     for (n = 0; n < nbands; n++) {
 	G_free(Bandbuf[n]);
-	G_close_cell(Bandfd[n]);
+	Rast_close_cell(Bandfd[n]);
     }
     G_free(Bandbuf);
     G_free(Bandfd);

+ 8 - 8
imagery/i.class/draw_cell.c

@@ -18,7 +18,7 @@ int draw_cell(View * view, int overlay)
 
     if (!view->cell.configured)
 	return 0;
-    if (G_read_colors(view->cell.name, view->cell.mapset, &colr) < 0)
+    if (Rast_read_colors(view->cell.name, view->cell.mapset, &colr) < 0)
 	return 0;
 
     if (overlay == OVER_WRITE)
@@ -35,16 +35,16 @@ int draw_cell(View * view, int overlay)
     Outline_box(top, top + nrows - 1, left, left + ncols - 1);
 
     if (getenv("NO_DRAW")) {
-	G_free_colors(&colr);
+	Rast_free_colors(&colr);
 	return 1;
     }
 
-    fd = G_open_cell_old(view->cell.name, view->cell.mapset);
+    fd = Rast_open_cell_old(view->cell.name, view->cell.mapset);
     if (fd < 0) {
-	G_free_colors(&colr);
+	Rast_free_colors(&colr);
 	return 0;
     }
-    dcell = G_allocate_d_raster_buf();
+    dcell = Rast_allocate_d_raster_buf();
 
 
     sprintf(msg, "Plotting %s ...", view->cell.name);
@@ -53,14 +53,14 @@ int draw_cell(View * view, int overlay)
     D_set_overlay_mode(!overlay);
     D_cell_draw_setup(top, top + nrows, left, left + ncols);
     for (row = 0; row < nrows; row++) {
-	if (G_get_d_raster_row_nomask(fd, dcell, row) < 0)
+	if (Rast_get_d_raster_row_nomask(fd, dcell, row) < 0)
 	    break;
 	D_draw_d_raster(row, dcell, &colr);
     }
     D_cell_draw_end();
-    G_close_cell(fd);
+    Rast_close_cell(fd);
     G_free(dcell);
-    G_free_colors(&colr);
+    Rast_free_colors(&colr);
 
     return row == nrows;
 }

+ 3 - 3
imagery/i.class/main.c

@@ -128,7 +128,7 @@ int main(int argc, char *argv[])
 	G_fatal_error(_("No graphics device selected"));
 
     /* check to see if a MASK is set */
-    if (G_maskfd() >= 0)
+    if (Rast_maskfd() >= 0)
 	G_fatal_error(_("You have a mask set. Unset mask and run again"));
 
 
@@ -161,7 +161,7 @@ int main(int argc, char *argv[])
     display_title(VIEW_MAP1);
 
     mapset = G_find_cell(bg_map->answer, "");
-    if (G_get_cellhd(bg_map->answer, mapset, &cellhd) != 0)
+    if (Rast_get_cellhd(bg_map->answer, mapset, &cellhd) != 0)
 	G_fatal_error(_("Raster map <%s> not found"), bg_map->answer);
 
     G_adjust_window_to_box(&cellhd, &VIEW_MAP1->cell.head, VIEW_MAP1->nrows,
@@ -265,7 +265,7 @@ static int check_files(char *img_group, char *img_subgroup,
 	G_fatal_error(_("The subgroup must have at least 2 files to run"));
     }
 
-    if (G_get_cellhd(Refer.file[0].name, Refer.file[0].mapset, &Band_cellhd)
+    if (Rast_get_cellhd(Refer.file[0].name, Refer.file[0].mapset, &Band_cellhd)
 	!= 0)
 	G_fatal_error(_("Unable to read cell header for first band file"));
 

+ 1 - 1
imagery/i.class/readbands.c

@@ -8,7 +8,7 @@ int readbands(int nbands, int cur)
     register int i;
 
     for (i = 0; i < nbands; i++)
-	if (G_get_map_row_nomask(Bandfd[i], Bandbuf[i], cur) < 0)
+	if (Rast_get_map_row_nomask(Bandfd[i], Bandbuf[i], cur) < 0)
 	    G_fatal_error(_("Error reading raster map in function readbands."));
 
     return 0;

+ 8 - 8
imagery/i.class/signature.c

@@ -272,9 +272,9 @@ int display_signature(void)
 	G_set_window(&VIEW_MAP1->cell.head);
 	open_band_files();
 
-	if ((fd = G_open_cell_new(MASK)) < 0)
+	if ((fd = Rast_open_cell_new(MASK)) < 0)
 	    G_fatal_error(_("Unable to open the cell map MASK."));
-	if ((buffer = G_allocate_cell_buf()) == NULL)
+	if ((buffer = Rast_allocate_cell_buf()) == NULL)
 	    G_fatal_error(_("Unable to allocate the cell buffer in display_signature()."));
 	nrows = G_window_rows();
 	ncols = G_window_cols();
@@ -291,22 +291,22 @@ int display_signature(void)
 		buffer[col] = (CELL) 1;
 	      past:;
 	    }
-	    G_put_raster_row(fd, buffer, CELL_TYPE);
+	    Rast_put_raster_row(fd, buffer, CELL_TYPE);
 	}
 
-	G_close_cell(fd);
+	Rast_close_cell(fd);
 	close_band_files();
     }				/* end of if first_display */
 
     /* generate and write the color table for the mask */
-    G_init_colors(&mask_colors);
-    G_set_color((CELL) 1, Color_table[Display_color].red,
+    Rast_init_colors(&mask_colors);
+    Rast_set_color((CELL) 1, Color_table[Display_color].red,
 		Color_table[Display_color].grn,
 		Color_table[Display_color].blue, &mask_colors);
-    G_write_colors(MASK, G_mapset(), &mask_colors);
+    Rast_write_colors(MASK, G_mapset(), &mask_colors);
 
     /* display new mask */
-    if (G_get_cellhd(MASK, G_mapset(), &cellhd) != 0)
+    if (Rast_get_cellhd(MASK, G_mapset(), &cellhd) != 0)
 	G_fatal_error(_("Did not find input cell map MASK."));
     G_adjust_window_to_box(&cellhd, &VIEW_MASK1->cell.head, VIEW_MASK1->nrows,
 			   VIEW_MASK1->ncols);

+ 1 - 0
imagery/i.cluster/checkpt.c

@@ -1,4 +1,5 @@
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/glocale.h>
 #include "global.h"
 #include "local_proto.h"

+ 4 - 3
imagery/i.cluster/main.c

@@ -21,6 +21,7 @@
 #include <stdlib.h>
 #include <time.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/glocale.h>
 #define GLOBAL
 #include "global.h"
@@ -248,7 +249,7 @@ int main(int argc, char *argv[])
 	    window.ew_res);
     fprintf(report, _("  Rows:  %12d  Cols: %12d  Cells: %d\n"), nrows, ncols,
 	    nrows * ncols);
-    fprintf(report, _("Mask: %s\n"), G_mask_info());
+    fprintf(report, _("Mask: %s\n"), Rast_mask_info());
     fprintf(report, "\n");
     fprintf(report, _("Cluster parameters\n"));
     fprintf(report, _(" Number of initial classes:    %d"), maxclass);
@@ -274,7 +275,7 @@ int main(int argc, char *argv[])
     for (row = sample_rows - 1; row < nrows; row += sample_rows) {
 	G_percent(row, nrows, 2);
 	for (n = 0; n < ref.nfiles; n++)
-	    if (G_get_d_raster_row(cellfd[n], cell[n], row) < 0)
+	    if (Rast_get_d_raster_row(cellfd[n], cell[n], row) < 0)
 		G_fatal_error(_("Unable to read raster map row %d"),
 			      row);
 	for (col = sample_cols - 1; col < ncols; col += sample_cols) {
@@ -300,7 +301,7 @@ int main(int argc, char *argv[])
 
     for (n = 0; n < ref.nfiles; n++) {
 	G_free(cell[n]);
-	G_close_cell(cellfd[n]);
+	Rast_close_cell(cellfd[n]);
     }
     G_free(x);
 

+ 3 - 2
imagery/i.cluster/open_files.c

@@ -1,5 +1,6 @@
 #include <stdlib.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/glocale.h>
 #include "global.h"
 
@@ -49,10 +50,10 @@ int open_files(void)
     cell = (DCELL **) G_malloc(ref.nfiles * sizeof(DCELL *));
     cellfd = (int *)G_malloc(ref.nfiles * sizeof(int));
     for (n = 0; n < ref.nfiles; n++) {
-	cell[n] = G_allocate_d_raster_buf();
+	cell[n] = Rast_allocate_d_raster_buf();
 	name = ref.file[n].name;
 	mapset = ref.file[n].mapset;
-	if ((cellfd[n] = G_open_cell_old(name, mapset)) < 0)
+	if ((cellfd[n] = Rast_open_cell_old(name, mapset)) < 0)
 	    G_fatal_error(_("Unable to open raster map <%s>"),
 			  G_fully_qualified_name(name, mapset));
     }

+ 1 - 0
imagery/i.cluster/print1.c

@@ -1,4 +1,5 @@
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/glocale.h>
 #include <grass/imagery.h>
 #include <grass/cluster.h>

+ 1 - 0
imagery/i.cluster/print2.c

@@ -1,4 +1,5 @@
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/glocale.h>
 #include <grass/imagery.h>
 #include <grass/cluster.h>

+ 1 - 0
imagery/i.cluster/print3.c

@@ -1,4 +1,5 @@
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/glocale.h>
 #include <grass/imagery.h>
 #include <grass/cluster.h>

+ 1 - 0
imagery/i.cluster/print4.c

@@ -1,4 +1,5 @@
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/glocale.h>
 #include <grass/imagery.h>
 #include <grass/cluster.h>

+ 1 - 0
imagery/i.cluster/print5.c

@@ -1,4 +1,5 @@
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/glocale.h>
 #include <grass/imagery.h>
 #include <grass/cluster.h>

+ 1 - 0
imagery/i.cluster/print6.c

@@ -1,4 +1,5 @@
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/glocale.h>
 #include <grass/imagery.h>
 #include <grass/cluster.h>

+ 1 - 0
imagery/i.cluster/timer.c

@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include "global.h"
 
 

+ 24 - 23
imagery/i.eb.eta/main.c

@@ -19,6 +19,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/glocale.h>
 double et_a(double r_net_day, double evap_fr, double tempk);
 
@@ -72,23 +73,23 @@ int main(int argc, char *argv[])
     tempk = input3->answer;
     result1 = output1->answer;
     
-    if ((infd_rnetday = G_open_cell_old(rnetday, "")) < 0)
+    if ((infd_rnetday = Rast_open_cell_old(rnetday, "")) < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), rnetday);
-    inrast_rnetday = G_allocate_d_raster_buf();
+    inrast_rnetday = Rast_allocate_d_raster_buf();
     
-    if ((infd_evapfr = G_open_cell_old(evapfr, "")) < 0)
+    if ((infd_evapfr = Rast_open_cell_old(evapfr, "")) < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), evapfr);
-    inrast_evapfr = G_allocate_d_raster_buf();
+    inrast_evapfr = Rast_allocate_d_raster_buf();
     
-    if ((infd_tempk = G_open_cell_old(tempk, "")) < 0)
+    if ((infd_tempk = Rast_open_cell_old(tempk, "")) < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), tempk);
-    inrast_tempk = G_allocate_d_raster_buf();
+    inrast_tempk = Rast_allocate_d_raster_buf();
     
     nrows = G_window_rows();
     ncols = G_window_cols();
-    outrast1 = G_allocate_d_raster_buf();
+    outrast1 = Rast_allocate_d_raster_buf();
     
-    if ((outfd1 = G_open_raster_new(result1, DCELL_TYPE)) < 0)
+    if ((outfd1 = Rast_open_raster_new(result1, DCELL_TYPE)) < 0)
         G_fatal_error(_("Unable to create raster map <%s>"), result1);
     
     /* Process pixels */ 
@@ -101,11 +102,11 @@ int main(int argc, char *argv[])
 	G_percent(row, nrows, 2);
 	
 	/* read input maps */ 
-	if (G_get_d_raster_row(infd_rnetday,inrast_rnetday,row)<0)
+	if (Rast_get_d_raster_row(infd_rnetday,inrast_rnetday,row)<0)
 	    G_fatal_error(_("Unable to read from <%s> row %d"), rnetday, row);
-	if (G_get_d_raster_row(infd_evapfr,inrast_evapfr,row)<0)
+	if (Rast_get_d_raster_row(infd_evapfr,inrast_evapfr,row)<0)
 	    G_fatal_error(_("Unable to read from <%s> row %d"), evapfr, row);
-	if (G_get_d_raster_row(infd_tempk,inrast_tempk,row)<0)
+	if (Rast_get_d_raster_row(infd_tempk,inrast_tempk,row)<0)
 	    G_fatal_error(_("Unable to read from <%s> row %d"), tempk, row);
 	
     /*process the data */ 
@@ -114,29 +115,29 @@ int main(int argc, char *argv[])
             d_rnetday = ((DCELL *) inrast_rnetday)[col];
             d_evapfr = ((DCELL *) inrast_evapfr)[col];
             d_tempk = ((DCELL *) inrast_tempk)[col];
-	    if (G_is_d_null_value(&d_rnetday) ||
-		 G_is_d_null_value(&d_evapfr) ||
-		 G_is_d_null_value(&d_tempk)) 
-		G_set_d_null_value(&outrast1[col], 1);
+	    if (Rast_is_d_null_value(&d_rnetday) ||
+		 Rast_is_d_null_value(&d_evapfr) ||
+		 Rast_is_d_null_value(&d_tempk)) 
+		Rast_set_d_null_value(&outrast1[col], 1);
 	    else {
 		d = et_a(d_rnetday, d_evapfr, d_tempk);
 		outrast1[col] = d;
 	    }
 	}
-	if (G_put_d_raster_row(outfd1,outrast1) < 0)
+	if (Rast_put_d_raster_row(outfd1,outrast1) < 0)
 	    G_fatal_error(_("Failed writing raster map <%s>"), result1);
     }
     G_free(inrast_rnetday);
     G_free(inrast_evapfr);
     G_free(inrast_tempk);
-    G_close_cell(infd_rnetday);
-    G_close_cell(infd_evapfr);
-    G_close_cell(infd_tempk);
+    Rast_close_cell(infd_rnetday);
+    Rast_close_cell(infd_evapfr);
+    Rast_close_cell(infd_tempk);
     G_free(outrast1);
-    G_close_cell(outfd1);
-    G_short_history(result1, "raster", &history);
-    G_command_history(&history);
-    G_write_history(result1, &history);
+    Rast_close_cell(outfd1);
+    Rast_short_history(result1, "raster", &history);
+    Rast_command_history(&history);
+    Rast_write_history(result1, &history);
     exit(EXIT_SUCCESS);
 }
 

+ 32 - 31
imagery/i.eb.evapfr/main.c

@@ -19,6 +19,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/glocale.h>
 
 double evap_fr(double r_net, double g0, double h0);
@@ -91,32 +92,32 @@ int main(int argc, char *argv[])
     makin = flag1->answer;
     
     /***************************************************/ 
-    if ((infd_rnet = G_open_cell_old(rnet, "")) < 0)
+    if ((infd_rnet = Rast_open_cell_old(rnet, "")) < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), rnet);
-    inrast_rnet = G_allocate_d_raster_buf();
+    inrast_rnet = Rast_allocate_d_raster_buf();
     
     /***************************************************/ 
-    if ((infd_g0 = G_open_cell_old(g0, "")) < 0)
+    if ((infd_g0 = Rast_open_cell_old(g0, "")) < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), g0);
-    inrast_g0 = G_allocate_d_raster_buf();
+    inrast_g0 = Rast_allocate_d_raster_buf();
     
     /***************************************************/ 
-    if ((infd_h0 = G_open_cell_old(h0, "")) < 0)
+    if ((infd_h0 = Rast_open_cell_old(h0, "")) < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), h0);
-    inrast_h0 = G_allocate_d_raster_buf();
+    inrast_h0 = Rast_allocate_d_raster_buf();
     
     /***************************************************/ 
     nrows = G_window_rows();
     ncols = G_window_cols();
-    outrast1 = G_allocate_d_raster_buf();
+    outrast1 = Rast_allocate_d_raster_buf();
     if (makin) 
-	outrast2 = G_allocate_d_raster_buf();
+	outrast2 = Rast_allocate_d_raster_buf();
     
     /* Create New raster files */ 
-    if ((outfd1 = G_open_raster_new(result1, DCELL_TYPE)) < 0)
+    if ((outfd1 = Rast_open_raster_new(result1, DCELL_TYPE)) < 0)
 	G_fatal_error(_("Unable to create raster map <%s>"), result1);
     if (makin) 
-	if ((outfd2 = G_open_raster_new(result2, DCELL_TYPE)) < 0)
+	if ((outfd2 = Rast_open_raster_new(result2, DCELL_TYPE)) < 0)
 	    G_fatal_error(_("Unable to create raster map <%s>"), result2);
         
     /* Process pixels */ 
@@ -129,11 +130,11 @@ int main(int argc, char *argv[])
 	G_percent(row, nrows, 2);
 	
         /* read input maps */ 
-        if (G_get_d_raster_row(infd_rnet, inrast_rnet, row)<0)
+        if (Rast_get_d_raster_row(infd_rnet, inrast_rnet, row)<0)
 	  G_fatal_error(_("Unable to read raster map <%s> row %d"), rnet, row);
-	if (G_get_d_raster_row(infd_g0, inrast_g0, row) < 0)
+	if (Rast_get_d_raster_row(infd_g0, inrast_g0, row) < 0)
 	  G_fatal_error(_("Unable to read raster map <%s> row %d"), g0, row);
-	if (G_get_d_raster_row(infd_h0, inrast_h0, row) < 0)
+	if (Rast_get_d_raster_row(infd_h0, inrast_h0, row) < 0)
 	  G_fatal_error(_("Unable to read raster map <%s> row %d"), h0, row);
 	
         /*process the data */ 
@@ -142,12 +143,12 @@ int main(int argc, char *argv[])
             d_rnet = ((DCELL *) inrast_rnet)[col];
             d_g0 = ((DCELL *) inrast_g0)[col];
             d_h0 = ((DCELL *) inrast_h0)[col];
-	    if (G_is_d_null_value(&d_rnet) || 
-                G_is_d_null_value(&d_g0) ||
-		G_is_d_null_value(&d_h0)) {
-		G_set_d_null_value(&outrast1[col], 1);
+	    if (Rast_is_d_null_value(&d_rnet) || 
+                Rast_is_d_null_value(&d_g0) ||
+		Rast_is_d_null_value(&d_h0)) {
+		Rast_set_d_null_value(&outrast1[col], 1);
 		if (makin) 
-		    G_set_d_null_value(&outrast2[col], 1);
+		    Rast_set_d_null_value(&outrast2[col], 1);
 	    }
 	    else {
                 /* calculate evaporative fraction       */ 
@@ -161,33 +162,33 @@ int main(int argc, char *argv[])
 		}
 	    }
         }
-	if (G_put_d_raster_row(outfd1, outrast1) < 0)
+	if (Rast_put_d_raster_row(outfd1, outrast1) < 0)
 	    G_fatal_error(_("Failed writing raster map <%s>"), result1);
 	if (makin) 
         {
-            if (G_put_d_raster_row(outfd2, outrast2) < 0)
+            if (Rast_put_d_raster_row(outfd2, outrast2) < 0)
 		G_fatal_error(_("Failed writing raster map <%s>"), result2);
         }
     }
     G_free(inrast_rnet);
     G_free(inrast_g0);
     G_free(inrast_h0);
-    G_close_cell(infd_rnet);
-    G_close_cell(infd_g0);
-    G_close_cell(infd_h0);
+    Rast_close_cell(infd_rnet);
+    Rast_close_cell(infd_g0);
+    Rast_close_cell(infd_h0);
     G_free(outrast1);
     G_free(outrast2);
     if (makin) {
-	G_close_cell(outfd1);
-	G_close_cell(outfd2);
+	Rast_close_cell(outfd1);
+	Rast_close_cell(outfd2);
     }
-    G_short_history(result1, "raster", &history);
-    G_command_history(&history);
-    G_write_history(result1, &history);
+    Rast_short_history(result1, "raster", &history);
+    Rast_command_history(&history);
+    Rast_write_history(result1, &history);
     if (makin) {
-	G_short_history(result2, "raster", &history);
-	G_command_history(&history);
-	G_write_history(result2, &history);
+	Rast_short_history(result2, "raster", &history);
+	Rast_command_history(&history);
+	Rast_write_history(result2, &history);
     }
 
     exit(EXIT_SUCCESS);

+ 46 - 45
imagery/i.eb.h_SEBAL01/main.c

@@ -24,6 +24,7 @@
 #include <stdlib.h>
 #include <math.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/glocale.h>
 
 double **G_alloc_matrix(int rows, int cols)
@@ -199,29 +200,29 @@ int main(int argc, char *argv[])
     if (G_legal_filename(h0) < 0)
 	G_fatal_error(_("<%s> is an illegal name"), h0);
 
-    if ((infd_Rn = G_open_cell_old(Rn, "")) < 0)
+    if ((infd_Rn = Rast_open_cell_old(Rn, "")) < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), Rn);
-    if ((infd_g0 = G_open_cell_old(g0, "")) < 0)
+    if ((infd_g0 = Rast_open_cell_old(g0, "")) < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), g0);
-    if ((infd_z0m = G_open_cell_old(z0m, "")) < 0)
+    if ((infd_z0m = Rast_open_cell_old(z0m, "")) < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), z0m);
-    if ((infd_t0dem = G_open_cell_old(t0dem, "")) < 0)
+    if ((infd_t0dem = Rast_open_cell_old(t0dem, "")) < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), t0dem);
 
-    if (G_get_cellhd(Rn, "", &cellhd) < 0)
+    if (Rast_get_cellhd(Rn, "", &cellhd) < 0)
 	G_fatal_error(_("Unable to read header of raster map <%s>"), Rn);
-    if (G_get_cellhd(g0, "", &cellhd) < 0)
+    if (Rast_get_cellhd(g0, "", &cellhd) < 0)
 	G_fatal_error(_("Unable to read header of raster map <%s>"), g0);
-    if (G_get_cellhd(z0m, "", &cellhd) < 0)
+    if (Rast_get_cellhd(z0m, "", &cellhd) < 0)
 	G_fatal_error(_("Unable to read header of raster map <%s>"), z0m);
-    if (G_get_cellhd(t0dem, "", &cellhd) < 0)
+    if (Rast_get_cellhd(t0dem, "", &cellhd) < 0)
 	G_fatal_error(_("Unable to read header of raster map <%s>"), t0dem);
 
     /* Allocate input buffer */
-    inrast_Rn = G_allocate_d_raster_buf();
-    inrast_g0 = G_allocate_d_raster_buf();
-    inrast_z0m = G_allocate_d_raster_buf();
-    inrast_t0dem = G_allocate_d_raster_buf();
+    inrast_Rn = Rast_allocate_d_raster_buf();
+    inrast_g0 = Rast_allocate_d_raster_buf();
+    inrast_z0m = Rast_allocate_d_raster_buf();
+    inrast_t0dem = Rast_allocate_d_raster_buf();
 
     /***************************************************/
     /* Setup pixel location variables */
@@ -240,9 +241,9 @@ int main(int argc, char *argv[])
     /***************************************************/
     /* Allocate output buffer */
     /***************************************************/
-    outrast = G_allocate_d_raster_buf();
+    outrast = Rast_allocate_d_raster_buf();
 
-    if ((outfd = G_open_raster_new(h0, DCELL_TYPE)) < 0)
+    if ((outfd = Rast_open_raster_new(h0, DCELL_TYPE)) < 0)
 	G_fatal_error(_("Unable to create raster map <%s>"), h0);
 
     /***************************************************/
@@ -275,20 +276,20 @@ int main(int argc, char *argv[])
 	for (row = 0; row < nrows; row++) {
 	    DCELL d_t0dem;
 	    G_percent(row, nrows, 2);
-	    if (G_get_d_raster_row(infd_t0dem,inrast_t0dem,row)<0)
+	    if (Rast_get_d_raster_row(infd_t0dem,inrast_t0dem,row)<0)
 	      G_fatal_error(_("Unable to read raster map <%s> row %d"), t0dem, row);
-	    if (G_get_d_raster_row(infd_Rn,inrast_Rn,row)<0)
+	    if (Rast_get_d_raster_row(infd_Rn,inrast_Rn,row)<0)
 	      G_fatal_error(_("Unable to read raster map <%s> row %d"), Rn, row);
-	    if (G_get_d_raster_row(infd_g0,inrast_g0,row)<0)
+	    if (Rast_get_d_raster_row(infd_g0,inrast_g0,row)<0)
 	      G_fatal_error(_("Unable to read raster map <%s> row %d"), g0, row);
 	    /*process the data */
 	    for (col = 0; col < ncols; col++) {
 		d_t0dem = ((DCELL *) inrast_t0dem)[col];
 		d_Rn = ((DCELL *) inrast_Rn)[col];
 		d_g0 = ((DCELL *) inrast_g0)[col];
-		if (G_is_d_null_value(&d_t0dem) ||
-		    G_is_d_null_value(&d_Rn) || 
-                    G_is_d_null_value(&d_g0)) {
+		if (Rast_is_d_null_value(&d_t0dem) ||
+		    Rast_is_d_null_value(&d_Rn) || 
+                    Rast_is_d_null_value(&d_g0)) {
 		    /* do nothing */
 		}
 		else {
@@ -348,11 +349,11 @@ int main(int argc, char *argv[])
     }
     rowDry = row;
     colDry = col;
-    if (G_get_d_raster_row(infd_Rn, inrast_Rn, row) < 0)
+    if (Rast_get_d_raster_row(infd_Rn, inrast_Rn, row) < 0)
 	G_fatal_error(_("Unable to read raster map <%s> row %d"), Rn, row);
-    if (G_get_d_raster_row(infd_g0, inrast_g0, row) < 0)
+    if (Rast_get_d_raster_row(infd_g0, inrast_g0, row) < 0)
 	G_fatal_error(_("Unable to read raster map <%s> row %d"), g0, row);
-    if (G_get_d_raster_row(infd_t0dem, inrast_t0dem, row) < 0)
+    if (Rast_get_d_raster_row(infd_t0dem, inrast_t0dem, row) < 0)
 	G_fatal_error(_("Unable to read raster map <%s> row %d"), t0dem, row);
     d_Rn_dry = ((DCELL *) inrast_Rn)[col];
     d_g0_dry = ((DCELL *) inrast_g0)[col];
@@ -371,7 +372,7 @@ int main(int argc, char *argv[])
     }
     rowWet = row;
     colWet = col;
-    if (G_get_d_raster_row(infd_t0dem, inrast_t0dem, row) < 0)
+    if (Rast_get_d_raster_row(infd_t0dem, inrast_t0dem, row) < 0)
 	G_fatal_error(_("Unable to read raster map <%s> row %d"), t0dem, row);
     d_t0dem_wet = ((DCELL *) inrast_t0dem)[col];
     /* END OF MANUAL WET/DRY PIXELS */
@@ -393,15 +394,15 @@ int main(int argc, char *argv[])
 	DCELL d_u5;
 	G_percent(row, nrows, 2);
 	/* read a line input maps into buffers */
-	if (G_get_d_raster_row(infd_z0m, inrast_z0m, row) < 0)
+	if (Rast_get_d_raster_row(infd_z0m, inrast_z0m, row) < 0)
 	    G_fatal_error(_("Unable to read raster map <%s> row %d"), z0m, row);
-	if (G_get_d_raster_row(infd_t0dem, inrast_t0dem,row)<0)
+	if (Rast_get_d_raster_row(infd_t0dem, inrast_t0dem,row)<0)
 	    G_fatal_error(_("Unable to read raster map <%s> row %d"), t0dem, row);
 	/* read every cell in the line buffers */
 	for (col = 0; col < ncols; col++) {
             d_z0m = ((DCELL *) inrast_z0m)[col];
             d_t0dem = ((DCELL *) inrast_t0dem)[col];
-	    if (G_is_d_null_value(&d_t0dem) || G_is_d_null_value(&d_z0m)) {
+	    if (Rast_is_d_null_value(&d_t0dem) || Rast_is_d_null_value(&d_z0m)) {
 		/* do nothing */
 		d_Roh[row][col] = -999.9;
 		d_Rah[row][col] = -999.9;
@@ -456,9 +457,9 @@ int main(int argc, char *argv[])
 	DCELL d_u5;
 	G_percent(row, nrows, 2);
 	/* read a line input maps into buffers */
-	if (G_get_d_raster_row(infd_z0m, inrast_z0m, row) < 0)
+	if (Rast_get_d_raster_row(infd_z0m, inrast_z0m, row) < 0)
 	    G_fatal_error(_("Unable to read raster map <%s> row %d"), z0m, row);
-	if (G_get_d_raster_row(infd_t0dem, inrast_t0dem,row)<0)
+	if (Rast_get_d_raster_row(infd_t0dem, inrast_t0dem,row)<0)
 	    G_fatal_error(_("Unable to read raster map <%s> row %d"), t0dem, row);
 	/* read every cell in the line buffers */
 	for (col = 0; col < ncols; col++) {
@@ -466,7 +467,7 @@ int main(int argc, char *argv[])
             d_t0dem = ((DCELL *) inrast_t0dem)[col];
 	    d_rah1 = d_Rah[row][col];
 	    d_roh1 = d_Roh[row][col];
-	    if (G_is_d_null_value(&d_t0dem) || G_is_d_null_value(&d_z0m)) {
+	    if (Rast_is_d_null_value(&d_t0dem) || Rast_is_d_null_value(&d_z0m)) {
 		/* do nothing */
 	    }
 	    else {
@@ -525,9 +526,9 @@ int main(int argc, char *argv[])
 	DCELL d_u5;
 	G_percent(row, nrows, 2);
 	/* read a line input maps into buffers */
-	if (G_get_d_raster_row(infd_z0m,inrast_z0m,row)<0)
+	if (Rast_get_d_raster_row(infd_z0m,inrast_z0m,row)<0)
 	    G_fatal_error(_("Unable to read raster map <%s> row %d"), z0m, row);
-	if (G_get_d_raster_row(infd_t0dem,inrast_t0dem,row)<0)
+	if (Rast_get_d_raster_row(infd_t0dem,inrast_t0dem,row)<0)
 	    G_fatal_error(_("Unable to read raster map <%s> row %d"), t0dem, row);
 	/* read every cell in the line buffers */
 	for (col = 0; col < ncols; col++) {
@@ -535,7 +536,7 @@ int main(int argc, char *argv[])
             d_t0dem = ((DCELL *) inrast_t0dem)[col];
 	    d_rah2 = d_Rah[row][col];
 	    d_roh1 = d_Roh[row][col];
-	    if (G_is_d_null_value(&d_t0dem) || G_is_d_null_value(&d_z0m)) {
+	    if (Rast_is_d_null_value(&d_t0dem) || Rast_is_d_null_value(&d_z0m)) {
 		/* do nothing */
 	    }
 	    else {
@@ -595,9 +596,9 @@ int main(int argc, char *argv[])
 	DCELL d;		/* Output pixel */
 	G_percent(row, nrows, 2);
 	/* read a line input maps into buffers */
-	if (G_get_d_raster_row(infd_z0m, inrast_z0m, row) < 0)
+	if (Rast_get_d_raster_row(infd_z0m, inrast_z0m, row) < 0)
 	    G_fatal_error(_("Unable to read raster map <%s> row %d"), z0m, row);
-	if (G_get_d_raster_row(infd_t0dem,inrast_t0dem,row)<0)
+	if (Rast_get_d_raster_row(infd_t0dem,inrast_t0dem,row)<0)
 	    G_fatal_error(_("Unable to read raster map <%s> row %d"), t0dem, row);
 	/* read every cell in the line buffers */
 	for (col = 0; col < ncols; col++) {
@@ -605,8 +606,8 @@ int main(int argc, char *argv[])
             d_t0dem = ((DCELL *) inrast_t0dem)[col];
 	    d_rah3 = d_Rah[row][col];
 	    d_roh1 = d_Roh[row][col];
-	    if (G_is_d_null_value(&d_t0dem) || G_is_d_null_value(&d_z0m)) {
-		G_set_d_null_value(&outrast[col], 1);
+	    if (Rast_is_d_null_value(&d_t0dem) || Rast_is_d_null_value(&d_z0m)) {
+		Rast_set_d_null_value(&outrast[col], 1);
 	    }
 	    else {
 		if (d_rah3 < 1.0) {
@@ -619,28 +620,28 @@ int main(int argc, char *argv[])
 		    d_h3 = 0.0;
 		}
 		if (d_h3 < -50 || d_h3 > 1000) {
-		    G_set_d_null_value(&outrast[col], 1);
+		    Rast_set_d_null_value(&outrast[col], 1);
 		}
 		outrast[col] = d_h3;
 	    }
 	}
-	if (G_put_d_raster_row(outfd, outrast) < 0)
+	if (Rast_put_d_raster_row(outfd, outrast) < 0)
 	    G_fatal_error("Failed writing raster map <%s>", h0);
     }
 
 
     G_free(inrast_z0m);
-    G_close_cell(infd_z0m);
+    Rast_close_cell(infd_z0m);
     G_free(inrast_t0dem);
-    G_close_cell(infd_t0dem);
+    Rast_close_cell(infd_t0dem);
 
     G_free(outrast);
-    G_close_cell(outfd);
+    Rast_close_cell(outfd);
 
     /* add command line incantation to history file */
-    G_short_history(h0, "raster", &history);
-    G_command_history(&history);
-    G_write_history(h0, &history);
+    Rast_short_history(h0, "raster", &history);
+    Rast_command_history(&history);
+    Rast_write_history(h0, &history);
 
     exit(EXIT_SUCCESS);
 }

+ 36 - 35
imagery/i.eb.soilheatflux/main.c

@@ -19,6 +19,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/glocale.h>
 
 double g_0(double bbalb, double ndvi, double tempk, double rnet,
@@ -89,32 +90,32 @@ int main(int argc, char *argv[])
     result = output1->answer;
     roerink = flag1->answer;
 
-    if ((infd_albedo = G_open_cell_old(albedo, "")) < 0)
+    if ((infd_albedo = Rast_open_cell_old(albedo, "")) < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), albedo);
-    inrast_albedo = G_allocate_d_raster_buf();
+    inrast_albedo = Rast_allocate_d_raster_buf();
 
-    if ((infd_ndvi = G_open_cell_old(ndvi, "")) < 0)
+    if ((infd_ndvi = Rast_open_cell_old(ndvi, "")) < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), ndvi);
-    inrast_ndvi = G_allocate_d_raster_buf();
+    inrast_ndvi = Rast_allocate_d_raster_buf();
 
-    if ((infd_tempk = G_open_cell_old(tempk, "")) < 0)
+    if ((infd_tempk = Rast_open_cell_old(tempk, "")) < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), tempk);
-    inrast_tempk = G_allocate_d_raster_buf();
+    inrast_tempk = Rast_allocate_d_raster_buf();
 
-    if ((infd_rnet = G_open_cell_old(rnet, "")) < 0)
+    if ((infd_rnet = Rast_open_cell_old(rnet, "")) < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), rnet);
-    inrast_rnet = G_allocate_d_raster_buf();
+    inrast_rnet = Rast_allocate_d_raster_buf();
 
-    if ((infd_time = G_open_cell_old(time, "")) < 0)
+    if ((infd_time = Rast_open_cell_old(time, "")) < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), time);
-    inrast_time = G_allocate_d_raster_buf();
+    inrast_time = Rast_allocate_d_raster_buf();
 
     nrows = G_window_rows();
     ncols = G_window_cols();
-    outrast = G_allocate_d_raster_buf();
+    outrast = Rast_allocate_d_raster_buf();
     
     /* Create New raster files */ 
-    if ((outfd = G_open_raster_new(result,DCELL_TYPE)) < 0)
+    if ((outfd = Rast_open_raster_new(result,DCELL_TYPE)) < 0)
 	G_fatal_error(_("Unable to create raster map <%s>"), result);
 
     /* Process pixels */ 
@@ -128,19 +129,19 @@ int main(int argc, char *argv[])
 	DCELL d_time;
 	G_percent(row, nrows, 2);	
         /* read input maps */ 
-        if (G_get_d_raster_row(infd_albedo, inrast_albedo, row) < 0)
+        if (Rast_get_d_raster_row(infd_albedo, inrast_albedo, row) < 0)
 	    G_fatal_error(_("Unable to read raster map <%s> row %d"),
 			  albedo, row);
-	if (G_get_d_raster_row(infd_ndvi, inrast_ndvi, row)<0)
+	if (Rast_get_d_raster_row(infd_ndvi, inrast_ndvi, row)<0)
 	    G_fatal_error(_("Unable to read raster map <%s> row %d"),
 			  ndvi, row);
-	if (G_get_d_raster_row(infd_tempk, inrast_tempk, row)< 0)
+	if (Rast_get_d_raster_row(infd_tempk, inrast_tempk, row)< 0)
 	    G_fatal_error(_("Unable to read raster map <%s> row %d"),
 			  tempk, row);
-	if (G_get_d_raster_row(infd_rnet, inrast_rnet, row)<0)
+	if (Rast_get_d_raster_row(infd_rnet, inrast_rnet, row)<0)
 	    G_fatal_error(_("Unable to read raster map <%s> row %d"),
 			  rnet, row);
-	if (G_get_d_raster_row(infd_time, inrast_time, row)<0)
+	if (Rast_get_d_raster_row(infd_time, inrast_time, row)<0)
 	    G_fatal_error(_("Unable to read raster map <%s> row %d"),
 			  time, row);
         /*process the data */ 
@@ -151,12 +152,12 @@ int main(int argc, char *argv[])
             d_tempk  = ((DCELL *) inrast_tempk)[col];
             d_rnet   = ((DCELL *) inrast_rnet)[col];
             d_time   = ((DCELL *) inrast_time)[col];
-	    if (G_is_d_null_value(&d_albedo) || 
-                 G_is_d_null_value(&d_ndvi) ||
-                 G_is_d_null_value(&d_tempk) ||
-		 G_is_d_null_value(&d_rnet) || 
-                 G_is_d_null_value(&d_time)) {
-		G_set_d_null_value(&outrast[col], 1);
+	    if (Rast_is_d_null_value(&d_albedo) || 
+                 Rast_is_d_null_value(&d_ndvi) ||
+                 Rast_is_d_null_value(&d_tempk) ||
+		 Rast_is_d_null_value(&d_rnet) || 
+                 Rast_is_d_null_value(&d_time)) {
+		Rast_set_d_null_value(&outrast[col], 1);
 	    }
 	    else {
                 /* calculate soil heat flux         */ 
@@ -164,7 +165,7 @@ int main(int argc, char *argv[])
 		outrast[col] = d;
 	    }
 	}
-	if (G_put_d_raster_row(outfd, outrast) < 0)
+	if (Rast_put_d_raster_row(outfd, outrast) < 0)
 	    G_fatal_error(_("Failed writing raster map <%s>"), result);
     }
     G_free(inrast_albedo);
@@ -172,20 +173,20 @@ int main(int argc, char *argv[])
     G_free(inrast_tempk);
     G_free(inrast_rnet);
     G_free(inrast_time);
-    G_close_cell(infd_albedo);
-    G_close_cell(infd_ndvi);
-    G_close_cell(infd_tempk);
-    G_close_cell(infd_rnet);
-    G_close_cell(infd_time);
+    Rast_close_cell(infd_albedo);
+    Rast_close_cell(infd_ndvi);
+    Rast_close_cell(infd_tempk);
+    Rast_close_cell(infd_rnet);
+    Rast_close_cell(infd_time);
     G_free(outrast);
-    G_close_cell(outfd);
+    Rast_close_cell(outfd);
     
     /* Colors in grey shade */ 
-    G_init_colors(&colors);
-    G_add_color_rule(0.0, 0, 0, 0, 200.0, 255, 255, 255, &colors);
-    G_short_history(result, "raster", &history);
-    G_command_history(&history);
-    G_write_history(result, &history);
+    Rast_init_colors(&colors);
+    Rast_add_color_rule(0.0, 0, 0, 0, 200.0, 255, 255, 255, &colors);
+    Rast_short_history(result, "raster", &history);
+    Rast_command_history(&history);
+    Rast_write_history(result, &history);
 
     exit(EXIT_SUCCESS);
 }

+ 14 - 13
imagery/i.emissivity/main.c

@@ -17,6 +17,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/glocale.h>
 
 double emissivity_generic(double ndvi);
@@ -59,17 +60,17 @@ int main(int argc, char *argv[])
     result1 = output->answer;
     
     /***************************************************/ 
-    if ((infd = G_open_cell_old(ndvi, "")) < 0)
+    if ((infd = Rast_open_cell_old(ndvi, "")) < 0)
 	G_fatal_error(_("Cannot open cell file [%s]"), ndvi);
-    inr = G_allocate_d_raster_buf();
+    inr = Rast_allocate_d_raster_buf();
     
     /***************************************************/ 
     nrows = G_window_rows();
     ncols = G_window_cols();
-    outr = G_allocate_d_raster_buf();
+    outr = Rast_allocate_d_raster_buf();
     
     /* Create New raster files */ 
-    if ((outfd = G_open_raster_new(result1, DCELL_TYPE)) < 0)
+    if ((outfd = Rast_open_raster_new(result1, DCELL_TYPE)) < 0)
 	G_fatal_error(_("Could not open <%s>"), result1);
     
     /* Process pixels */ 
@@ -80,15 +81,15 @@ int main(int argc, char *argv[])
 	G_percent(row, nrows, 2);
 	
         /* read input maps */ 
-        if (G_get_raster_row(infd,inr,row,DCELL_TYPE)< 0)
+        if (Rast_get_raster_row(infd,inr,row,DCELL_TYPE)< 0)
 	    G_fatal_error(_("Could not read from <%s>"), ndvi);
 	
         /*process the data */ 
         for (col = 0; col < ncols; col++)
         {
             d_ndvi = ((DCELL *) inr)[col];
-	    if (G_is_d_null_value(&d_ndvi)) 
-		G_set_d_null_value(&outr[col], 1);
+	    if (Rast_is_d_null_value(&d_ndvi)) 
+		Rast_set_d_null_value(&outr[col], 1);
 	    else {
                 /****************************/ 
                 /* calculate emissivity     */ 
@@ -96,17 +97,17 @@ int main(int argc, char *argv[])
 		outr[col] = d;
 	    }
         }
-	if (G_put_raster_row(outfd, outr, DCELL_TYPE) < 0)
+	if (Rast_put_raster_row(outfd, outr, DCELL_TYPE) < 0)
 	    G_fatal_error(_("Cannot write to output raster file"));
     }
     G_free(inr);
-    G_close_cell(infd);
+    Rast_close_cell(infd);
     G_free(outr);
-    G_close_cell(outfd);
+    Rast_close_cell(outfd);
 
-    G_short_history(result1, "raster", &history);
-    G_command_history(&history);
-    G_write_history(result1, &history);
+    Rast_short_history(result1, "raster", &history);
+    Rast_command_history(&history);
+    Rast_write_history(result1, &history);
 
     exit(EXIT_SUCCESS);
 }

+ 39 - 38
imagery/i.evapo.time_integration/main.c

@@ -17,7 +17,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <grass/gis.h>
+#include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/glocale.h>
 
 #define MAXFILES 400
@@ -160,18 +161,18 @@ int main(int argc, char *argv[])
 	}
 	if (!ok)
 	    continue;
-	infd[nfiles] = G_open_cell_old(name, mapset);
+	infd[nfiles] = Rast_open_cell_old(name, mapset);
 	if (infd[nfiles] < 0) {
 	    ok = 0;
 	    continue;
 	}
 	/* Allocate input buffer */
-	in_data_type[nfiles] = G_raster_map_type(name, mapset);
-	if ((infd[nfiles] = G_open_cell_old(name, mapset)) < 0)
+	in_data_type[nfiles] = Rast_raster_map_type(name, mapset);
+	if ((infd[nfiles] = Rast_open_cell_old(name, mapset)) < 0)
 	    G_fatal_error(_("Unable to open raster map <%s>"), name);
-	if ((G_get_cellhd(name, mapset, &cellhd)) < 0)
+	if ((Rast_get_cellhd(name, mapset, &cellhd)) < 0)
 	    G_fatal_error(_("Unable to read file header of raster map <%s>"), name);
-	inrast[nfiles] = G_allocate_raster_buf(in_data_type[nfiles]);
+	inrast[nfiles] = Rast_allocate_raster_buf(in_data_type[nfiles]);
 	nfiles++;
     }
     nfiles--;
@@ -193,18 +194,18 @@ int main(int argc, char *argv[])
 	}
 	if (!ok)
 	    continue;
-	infd1[nfiles1] = G_open_cell_old(name1, mapset);
+	infd1[nfiles1] = Rast_open_cell_old(name1, mapset);
 	if (infd1[nfiles1] < 0) {
 	    ok = 0;
 	    continue;
 	}
 	/* Allocate input buffer */
-	in_data_type1[nfiles1] = G_raster_map_type(name1, mapset);
-	if ((infd1[nfiles1] = G_open_cell_old(name1, mapset)) < 0)
+	in_data_type1[nfiles1] = Rast_raster_map_type(name1, mapset);
+	if ((infd1[nfiles1] = Rast_open_cell_old(name1, mapset)) < 0)
 	    G_fatal_error(_("Unable to open raster map <%s>"), name1);
-	if ((G_get_cellhd(name1, mapset, &cellhd)) < 0)
+	if ((Rast_get_cellhd(name1, mapset, &cellhd)) < 0)
 	    G_fatal_error(_("Unable to read file header of raster map <%s>"), name1);
-	inrast1[nfiles1] = G_allocate_raster_buf(in_data_type1[nfiles1]);
+	inrast1[nfiles1] = Rast_allocate_raster_buf(in_data_type1[nfiles1]);
 	nfiles1++;
     }
     nfiles1--;
@@ -232,20 +233,20 @@ int main(int argc, char *argv[])
 	}
 	if (!ok)
 	    continue;
-	infd2[nfiles2] = G_open_cell_old(name2, mapset);
+	infd2[nfiles2] = Rast_open_cell_old(name2, mapset);
 	if (infd2[nfiles2] < 0) {
 	    ok = 0;
 	    continue;
 	}
 	/* Allocate input buffer */
-	in_data_type2[nfiles2] = G_raster_map_type(name2, mapset);
-	if ((infd2[nfiles2] = G_open_cell_old(name2, mapset)) < 0) {
+	in_data_type2[nfiles2] = Rast_raster_map_type(name2, mapset);
+	if ((infd2[nfiles2] = Rast_open_cell_old(name2, mapset)) < 0) {
 	    G_fatal_error(_("Unable to open raster map <%s>"), name2);
 	}
-	if ((G_get_cellhd(name2, mapset, &cellhd)) < 0) {
+	if ((Rast_get_cellhd(name2, mapset, &cellhd)) < 0) {
 	    G_fatal_error(_("Unable to read file header of raster map <%s>"), name2);
 	}
-	inrast2[nfiles2] = G_allocate_d_raster_buf();
+	inrast2[nfiles2] = Rast_allocate_d_raster_buf();
 	nfiles2++;
     }
     nfiles2--;
@@ -255,11 +256,11 @@ int main(int argc, char *argv[])
     /* Allocate output buffer, use input map data_type */
     nrows = G_window_rows();
     ncols = G_window_cols();
-    outrast = G_allocate_raster_buf(out_data_type);
+    outrast = Rast_allocate_raster_buf(out_data_type);
 
    
     /* Create New raster files */
-    if ((outfd = G_open_raster_new(result, 1)) < 0)
+    if ((outfd = Rast_open_raster_new(result, 1)) < 0)
 	G_fatal_error(_("Unable to create raster map <%s>"), result);
 
     /*******************/
@@ -278,15 +279,15 @@ int main(int argc, char *argv[])
 
 	/* read input map */
 	for (i = 1; i <= nfiles; i++) 
-	    if ((G_get_d_raster_row(infd[i], inrast[i], row)) <	0) 
+	    if ((Rast_get_d_raster_row(infd[i], inrast[i], row)) <	0) 
 		G_fatal_error(_("Unable to read raster map <%s> row %d"), name, row);
 	
 	for (i = 1; i <= nfiles1; i++) 
-	    if ((G_get_d_raster_row(infd1[i], inrast1[i], row)) < 0) 
+	    if ((Rast_get_d_raster_row(infd1[i], inrast1[i], row)) < 0) 
 		G_fatal_error(_("Unable to read raster map <%s> row %d"), name1, row);
 
 	for (i = 1; i <= nfiles2; i++) 
-	    if ((G_get_d_raster_row (infd2[i], inrast2[i], row)) < 0) 
+	    if ((Rast_get_d_raster_row (infd2[i], inrast2[i], row)) < 0) 
 		G_fatal_error(_("Unable to read raster map <%s> row %d"), name2, row);
 
 	/*process the data */
@@ -296,14 +297,14 @@ int main(int argc, char *argv[])
             int	d_null=0;
 	    for (i = 1; i <= nfiles; i++) 
             {
-		    if (G_is_d_null_value(&((DCELL *) inrast[i])[col]))
+		    if (Rast_is_d_null_value(&((DCELL *) inrast[i])[col]))
 		    	d_null=1;
 		    else
 	                d[i] = (double)((DCELL *) inrast[i])[col];
 	    }
 	    for (i = 1; i <= nfiles1; i++) 
             {
-		    if (G_is_d_null_value(&((DCELL *) inrast1[i])[col]))
+		    if (Rast_is_d_null_value(&((DCELL *) inrast1[i])[col]))
 			d1_null=1;
 		    else
 	                d1[i] = ((DCELL *) inrast1[i])[col];
@@ -316,12 +317,12 @@ int main(int argc, char *argv[])
 	    for (i = 1; i <= nfiles1; i++) 
             {
 		if ( d_null==1 || d1_null==1 )
-			G_set_d_null_value(&outrast[col],1);	
+			Rast_set_d_null_value(&outrast[col],1);	
 		else
 		{
 			doy[i] = d1[i] - etodoy+1;
-			if (G_is_d_null_value(&d2[(int)doy[i]]) || d2[(int)doy[i]]==0 )
-				G_set_d_null_value(&outrast[col],1);
+			if (Rast_is_d_null_value(&d2[(int)doy[i]]) || d2[(int)doy[i]]==0 )
+				Rast_set_d_null_value(&outrast[col],1);
 			else
 				d_ETrF[i] = d[i] / d2[(int)doy[i]];
 		} 
@@ -384,7 +385,7 @@ int main(int argc, char *argv[])
                 else
                 {
 			if (DOYbeforeETa[i]==0 || DOYbeforeETa[i]==0 ) 	
-                            G_set_d_null_value(&outrast[col],1);
+                            Rast_set_d_null_value(&outrast[col],1);
 			else 
                         {
 				bfr = (int)DOYbeforeETa[i];
@@ -400,7 +401,7 @@ int main(int argc, char *argv[])
 	    for (i = 1; i <= nfiles1; i++)
             {
 		if(d_null==1 || d_null==1)
-			G_set_d_null_value(&outrast[col],1);
+			Rast_set_d_null_value(&outrast[col],1);
 		else
                 {	
 			d_out += d_ETrF[i] * sum[i];
@@ -408,28 +409,28 @@ int main(int argc, char *argv[])
 		}	
 	    }
 	}
-	if (G_put_raster_row(outfd, outrast, out_data_type) < 0)
+	if (Rast_put_raster_row(outfd, outrast, out_data_type) < 0)
 	    G_fatal_error(_("Unable to write to raster map<%s>"), result);
     }
 
     for (i = 1; i <= nfiles; i++) {
 	G_free(inrast[i]);
-	G_close_cell(infd[i]);
+	Rast_close_cell(infd[i]);
 	G_free(inrast1[i]);
-	G_close_cell(infd1[i]);
+	Rast_close_cell(infd1[i]);
 	G_free(inrast2[i]);
-	G_close_cell(infd2[i]);
+	Rast_close_cell(infd2[i]);
     }
     G_free(outrast);
-    G_close_cell(outfd);
+    Rast_close_cell(outfd);
 
     /* Color table from 0.0 to 10.0 */
-    G_init_colors(&colors);
-    G_add_color_rule(0.0, 0, 0, 0, 10.0, 255, 255, 255, &colors);
+    Rast_init_colors(&colors);
+    Rast_add_color_rule(0.0, 0, 0, 0, 10.0, 255, 255, 255, &colors);
     /* Metadata */
-    G_short_history(result, "raster", &history);
-    G_command_history(&history);
-    G_write_history(result, &history);
+    Rast_short_history(result, "raster", &history);
+    Rast_command_history(&history);
+    Rast_write_history(result, &history);
 
     exit(EXIT_SUCCESS);
 }

+ 19 - 18
imagery/i.fft/main.c

@@ -37,6 +37,7 @@
 #include <stdlib.h>
 #include <math.h>
 #include <grass/gis.h>
+#include <grass/Rast.h>
 #include <grass/gmath.h>
 #include <grass/glocale.h>
 
@@ -46,12 +47,12 @@ static void fft_colors(const char *name)
     struct FPRange range;
     DCELL min, max;
 
-    G_read_fp_range(name, G_mapset(), &range);
-    G_get_fp_range_min_max(&range, &min, &max);
-    G_make_wave_colors(&wave, min, max);
-    G_abs_log_colors(&colors, &wave, 100);
-    G_write_colors(name, G_mapset(), &colors);
-    G_free_colors(&colors);
+    Rast_read_fp_range(name, G_mapset(), &range);
+    Rast_get_fp_range_min_max(&range, &min, &max);
+    Rast_make_wave_colors(&wave, min, max);
+    Rast_abs_log_colors(&colors, &wave, 100);
+    Rast_write_colors(name, G_mapset(), &colors);
+    Rast_free_colors(&colors);
 }
 
 int main(int argc, char *argv[])
@@ -98,11 +99,11 @@ int main(int argc, char *argv[])
     Cellmap_real = opt.real->answer;
     Cellmap_imag = opt.imag->answer;
 
-    inputfd = G_open_cell_old(Cellmap_orig, "");
+    inputfd = Rast_open_cell_old(Cellmap_orig, "");
     if (inputfd < 0)
 	G_fatal_error(_("Unable to open raster map <%s>"), Cellmap_orig);
 
-    if (G_maskfd() >= 0)
+    if (Rast_maskfd() >= 0)
 	G_warning(_("Raster MASK found, consider to remove "
 		    "(see man-page). Will continue..."));
 
@@ -120,8 +121,8 @@ int main(int argc, char *argv[])
     data = G_malloc(rows * cols * 2 * sizeof(double));
 
     /* allocate the space for one row of cell map data */
-    cell_real = G_allocate_d_raster_buf();
-    cell_imag = G_allocate_d_raster_buf();
+    cell_real = Rast_allocate_d_raster_buf();
+    cell_imag = Rast_allocate_d_raster_buf();
 
 #define C(i, j) ((i) * cols + (j))
 
@@ -129,7 +130,7 @@ int main(int argc, char *argv[])
     G_message(_("Reading the raster map <%s>..."),
 	      Cellmap_orig);
     for (i = 0; i < rows; i++) {
-	if (G_get_d_raster_row(inputfd, cell_real, i) < 0)
+	if (Rast_get_d_raster_row(inputfd, cell_real, i) < 0)
 	    G_fatal_error(_("Unable to read raster map <%s> row %d"),
 			  Cellmap_orig, i);
 	for (j = 0; j < cols; j++) {
@@ -141,16 +142,16 @@ int main(int argc, char *argv[])
     }
 
     /* close input cell map */
-    G_close_cell(inputfd);
+    Rast_close_cell(inputfd);
 
     /* perform FFT */
     G_message(_("Starting FFT..."));
     fft2(-1, data, totsize, cols, rows);
 
     /* open the output cell maps */
-    if ((realfd = G_open_fp_cell_new(Cellmap_real)) < 0)
+    if ((realfd = Rast_open_fp_cell_new(Cellmap_real)) < 0)
 	G_fatal_error(_("Unable to create raster map <%s>"), Cellmap_real);
-    if ((imagfd = G_open_fp_cell_new(Cellmap_imag)) < 0)
+    if ((imagfd = Rast_open_fp_cell_new(Cellmap_imag)) < 0)
 	G_fatal_error(_("Unable to create raster map <%s>"), Cellmap_imag);
 
 #define SWAP1(a, b)				\
@@ -182,14 +183,14 @@ int main(int argc, char *argv[])
 	    cell_real[j] = data[C(i, j)][0];
 	    cell_imag[j] = data[C(i, j)][1];
 	}
-	G_put_d_raster_row(realfd, cell_real);
-	G_put_d_raster_row(imagfd, cell_imag);
+	Rast_put_d_raster_row(realfd, cell_real);
+	Rast_put_d_raster_row(imagfd, cell_imag);
 
 	G_percent(i+1, rows, 2);
     }
 
-    G_close_cell(realfd);
-    G_close_cell(imagfd);
+    Rast_close_cell(realfd);
+    Rast_close_cell(imagfd);
 
     G_free(cell_real);
     G_free(cell_imag);

+ 0 - 0
imagery/i.gensig/alloc.c


Some files were not shown because too many files changed in this diff