gis.h 28 KB

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