1 /*
2  *****************************************************************************
3  *
4  * MODULE:      Grass Include Files
5  * AUTHOR(S):   Original author unknown - probably CERL
6  *              Justin Hickey - Thailand - jhickey@hpcc.nectec.or.th
7  * PURPOSE:     This file contains the prototypes for all the functions in the
8  *              gis library (src/libes/gis).
9  * COPYRIGHT:    (C) 2000 by the GRASS Development Team
10  *
11  *               This program is free software under the GNU General Public
12  *              License (>=v2). Read the file COPYING that comes with GRASS
13  *              for details.
14  *
15  *****************************************************************************/
16 
17 #ifndef GRASS_GISDEFS_H
18 #define GRASS_GISDEFS_H
19 
20 /*============================= Include Files ==============================*/
21 
22 /* none */
23 
24 /*=========================== Constants/Defines ============================*/
25 
26 /* none (look in gis.h) */
27 
28 /*=========================== Typedefs/Structures ==========================*/
29 
30 /* none (look in gis.h) */
31 
32 /*============================== Prototypes ================================*/
33 
34 #include <grass/config.h>
35 
36 #ifdef __GNUC__
37 # ifdef __MINGW32__
38 #  include <malloc.h>
39 # else
40 #  if (defined(__unix__) || defined(unix)) && !defined(USG)
41 #   include <sys/param.h>
42 #  endif
43 #  if (defined(BSD))
44     /* no malloc.h, no alloca.h ?
45      * TODO: better
46      * check if alloca.h exists,
47      * if not, check if malloc.h exists,
48      * if not use stdlib.h */
49 #   include <stdlib.h>
50 #  else
51 #   include <alloca.h>
52 #  endif
53 # endif
54 # define G_alloca(n) alloca(n)
55 # define G_freea(p)
56 #else
57 # define G_alloca(n) G_malloc(n)
58 # define G_freea(p) G_free(p)
59 #endif
60 
61 #include <stdarg.h>
62 #include <stdio.h>
63 
64 #ifndef CTYPESGEN
65 #include <setjmp.h>
66 #endif
67 
68 #include <sys/types.h>
69 #include <sys/stat.h>
70 
71 #ifndef RELDIR
72 #define RELDIR "?"
73 #endif
74 
75 /* GDAL < 2.3 does not define HAVE_LONG_LONG when compiled with
76  * Visual Studio as for OSGeo4W, even though long long is available,
77  * and GIntBig falls back to long which is on Windows always 4 bytes.
78  * This patch ensures that GIntBig is defined as long long (8 bytes)
79  * if GDAL is compiled with Visual Studio and GRASS is compiled with
80  * MinGW. This patch must be applied before other GDAL/OGR headers are
81  * included, as done by gprojects.h and vector.h */
82 #if defined(__MINGW32__) && HAVE_GDAL
83 # include <gdal_version.h>
84 # if GDAL_VERSION_NUM < 2030000
85 #  include <cpl_config.h>
86    /* HAVE_LONG_LONG_INT comes from GRASS
87     * HAVE_LONG_LONG comes from GDAL */
88 #  if HAVE_LONG_LONG_INT && !defined(HAVE_LONG_LONG)
89 #   define HAVE_LONG_LONG 1
90 #  endif
91 # endif
92 #endif
93 
94 /* adj_cellhd.c */
95 void G_adjust_Cell_head(struct Cell_head *, int, int);
96 void G_adjust_Cell_head3(struct Cell_head *, int, int, int);
97 int G_adjust_window_ll(struct Cell_head *cellhd);
98 
99 /* alloc.c */
100 #define G_incr_void_ptr(ptr, size) \
101     ((void *)((const unsigned char *)(ptr) + (size)))
102 
103 void *G__malloc(const char *, int, size_t);
104 void *G__calloc(const char *, int, size_t, size_t);
105 void *G__realloc(const char *, int, void *, size_t);
106 void G_free(void *);
107 #ifndef G_incr_void_ptr
108 void *G_incr_void_ptr(const void *, size_t);
109 #endif
110 
111 #ifndef CTYPESGEN
112 #define G_malloc(n)     G__malloc(RELDIR "/" __FILE__, __LINE__, (n))
113 #define G_calloc(m, n)  G__calloc(RELDIR "/" __FILE__, __LINE__, (m), (n))
114 #define G_realloc(p, n) G__realloc(RELDIR "/" __FILE__, __LINE__, (p), (n))
115 #else
116 #define G_malloc(n)     G__malloc("<ctypesgen>", 0, (n))
117 #define G_calloc(m, n)  G__calloc("<ctypesgen>", 0, (m), (n))
118 #define G_realloc(p, n) G__realloc("<ctypesgen>", 0, (p), (n))
119 #endif
120 
121 /* area.c */
122 int G_begin_cell_area_calculations(void);
123 double G_area_of_cell_at_row(int);
124 int G_begin_polygon_area_calculations(void);
125 double G_area_of_polygon(const double *, const double *, int);
126 
127 /* area_ellipse.c */
128 void G_begin_zone_area_on_ellipsoid(double, double, double);
129 double G_darea0_on_ellipsoid(double);
130 double G_area_for_zone_on_ellipsoid(double, double);
131 
132 /* area_poly1.c */
133 void G_begin_ellipsoid_polygon_area(double, double);
134 double G_ellipsoid_polygon_area(const double *, const double *, int);
135 
136 /* area_poly2.c */
137 double G_planimetric_polygon_area(const double *, const double *, int);
138 
139 /* area_sphere.c */
140 void G_begin_zone_area_on_sphere(double, double);
141 double G_darea0_on_sphere(double);
142 double G_area_for_zone_on_sphere(double, double);
143 
144 /* ascii_chk.c */
145 void G_ascii_check(char *);
146 
147 
148 /* asprintf.c */
149 /* Do it better if you know how */
150 /* asprintf is not found on MINGW but exists */
151 
152 /*
153  *  Because configure script in GDAL test is G_asprintf exists in gis lib
154  *  the G_asprintf macro is disabled until a stable version of GDAL
155  *  with a different function becomes widely used
156  */
157 int G_vasprintf(char **, const char *, va_list);
158 int G_asprintf(char **, const char *, ...)
159     __attribute__ ((format(printf, 2, 3)));
160 
161 int G_rasprintf(char **, size_t *,const char *, ...)
162     __attribute__ ((format(printf, 3, 4)));
163 
164 /* basename.c */
165 char *G_basename(char *, const char *);
166 size_t G_get_num_decimals(const char *);
167 char *G_double_to_basename_format(double, size_t, size_t);
168 char *G_get_basename_separator();
169 char *G_join_basename_strings(const char**, size_t);
170 char *G_generate_basename(const char*, double, size_t, size_t);
171 
172 /* bres_line.c */
173 void G_bresenham_line(int, int, int, int, int (*)(int, int));
174 
175 /* clicker.c */
176 void G_clicker(void);
177 
178 /* color_rules.c */
179 char *G_color_rules_options(void);
180 char *G_color_rules_descriptions(void);
181 char *G_color_rules_description_type(void);
182 void G_list_color_rules(FILE *);
183 void G_list_color_rules_description_type(FILE *, char *);
184 int G_find_color_rule(const char *);
185 
186 /* color_str.c */
187 int G_num_standard_colors(void);
188 
189 /* commas.c */
190 int G_insert_commas(char *);
191 void G_remove_commas(char *);
192 
193 /* compress.c */
194 int G_compressor_number(char *);
195 char *G_compressor_name(int);
196 int G_default_compressor(void);
197 int G_check_compressor(int);
198 int G_write_compressed(int, unsigned char *, int, int);
199 int G_write_unompressed(int, unsigned char *, int);
200 int G_read_compressed(int, int, unsigned char *, int, int);
201 int G_compress_bound(int, int);
202 int G_compress(unsigned char *, int, unsigned char *, int, int);
203 int G_expand(unsigned char *, int, unsigned char *, int, int);
204 
205 /* compress.c : no compression */
206 int
207 G_no_compress(unsigned char *src, int src_sz, unsigned char *dst,
208 		int dst_sz);
209 int
210 G_no_expand(unsigned char *src, int src_sz, unsigned char *dst,
211 	      int dst_sz);
212 
213 /* cmprrle.c : Run Length Encoding (RLE) */
214 int
215 G_rle_compress(unsigned char *src, int src_sz, unsigned char *dst,
216 		int dst_sz);
217 int
218 G_rle_expand(unsigned char *src, int src_sz, unsigned char *dst,
219 	      int dst_sz);
220 
221 /* cmprzlib.c : ZLIB's DEFLATE */
222 int
223 G_zlib_compress(unsigned char *src, int src_sz, unsigned char *dst,
224 		int dst_sz);
225 int
226 G_zlib_expand(unsigned char *src, int src_sz, unsigned char *dst,
227 	      int dst_sz);
228 
229 /* cmprlz4.c : LZ4, extremely fast */
230 int
231 G_lz4_compress(unsigned char *src, int src_sz, unsigned char *dst,
232 		int dst_sz);
233 int
234 G_lz4_expand(unsigned char *src, int src_sz, unsigned char *dst,
235 	      int dst_sz);
236 
237 /* cmprbzip.c : BZIP2, high compression, faster than ZLIB's DEFLATE with level 9 */
238 int
239 G_bz2_compress(unsigned char *src, int src_sz, unsigned char *dst,
240 		int dst_sz);
241 int
242 G_bz2_expand(unsigned char *src, int src_sz, unsigned char *dst,
243 	      int dst_sz);
244 
245 /* cmprzstd.c : ZSTD, compression similar to ZLIB's DEFLATE but faster */
246 int
247 G_zstd_compress(unsigned char *src, int src_sz, unsigned char *dst,
248 		int dst_sz);
249 int
250 G_zstd_expand(unsigned char *src, int src_sz, unsigned char *dst,
251 	      int dst_sz);
252 
253 /* add more compression methods here */
254 
255 /* copy_dir.c */
256 int G_recursive_copy(const char *, const char *);
257 
258 /* copy_file.c */
259 int G_copy_file(const char *, const char *);
260 
261 /* counter.c */
262 int G_is_initialized(int *);
263 void G_initialize_done(int *);
264 void G_init_counter(struct Counter *, int);
265 int G_counter_next(struct Counter *);
266 
267 /* date.c */
268 const char *G_date(void);
269 
270 /* datum.c */
271 int G_get_datum_by_name(const char *);
272 const char *G_datum_name(int);
273 const char *G_datum_description(int);
274 const char *G_datum_ellipsoid(int);
275 int G_get_datumparams_from_projinfo(const struct Key_Value *, char *, char *);
276 void G_read_datum_table(void);
277 
278 
279 /* debug.c */
280 void G_init_debug(void);
281 int G_debug(int, const char *, ...) __attribute__ ((format(printf, 2, 3)));
282 
283 /* distance.c */
284 int G_begin_distance_calculations(void);
285 double G_distance(double, double, double, double);
286 double G_distance_between_line_segments(double, double, double, double,
287 					double, double, double, double);
288 double G_distance_point_to_line_segment(double, double, double, double,
289 					double, double);
290 
291 /* done_msg.c */
292 void G_done_msg(const char *, ...) __attribute__ ((format(printf, 1, 2)));
293 
294 /* endian.c */
295 int G_is_little_endian(void);
296 
297 /* env.c */
298 void G_init_env(void);
299 const char *G_getenv(const char *);
300 const char *G_getenv2(const char *, int);
301 const char *G_getenv_nofatal(const char *);
302 const char *G_getenv_nofatal2(const char *, int);
303 void G_setenv(const char *, const char *);
304 void G_setenv2(const char *, const char *, int);
305 void G_setenv_nogisrc(const char *, const char *);
306 void G_setenv_nogisrc2(const char *, const char *, int);
307 void G_unsetenv(const char *);
308 void G_unsetenv2(const char *, int);
309 const char *G_get_env_name(int);
310 void G_set_gisrc_mode(int);
311 int G_get_gisrc_mode(void);
312 void G_create_alt_env(void);
313 void G_switch_env(void);
314 void G__read_mapset_env(void);
315 void G__read_gisrc_env(void);
316 
317 /* error.c */
318 #ifndef CTYPESGEN
319 jmp_buf *G_fatal_longjmp(int);
320 #endif
321 
322 int G_info_format(void);
323 void G_message(const char *, ...) __attribute__ ((format(printf, 1, 2)));
324 void G_verbose_message(const char *, ...)
325     __attribute__ ((format(printf, 1, 2)));
326 void G_important_message(const char *, ...)
327     __attribute__ ((format(printf, 1, 2)));
328 void G_fatal_error(const char *, ...) __attribute__ ((format(printf, 1, 2)))
329     __attribute__ ((noreturn));
330 void G_warning(const char *, ...) __attribute__ ((format(printf, 1, 2)));
331 int G_suppress_warnings(int);
332 int G_sleep_on_error(int);
333 void G_set_error_routine(int (*)(const char *, int));
334 void G_unset_error_routine(void);
335 void G_init_logging(void);
336 
337 /* file_name.c */
338 char *G_file_name(char *, const char *, const char *, const char *);
339 char *G_file_name_misc(char *, const char *, const char *, const char *,
340 		       const char *);
341 char *G_file_name_tmp(char *, const char *, const char *, const char *);
342 
343 /* find_file.c */
344 const char *G_find_file(const char *, char *, const char *);
345 const char *G_find_file2(const char *, const char *, const char *);
346 const char *G_find_file_misc(const char *, const char *, char *, const char *);
347 const char *G_find_file2_misc(const char *, const char *, const char *,
348 			      const char *);
349 
350 /* find_etc.c */
351 char *G_find_etc(const char *);
352 
353 /* find_rast.c */
354 const char *G_find_raster(char *, const char *);
355 const char *G_find_raster2(const char *, const char *);
356 
357 /* find_rast3d.c */
358 const char *G_find_raster3d(const char *, const char *);
359 
360 /* find_vect.c */
361 const char *G_find_vector(char *, const char *);
362 const char *G_find_vector2(const char *, const char *);
363 
364 /* geodesic.c */
365 int G_begin_geodesic_equation(double, double, double, double);
366 double G_geodesic_lat_from_lon(double);
367 
368 /* geodist.c */
369 void G_begin_geodesic_distance(double, double);
370 void G_set_geodesic_distance_lat1(double);
371 void G_set_geodesic_distance_lat2(double);
372 double G_geodesic_distance_lon_to_lon(double, double);
373 double G_geodesic_distance(double, double, double, double);
374 
375 /* get_ellipse.c */
376 int G_get_ellipsoid_parameters(double *, double *);
377 int G_get_spheroid_by_name(const char *, double *, double *, double *);
378 int G_get_ellipsoid_by_name(const char *, double *, double *);
379 const char *G_ellipsoid_name(int);
380 const char *G_ellipsoid_description(int);
381 int G_read_ellipsoid_table(int);
382 
383 /* get_projinfo.c */
384 struct Key_Value *G_get_projunits(void);
385 struct Key_Value *G_get_projinfo(void);
386 struct Key_Value *G_get_projepsg(void);
387 char *G_get_projwkt(void);
388 char *G_get_projsrid(void);
389 
390 /* get_window.c */
391 void G_get_window(struct Cell_head *);
392 void G_get_default_window(struct Cell_head *);
393 void G_get_element_window(struct Cell_head *, const char *, const char *,
394                           const char *);
395 
396 /* getl.c */
397 int G_getl(char *, int, FILE *);
398 int G_getl2(char *, int, FILE *);
399 
400 /* gisbase.c */
401 const char *G_gisbase(void);
402 
403 /* gisdbase.c */
404 const char *G_gisdbase(void);
405 
406 /* gisinit.c */
407 void G__gisinit(const char *, const char *);
408 void G__no_gisinit(const char *);
409 void G_init_all(void);
410 
411 /* handler.c */
412 void G_add_error_handler(void (*)(void *), void *);
413 void G_remove_error_handler(void (*)(void *), void *);
414 
415 /* home.c */
416 const char *G_home(void);
417 const char *G_config_path(void);
418 
419 /* ilist.c */
420 void G_init_ilist(struct ilist *);
421 void G_free_ilist(struct ilist *);
422 struct ilist * G_new_ilist();
423 void G_ilist_add(struct ilist *, int);
424 
425 /* intersect.c */
426 int G_intersect_line_segments(double, double, double, double, double, double,
427 			      double, double, double *, double *, double *,
428 			      double *);
429 
430 /* is.c */
431 int G_is_gisbase(const char *);
432 int G_is_location(const char *);
433 int G_is_mapset(const char *);
434 
435 /* key_value1.c */
436 struct Key_Value *G_create_key_value(void);
437 void G_set_key_value(const char *, const char *, struct Key_Value *);
438 const char *G_find_key_value(const char *, const struct Key_Value *);
439 void G_free_key_value(struct Key_Value *);
440 
441 /* key_value2.c */
442 int G_fwrite_key_value(FILE *, const struct Key_Value *);
443 struct Key_Value *G_fread_key_value(FILE *);
444 
445 /* key_value3.c */
446 void G_write_key_value_file(const char *, const struct Key_Value *);
447 struct Key_Value *G_read_key_value_file(const char *);
448 
449 /* key_value4.c */
450 void G_update_key_value_file(const char *, const char *, const char *);
451 int G_lookup_key_value_from_file(const char *, const char *, char[], int);
452 
453 /* legal_name.c */
454 int G_legal_filename(const char *);
455 int G_check_input_output_name(const char *, const char *, int);
456 
457 /* line_dist.c */
458 void G_set_distance_to_line_tolerance(double);
459 double G_distance2_point_to_line(double, double, double, double, double,
460 				 double);
461 
462 /* list.c */
463 void G_list_element(const char *, const char *, const char *,
464 		    int (*)(const char *, const char *, const char *));
465 char **G_list(int, const char *, const char *, const char *);
466 void G_free_list(char **);
467 
468 /* ll_format.c */
469 void G_lat_format(double, char *);
470 const char *G_lat_format_string(void);
471 void G_lon_format(double, char *);
472 const char *G_lon_format_string(void);
473 void G_llres_format(double, char *);
474 const char *G_llres_format_string(void);
475 void G_lat_parts(double, int *, int *, double *, char *);
476 void G_lon_parts(double, int *, int *, double *, char *);
477 
478 /* ll_scan.c */
479 int G_lat_scan(const char *, double *);
480 int G_lon_scan(const char *, double *);
481 int G_llres_scan(const char *, double *);
482 
483 /* location.c */
484 const char *G_location(void);
485 char *G_location_path(void);
486 
487 /* lrand48.c */
488 void G_srand48(long);
489 long G_srand48_auto(void);
490 long G_lrand48(void);
491 long G_mrand48(void);
492 double G_drand48(void);
493 
494 /* ls.c */
495 void G_set_ls_filter(int (*)(const char *, void *), void *);
496 void G_set_ls_exclude_filter(int (*)(const char *, void *), void *);
497 char **G_ls2(const char *, int *);
498 void G_ls(const char *, FILE *);
499 void G_ls_format(char **, int, int, FILE *);
500 
501 /* ls_filter.c */
502 #ifdef HAVE_REGEX_H
503 void *G_ls_regex_filter(const char *, int, int, int);
504 void *G_ls_glob_filter(const char *, int, int);
505 void G_free_ls_filter(void *);
506 #endif
507 
508 /* make_loc.c */
509 int G_make_location(const char *, struct Cell_head *, const struct Key_Value *,
510 		    const struct Key_Value *);
511 int G_make_location_epsg(const char *, struct Cell_head *, const struct Key_Value *,
512 			 const struct Key_Value *, const struct Key_Value *);
513 int G_make_location_crs(const char *, struct Cell_head *,
514 			const struct Key_Value *, const struct Key_Value *,
515 			const char *, const char *);
516 int G_write_projsrid(const char *, const char *);
517 int G_write_projwkt(const char *, const char *);
518 int G_compare_projections(const struct Key_Value *, const struct Key_Value *,
519 			  const struct Key_Value *, const struct Key_Value *);
520 
521 /* make_mapset.c */
522 int G_make_mapset(const char *, const char *, const char *);
523 
524 /* mapcase.c */
525 char *G_tolcase(char *);
526 char *G_toucase(char *);
527 
528 /* mapset.c */
529 const char *G_mapset(void);
530 char *G_mapset_path(void);
531 
532 /* mapset_msc.c */
533 int G_make_mapset_element(const char *);
534 int G_make_mapset_element_tmp(const char *);
535 int G__make_mapset_element_misc(const char *, const char *);
536 int G_mapset_permissions(const char *);
537 int G_mapset_permissions2(const char *, const char *, const char *);
538 
539 /* mapset_nme.c */
540 const char *G_get_mapset_name(int);
541 void G_create_alt_search_path(void);
542 void G_switch_search_path(void);
543 void G_reset_mapsets(void);
544 char **G_get_available_mapsets(void);
545 void G_add_mapset_to_search_path(const char *);
546 int G_is_mapset_in_search_path(const char *);
547 
548 /* myname.c */
549 char *G_myname(void);
550 
551 /* named_colr.c */
552 int G_color_values(const char *, float *, float *, float *);
553 const char *G_color_name(int);
554 
555 /* nl_to_spaces.c */
556 void G_newlines_to_spaces(char *);
557 
558 /* nme_in_mps.c */
559 int G_name_is_fully_qualified(const char *, char *, char *);
560 char *G_fully_qualified_name(const char *, const char *);
561 int G_unqualified_name(const char *, const char *, char *, char *);
562 
563 /* open.c */
564 int G_open_new(const char *, const char *);
565 int G_open_old(const char *, const char *, const char *);
566 int G_open_update(const char *, const char *);
567 FILE *G_fopen_new(const char *, const char *);
568 FILE *G_fopen_old(const char *, const char *, const char *);
569 FILE *G_fopen_append(const char *, const char *);
570 FILE *G_fopen_modify(const char *, const char *);
571 
572 /* open_misc.c */
573 int G_open_new_misc(const char *, const char *, const char *);
574 int G_open_old_misc(const char *, const char *, const char *, const char *);
575 int G_open_update_misc(const char *, const char *, const char *);
576 FILE *G_fopen_new_misc(const char *, const char *, const char *);
577 FILE *G_fopen_old_misc(const char *, const char *, const char *,
578 		       const char *);
579 FILE *G_fopen_append_misc(const char *, const char *, const char *);
580 FILE *G_fopen_modify_misc(const char *, const char *, const char *);
581 
582 /* overwrite.c */
583 int G_check_overwrite(int argc, char **argv);
584 
585 /* pager.c */
586 FILE *G_open_pager(struct Popen *);
587 void G_close_pager(struct Popen *);
588 FILE *G_open_mail(struct Popen *);
589 void G_close_mail(struct Popen *);
590 
591 /* parser.c */
592 void G_disable_interactive(void);
593 struct GModule *G_define_module(void);
594 struct Flag *G_define_flag(void);
595 struct Option *G_define_option(void);
596 struct Option *G_define_standard_option(int);
597 struct Flag *G_define_standard_flag(int);
598 int G_parser(int, char **);
599 void G_usage(void);
600 char *G_recreate_command(void);
601 void G_add_keyword(const char *);
602 void G_set_keywords(const char *);
603 int G_get_overwrite();
604 char *G_option_to_separator(const struct Option *);
605 FILE *G_open_option_file(const struct Option *);
606 void G_close_option_file(FILE *);
607 
608 /* parser_dependencies.c */
609 void G_option_rule(int, int, void **);
610 void G_option_exclusive(void *, ...);
611 void G_option_required(void *, ...);
612 void G_option_requires(void *, ...);
613 void G_option_requires_all(void *, ...);
614 void G_option_excludes(void *, ...);
615 void G_option_collective(void *, ...);
616 
617 /* paths.c */
618 int G_mkdir(const char *);
619 int G_is_dirsep(char);
620 int G_is_absolute_path(const char *);
621 char *G_convert_dirseps_to_host(char *);
622 char *G_convert_dirseps_from_host(char *);
623 int G_lstat(const char *, struct stat *);
624 int G_stat(const char *, struct stat *);
625 int G_owner(const char *);
626 
627 /* percent.c */
628 void G_percent(long, long, int);
629 void G_percent_reset(void);
630 void G_progress(long, int);
631 void G_set_percent_routine(int (*) (int));
632 void G_unset_percent_routine(void);
633 
634 /* popen.c */
635 void G_popen_clear(struct Popen *);
636 FILE *G_popen_write(struct Popen *, const char *, const char **);
637 FILE *G_popen_read(struct Popen *, const char *, const char **);
638 void G_popen_close(struct Popen *);
639 
640 /* plot.c */
641 void G_setup_plot(double, double, double, double, int (*)(int, int),
642 		  int (*)(int, int));
643 void G_setup_fill(int);
644 void G_plot_where_xy(double, double, int *, int *);
645 void G_plot_where_en(int, int, double *, double *);
646 void G_plot_point(double, double);
647 void G_plot_line(double, double, double, double);
648 void G_plot_line2(double, double, double, double);
649 int G_plot_polygon(const double *, const double *, int);
650 int G_plot_area(double *const *, double *const *, int *, int);
651 void G_plot_fx(double (*)(double), double, double);
652 
653 /* pole_in_poly.c */
654 int G_pole_in_polygon(const double *, const double *, int);
655 
656 /* progrm_nme.c */
657 const char *G_program_name(void);
658 const char *G_original_program_name(void);
659 void G_set_program_name(const char *);
660 
661 /* proj1.c */
662 int G_projection(void);
663 
664 /* proj2.c */
665 int G_projection_units(int);
666 const char *G_projection_name(int);
667 
668 /* proj3.c */
669 const char *G_database_unit_name(int);
670 int G_database_unit();
671 const char *G_database_projection_name(void);
672 const char *G_database_datum_name(void);
673 const char *G_database_ellipse_name(void);
674 double G_database_units_to_meters_factor(void);
675 const char *G_database_epsg_code(void);
676 
677 /* put_window.c */
678 int G_put_window(const struct Cell_head *);
679 int G_put_element_window(const struct Cell_head *, const char *, const char *);
680 
681 /* putenv.c */
682 void G_putenv(const char *, const char *);
683 
684 /* radii.c */
685 double G_meridional_radius_of_curvature(double, double, double);
686 double G_transverse_radius_of_curvature(double, double, double);
687 double G_radius_of_conformal_tangent_sphere(double, double, double);
688 
689 /* rd_cellhd.c */
690 void G__read_Cell_head(FILE *, struct Cell_head *, int);
691 void G__read_Cell_head_array(char **, struct Cell_head *, int);
692 
693 /* remove.c */
694 int G_remove(const char *, const char *);
695 int G_remove_misc(const char *, const char *, const char *);
696 int G_recursive_remove(const char *);
697 
698 /* rename.c */
699 int G_rename_file(const char *, const char *);
700 int G_rename(const char *, const char *, const char *);
701 
702 /* rhumbline.c */
703 int G_begin_rhumbline_equation(double, double, double, double);
704 double G_rhumbline_lat_from_lon(double);
705 
706 /* rotate.c */
707 void G_rotate_around_point(double, double, double *, double *, double);
708 void G_rotate_around_point_int(int, int, int *, int *, double);
709 
710 /* seek.c */
711 off_t G_ftell(FILE *);
712 void G_fseek(FILE *, off_t, int);
713 
714 /* set_window.c */
715 void G_get_set_window(struct Cell_head *);
716 void G_set_window(struct Cell_head *);
717 void G_unset_window();
718 
719 /* short_way.c */
720 void G_shortest_way(double *, double *);
721 
722 /* sleep.c */
723 void G_sleep(unsigned int);
724 
725 /* snprintf.c */
726 int G_snprintf(char *, size_t, const char *, ...)
727     __attribute__ ((format(printf, 3, 4)));
728 
729 /* strings.c */
730 int G_strcasecmp(const char *, const char *);
731 int G_strncasecmp(const char *, const char *, int);
732 char *G_store(const char *);
733 char *G_store_upper(const char *);
734 char *G_store_lower(const char *);
735 char *G_strchg(char *, char, char);
736 char *G_str_replace(const char *, const char *, const char *);
737 void G_strip(char *);
738 char *G_chop(char *);
739 void G_str_to_upper(char *);
740 void G_str_to_lower(char *);
741 int G_str_to_sql(char *);
742 void G_squeeze(char *);
743 char *G_strcasestr(const char *, const char *);
744 
745 /* tempfile.c */
746 void G_init_tempfile(void);
747 char *G_tempfile(void);
748 char *G_tempfile_pid(int);
749 void G_temp_element(char *);
750 void G__temp_element(char *, int);
751 
752 /* mkstemp.c */
753 char *G_mktemp(char *);
754 int G_mkstemp(char *, int, int);
755 FILE *G_mkstemp_fp(char *, int, int);
756 
757 /* timestamp.c */
758 void G_init_timestamp(struct TimeStamp *);
759 void G_set_timestamp(struct TimeStamp *, const struct DateTime *);
760 void G_set_timestamp_range(struct TimeStamp *, const struct DateTime *,
761 			   const struct DateTime *);
762 int G_write_timestamp(FILE *, const struct TimeStamp *);
763 void G_get_timestamps(const struct TimeStamp *, struct DateTime *, struct DateTime *, int *);
764 int G_format_timestamp(const struct TimeStamp *, char *);
765 int G_scan_timestamp(struct TimeStamp *, const char *);
766 int G_has_raster_timestamp(const char *, const char *);
767 int G_read_raster_timestamp(const char *, const char *, struct TimeStamp *);
768 int G_write_raster_timestamp(const char *, const struct TimeStamp *);
769 int G_remove_raster_timestamp(const char *);
770 int G_has_vector_timestamp(const char *, const char *, const char *);
771 int G_read_vector_timestamp(const char *, const char *, const char *, struct TimeStamp *);
772 int G_write_vector_timestamp(const char *, const char *, const struct TimeStamp *);
773 int G_remove_vector_timestamp(const char *, const char *);
774 int G_has_raster3d_timestamp(const char *, const char *);
775 int G_read_raster3d_timestamp(const char *, const char *, struct TimeStamp *);
776 int G_remove_raster3d_timestamp(const char *);
777 int G_write_raster3d_timestamp(const char *, const struct TimeStamp *);
778 
779 /* token.c */
780 char **G_tokenize(const char *, const char *);
781 char **G_tokenize2(const char *, const char *, const char *);
782 int G_number_of_tokens(char **);
783 void G_free_tokens(char **);
784 
785 /* trim_dec.c */
786 void G_trim_decimal(char *);
787 
788 /* units.c */
789 double G_meters_to_units_factor(int);
790 double G_meters_to_units_factor_sq(int);
791 const char *G_get_units_name(int, int, int);
792 int G_units(const char *);
793 int G_is_units_type_spatial(int);
794 int G_is_units_type_temporal(int);
795 
796 /* user_config.c */
797 #ifndef __MINGW32__
798 char *G_rc_path(const char *, const char *);
799 #endif
800 
801 /* verbose.c */
802 int G_verbose(void);
803 int G_verbose_min(void);
804 int G_verbose_std(void);
805 int G_verbose_max(void);
806 int G_set_verbose(int);
807 
808 /* view.c */
809 void G_3dview_warning(int);
810 int G_get_3dview_defaults(struct G_3dview *, struct Cell_head *);
811 int G_put_3dview(const char *, const char *, const struct G_3dview *,
812 		 const struct Cell_head *);
813 int G_get_3dview(const char *, const char *, struct G_3dview *);
814 
815 /* whoami.c */
816 const char *G_whoami(void);
817 
818 /* wind_2_box.c */
819 void G_adjust_window_to_box(const struct Cell_head *, struct Cell_head *, int,
820 			    int);
821 
822 /* wind_format.c */
823 void G_format_northing(double, char *, int);
824 void G_format_easting(double, char *, int);
825 void G_format_resolution(double, char *, int);
826 
827 /* wind_in.c */
828 int G_point_in_region(double, double);
829 int G_point_in_window(double, double, const struct Cell_head *);
830 
831 /* wind_limits.c */
832 int G_limit_east(double *, int);
833 int G_limit_west(double *, int);
834 int G_limit_north(double *, int);
835 int G_limit_south(double *, int);
836 
837 /* wind_overlap.c */
838 int G_window_overlap(const struct Cell_head *, double, double, double,
839 		     double);
840 double G_window_percentage_overlap(const struct Cell_head *, double, double,
841 				   double, double);
842 
843 /* wind_scan.c */
844 int G_scan_northing(const char *, double *, int);
845 int G_scan_easting(const char *, double *, int);
846 int G_scan_resolution(const char *, double *, int);
847 
848 /* window_map.c */
849 double G_adjust_east_longitude(double, double);
850 double G_adjust_easting(double, const struct Cell_head *);
851 void G__init_window(void);
852 
853 /* worker.c */
854 void G_begin_execute(void (*func)(void *), void *, void **, int);
855 void G_end_execute(void **);
856 void G_init_workers(void);
857 void G_finish_workers(void);
858 
859 /* wr_cellhd.c */
860 void G__write_Cell_head(FILE *, const struct Cell_head *, int);
861 void G__write_Cell_head3(FILE *, const struct Cell_head *, int);
862 
863 /* writ_zeros.c */
864 void G_write_zeros(int, size_t);
865 
866 /* xdr.c */
867 void G_xdr_get_int(int *, const void *);
868 void G_xdr_put_int(void *, const int *);
869 void G_xdr_get_float(float *, const void *);
870 void G_xdr_put_float(void *, const float *);
871 void G_xdr_get_double(double *, const void *);
872 void G_xdr_put_double(void *, const double *);
873 
874 /* zero.c */
875 void G_zero(void *, int);
876 
877 /* zone.c */
878 int G_zone(void);
879 
880 #endif /* GRASS_GISDEFS_H */
881