|
28 | 28 | #include <stdio.h> |
29 | 29 | #include <string.h> |
30 | 30 | #include <float.h> |
| 31 | +#include <grass/version.h> |
31 | 32 | #include <grass/gis.h> |
32 | 33 | #include <grass/raster.h> |
33 | 34 | #include <grass/display.h> |
34 | 35 | #include <grass/gprojects.h> |
35 | 36 |
|
| 37 | +#if GRASS_VERSION_MAJOR >= 7 |
| 38 | +#define G_allocate_c_raster_buf Rast_allocate_c_buf |
| 39 | +#define G_allocate_d_raster_buf Rast_allocate_d_buf |
| 40 | +#define G_close_cell Rast_close |
| 41 | +#define G_colors_count Rast_colors_count |
| 42 | +#define G_easting_to_col Rast_easting_to_col |
| 43 | +#define G_get_c_raster_row Rast_get_c_row |
| 44 | +#define G_get_cellhd Rast_get_cellhd |
| 45 | +#define G_get_d_raster_row Rast_get_d_row |
| 46 | +#define G_get_f_color_rule Rast_get_fp_color_rule |
| 47 | +#define G_get_fp_range_min_max Rast_get_fp_range_min_max |
| 48 | +#define G_get_raster_map_type Rast_get_map_type |
| 49 | +#define G_is_null_value Rast_is_null_value |
| 50 | +#define G_northing_to_row Rast_northing_to_row |
| 51 | +#define G_open_cell_old Rast_open_old |
| 52 | +#define G_raster_map_type Rast_map_type |
| 53 | +#define G_read_colors Rast_read_colors |
| 54 | +#define G_read_fp_range Rast_read_fp_range |
| 55 | +#define G_window_cols Rast_window_cols |
| 56 | +#define G_window_rows Rast_window_rows |
| 57 | +#endif |
| 58 | + |
36 | 59 | int main( int argc, char **argv ) |
37 | 60 | { |
38 | 61 | struct GModule *module; |
@@ -226,21 +249,29 @@ int main( int argc, char **argv ) |
226 | 249 |
|
227 | 250 | if ( rast_type == CELL_TYPE ) |
228 | 251 | { |
| 252 | +#if GRASS_VERSION_MAJOR < 7 |
229 | 253 | if ( G_get_c_raster_row( fd, cell, row ) < 0 ) |
230 | 254 | { |
231 | 255 | G_fatal_error(( "Unable to read raster map <%s> row %d" ), |
232 | 256 | rast_opt->answer, row ); |
233 | 257 | } |
| 258 | +#else |
| 259 | + G_get_c_raster_row( fd, cell, row ); |
| 260 | +#endif |
234 | 261 | val = cell[col]; |
235 | 262 | ptr = &( cell[col] ); |
236 | 263 | } |
237 | 264 | else |
238 | 265 | { |
| 266 | +#if GRASS_VERSION_MAJOR < 7 |
239 | 267 | if ( G_get_d_raster_row( fd, dcell, row ) < 0 ) |
240 | 268 | { |
241 | 269 | G_fatal_error(( "Unable to read raster map <%s> row %d" ), |
242 | 270 | rast_opt->answer, row ); |
243 | 271 | } |
| 272 | +#else |
| 273 | + G_get_d_raster_row( fd, dcell, row ); |
| 274 | +#endif |
244 | 275 | val = dcell[col]; |
245 | 276 | ptr = &( dcell[col] ); |
246 | 277 | } |
@@ -312,19 +343,27 @@ int main( int argc, char **argv ) |
312 | 343 | { |
313 | 344 | if ( rast_type == CELL_TYPE ) |
314 | 345 | { |
| 346 | +#if GRASS_VERSION_MAJOR < 7 |
315 | 347 | if ( G_get_c_raster_row( fd, cell, row ) < 0 ) |
316 | 348 | { |
317 | 349 | G_fatal_error(( "Unable to read raster map <%s> row %d" ), |
318 | 350 | rast_opt->answer, row ); |
319 | 351 | } |
| 352 | +#else |
| 353 | + G_get_c_raster_row( fd, cell, row ); |
| 354 | +#endif |
320 | 355 | } |
321 | 356 | else |
322 | 357 | { |
| 358 | +#if GRASS_VERSION_MAJOR < 7 |
323 | 359 | if ( G_get_d_raster_row( fd, dcell, row ) < 0 ) |
324 | 360 | { |
325 | 361 | G_fatal_error(( "Unable to read raster map <%s> row %d" ), |
326 | 362 | rast_opt->answer, row ); |
327 | 363 | } |
| 364 | +#else |
| 365 | + G_get_d_raster_row( fd, dcell, row ); |
| 366 | +#endif |
328 | 367 | } |
329 | 368 |
|
330 | 369 | for ( col = 0; col < ncols; col++ ) |
|
0 commit comments