gis.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881
  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. /* basename.c */
  135. char *G_basename(char *, const char *);
  136. size_t G_get_num_decimals(const char *);
  137. char *G_double_to_basename_format(double, size_t, size_t);
  138. char *G_get_basename_separator();
  139. char *G_join_basename_strings(const char**, size_t);
  140. char *G_generate_basename(const char*, double, size_t, size_t);
  141. /* bres_line.c */
  142. void G_bresenham_line(int, int, int, int, int (*)(int, int));
  143. /* clicker.c */
  144. void G_clicker(void);
  145. /* color_rules.c */
  146. char *G_color_rules_options(void);
  147. char *G_color_rules_descriptions(void);
  148. char *G_color_rules_description_type(void);
  149. void G_list_color_rules(FILE *);
  150. void G_list_color_rules_description_type(FILE *, char *);
  151. int G_find_color_rule(const char *);
  152. /* color_str.c */
  153. int G_num_standard_colors(void);
  154. /* commas.c */
  155. int G_insert_commas(char *);
  156. void G_remove_commas(char *);
  157. /* compress.c */
  158. int G_compressor_number(char *);
  159. char *G_compressor_name(int);
  160. int G_default_compressor(void);
  161. int G_check_compressor(int);
  162. int G_write_compressed(int, unsigned char *, int, int);
  163. int G_write_unompressed(int, unsigned char *, int);
  164. int G_read_compressed(int, int, unsigned char *, int, int);
  165. int G_compress_bound(int, int);
  166. int G_compress(unsigned char *, int, unsigned char *, int, int);
  167. int G_expand(unsigned char *, int, unsigned char *, int, int);
  168. /* compress.c : no compression */
  169. int
  170. G_no_compress(unsigned char *src, int src_sz, unsigned char *dst,
  171. int dst_sz);
  172. int
  173. G_no_expand(unsigned char *src, int src_sz, unsigned char *dst,
  174. int dst_sz);
  175. /* cmprrle.c : Run Length Encoding (RLE) */
  176. int
  177. G_rle_compress(unsigned char *src, int src_sz, unsigned char *dst,
  178. int dst_sz);
  179. int
  180. G_rle_expand(unsigned char *src, int src_sz, unsigned char *dst,
  181. int dst_sz);
  182. /* cmprzlib.c : ZLIB's DEFLATE */
  183. int
  184. G_zlib_compress(unsigned char *src, int src_sz, unsigned char *dst,
  185. int dst_sz);
  186. int
  187. G_zlib_expand(unsigned char *src, int src_sz, unsigned char *dst,
  188. int dst_sz);
  189. /* cmprlz4.c : LZ4, extremely fast */
  190. int
  191. G_lz4_compress(unsigned char *src, int src_sz, unsigned char *dst,
  192. int dst_sz);
  193. int
  194. G_lz4_expand(unsigned char *src, int src_sz, unsigned char *dst,
  195. int dst_sz);
  196. /* cmprbzip.c : BZIP2, high compression, faster than ZLIB's DEFLATE with level 9 */
  197. int
  198. G_bz2_compress(unsigned char *src, int src_sz, unsigned char *dst,
  199. int dst_sz);
  200. int
  201. G_bz2_expand(unsigned char *src, int src_sz, unsigned char *dst,
  202. int dst_sz);
  203. /* cmprzstd.c : ZSTD, compression similar to ZLIB's DEFLATE but faster */
  204. int
  205. G_zstd_compress(unsigned char *src, int src_sz, unsigned char *dst,
  206. int dst_sz);
  207. int
  208. G_zstd_expand(unsigned char *src, int src_sz, unsigned char *dst,
  209. int dst_sz);
  210. /* add more compression methods here */
  211. /* copy_dir.c */
  212. int G_recursive_copy(const char *, const char *);
  213. /* copy_file.c */
  214. int G_copy_file(const char *, const char *);
  215. /* counter.c */
  216. int G_is_initialized(int *);
  217. void G_initialize_done(int *);
  218. void G_init_counter(struct Counter *, int);
  219. int G_counter_next(struct Counter *);
  220. /* date.c */
  221. const char *G_date(void);
  222. /* datum.c */
  223. int G_get_datum_by_name(const char *);
  224. const char *G_datum_name(int);
  225. const char *G_datum_description(int);
  226. const char *G_datum_ellipsoid(int);
  227. int G_get_datumparams_from_projinfo(const struct Key_Value *, char *, char *);
  228. void G_read_datum_table(void);
  229. /* debug.c */
  230. void G_init_debug(void);
  231. int G_debug(int, const char *, ...) __attribute__ ((format(printf, 2, 3)));
  232. /* distance.c */
  233. int G_begin_distance_calculations(void);
  234. double G_distance(double, double, double, double);
  235. double G_distance_between_line_segments(double, double, double, double,
  236. double, double, double, double);
  237. double G_distance_point_to_line_segment(double, double, double, double,
  238. double, double);
  239. /* done_msg.c */
  240. void G_done_msg(const char *, ...) __attribute__ ((format(printf, 1, 2)));
  241. /* endian.c */
  242. int G_is_little_endian(void);
  243. /* env.c */
  244. void G_init_env(void);
  245. const char *G_getenv(const char *);
  246. const char *G_getenv2(const char *, int);
  247. const char *G_getenv_nofatal(const char *);
  248. const char *G_getenv_nofatal2(const char *, int);
  249. void G_setenv(const char *, const char *);
  250. void G_setenv2(const char *, const char *, int);
  251. void G_setenv_nogisrc(const char *, const char *);
  252. void G_setenv_nogisrc2(const char *, const char *, int);
  253. void G_unsetenv(const char *);
  254. void G_unsetenv2(const char *, int);
  255. const char *G_get_env_name(int);
  256. void G_set_gisrc_mode(int);
  257. int G_get_gisrc_mode(void);
  258. void G_create_alt_env(void);
  259. void G_switch_env(void);
  260. void G__read_mapset_env(void);
  261. void G__read_gisrc_env(void);
  262. /* error.c */
  263. #ifndef CTYPESGEN
  264. jmp_buf *G_fatal_longjmp(int);
  265. #endif
  266. int G_info_format(void);
  267. void G_message(const char *, ...) __attribute__ ((format(printf, 1, 2)));
  268. void G_verbose_message(const char *, ...)
  269. __attribute__ ((format(printf, 1, 2)));
  270. void G_important_message(const char *, ...)
  271. __attribute__ ((format(printf, 1, 2)));
  272. void G_fatal_error(const char *, ...) __attribute__ ((format(printf, 1, 2)))
  273. __attribute__ ((noreturn));
  274. void G_warning(const char *, ...) __attribute__ ((format(printf, 1, 2)));
  275. int G_suppress_warnings(int);
  276. int G_sleep_on_error(int);
  277. void G_set_error_routine(int (*)(const char *, int));
  278. void G_unset_error_routine(void);
  279. void G_init_logging(void);
  280. /* file_name.c */
  281. char *G_file_name(char *, const char *, const char *, const char *);
  282. char *G_file_name_misc(char *, const char *, const char *, const char *,
  283. const char *);
  284. char *G_file_name_tmp(char *, const char *, const char *, const char *);
  285. /* find_file.c */
  286. const char *G_find_file(const char *, char *, const char *);
  287. const char *G_find_file2(const char *, const char *, const char *);
  288. const char *G_find_file_misc(const char *, const char *, char *, const char *);
  289. const char *G_find_file2_misc(const char *, const char *, const char *,
  290. const char *);
  291. /* find_etc.c */
  292. char *G_find_etc(const char *);
  293. /* find_rast.c */
  294. const char *G_find_raster(char *, const char *);
  295. const char *G_find_raster2(const char *, const char *);
  296. /* find_rast3d.c */
  297. const char *G_find_raster3d(const char *, const char *);
  298. /* find_vect.c */
  299. const char *G_find_vector(char *, const char *);
  300. const char *G_find_vector2(const char *, const char *);
  301. /* geodesic.c */
  302. int G_begin_geodesic_equation(double, double, double, double);
  303. double G_geodesic_lat_from_lon(double);
  304. /* geodist.c */
  305. void G_begin_geodesic_distance(double, double);
  306. void G_set_geodesic_distance_lat1(double);
  307. void G_set_geodesic_distance_lat2(double);
  308. double G_geodesic_distance_lon_to_lon(double, double);
  309. double G_geodesic_distance(double, double, double, double);
  310. /* get_ellipse.c */
  311. int G_get_ellipsoid_parameters(double *, double *);
  312. int G_get_spheroid_by_name(const char *, double *, double *, double *);
  313. int G_get_ellipsoid_by_name(const char *, double *, double *);
  314. const char *G_ellipsoid_name(int);
  315. const char *G_ellipsoid_description(int);
  316. int G_read_ellipsoid_table(int);
  317. /* get_projinfo.c */
  318. struct Key_Value *G_get_projunits(void);
  319. struct Key_Value *G_get_projinfo(void);
  320. struct Key_Value *G_get_projepsg(void);
  321. char *G_get_projwkt(void);
  322. char *G_get_projsrid(void);
  323. /* get_window.c */
  324. void G_get_window(struct Cell_head *);
  325. void G_get_default_window(struct Cell_head *);
  326. void G_get_element_window(struct Cell_head *, const char *, const char *,
  327. const char *);
  328. /* getl.c */
  329. int G_getl(char *, int, FILE *);
  330. int G_getl2(char *, int, FILE *);
  331. /* gisbase.c */
  332. const char *G_gisbase(void);
  333. /* gisdbase.c */
  334. const char *G_gisdbase(void);
  335. /* gisinit.c */
  336. void G__gisinit(const char *, const char *);
  337. void G__no_gisinit(const char *);
  338. void G_init_all(void);
  339. /* handler.c */
  340. void G_add_error_handler(void (*)(void *), void *);
  341. void G_remove_error_handler(void (*)(void *), void *);
  342. /* home.c */
  343. const char *G_home(void);
  344. const char *G_config_path(void);
  345. /* ilist.c */
  346. void G_init_ilist(struct ilist *);
  347. void G_free_ilist(struct ilist *);
  348. struct ilist * G_new_ilist();
  349. void G_ilist_add(struct ilist *, int);
  350. /* intersect.c */
  351. int G_intersect_line_segments(double, double, double, double, double, double,
  352. double, double, double *, double *, double *,
  353. double *);
  354. /* is.c */
  355. int G_is_gisbase(const char *);
  356. int G_is_location(const char *);
  357. int G_is_mapset(const char *);
  358. /* key_value1.c */
  359. struct Key_Value *G_create_key_value(void);
  360. void G_set_key_value(const char *, const char *, struct Key_Value *);
  361. const char *G_find_key_value(const char *, const struct Key_Value *);
  362. void G_free_key_value(struct Key_Value *);
  363. /* key_value2.c */
  364. int G_fwrite_key_value(FILE *, const struct Key_Value *);
  365. struct Key_Value *G_fread_key_value(FILE *);
  366. /* key_value3.c */
  367. void G_write_key_value_file(const char *, const struct Key_Value *);
  368. struct Key_Value *G_read_key_value_file(const char *);
  369. /* key_value4.c */
  370. void G_update_key_value_file(const char *, const char *, const char *);
  371. int G_lookup_key_value_from_file(const char *, const char *, char[], int);
  372. /* legal_name.c */
  373. int G_legal_filename(const char *);
  374. int G_check_input_output_name(const char *, const char *, int);
  375. /* line_dist.c */
  376. void G_set_distance_to_line_tolerance(double);
  377. double G_distance2_point_to_line(double, double, double, double, double,
  378. double);
  379. /* list.c */
  380. void G_list_element(const char *, const char *, const char *,
  381. int (*)(const char *, const char *, const char *));
  382. char **G_list(int, const char *, const char *, const char *);
  383. void G_free_list(char **);
  384. /* ll_format.c */
  385. void G_lat_format(double, char *);
  386. const char *G_lat_format_string(void);
  387. void G_lon_format(double, char *);
  388. const char *G_lon_format_string(void);
  389. void G_llres_format(double, char *);
  390. const char *G_llres_format_string(void);
  391. void G_lat_parts(double, int *, int *, double *, char *);
  392. void G_lon_parts(double, int *, int *, double *, char *);
  393. /* ll_scan.c */
  394. int G_lat_scan(const char *, double *);
  395. int G_lon_scan(const char *, double *);
  396. int G_llres_scan(const char *, double *);
  397. /* location.c */
  398. const char *G_location(void);
  399. char *G_location_path(void);
  400. /* lrand48.c */
  401. void G_srand48(long);
  402. long G_srand48_auto(void);
  403. long G_lrand48(void);
  404. long G_mrand48(void);
  405. double G_drand48(void);
  406. /* ls.c */
  407. void G_set_ls_filter(int (*)(const char *, void *), void *);
  408. void G_set_ls_exclude_filter(int (*)(const char *, void *), void *);
  409. char **G_ls2(const char *, int *);
  410. void G_ls(const char *, FILE *);
  411. void G_ls_format(char **, int, int, FILE *);
  412. /* ls_filter.c */
  413. #ifdef HAVE_REGEX_H
  414. void *G_ls_regex_filter(const char *, int, int, int);
  415. void *G_ls_glob_filter(const char *, int, int);
  416. void G_free_ls_filter(void *);
  417. #endif
  418. /* make_loc.c */
  419. int G_make_location(const char *, struct Cell_head *, const struct Key_Value *,
  420. const struct Key_Value *);
  421. int G_make_location_epsg(const char *, struct Cell_head *, const struct Key_Value *,
  422. const struct Key_Value *, const struct Key_Value *);
  423. int G_make_location_crs(const char *, struct Cell_head *,
  424. const struct Key_Value *, const struct Key_Value *,
  425. const char *, const char *);
  426. int G_write_projsrid(const char *, const char *);
  427. int G_write_projwkt(const char *, const char *);
  428. int G_compare_projections(const struct Key_Value *, const struct Key_Value *,
  429. const struct Key_Value *, const struct Key_Value *);
  430. /* make_mapset.c */
  431. int G_make_mapset(const char *, const char *, const char *);
  432. /* mapcase.c */
  433. char *G_tolcase(char *);
  434. char *G_toucase(char *);
  435. /* mapset.c */
  436. const char *G_mapset(void);
  437. char *G_mapset_path(void);
  438. /* mapset_msc.c */
  439. int G_make_mapset_element(const char *);
  440. int G_make_mapset_element_tmp(const char *);
  441. int G__make_mapset_element_misc(const char *, const char *);
  442. int G_mapset_permissions(const char *);
  443. int G_mapset_permissions2(const char *, const char *, const char *);
  444. /* mapset_nme.c */
  445. const char *G_get_mapset_name(int);
  446. void G_create_alt_search_path(void);
  447. void G_switch_search_path(void);
  448. void G_reset_mapsets(void);
  449. char **G_get_available_mapsets(void);
  450. void G_add_mapset_to_search_path(const char *);
  451. int G_is_mapset_in_search_path(const char *);
  452. /* myname.c */
  453. char *G_myname(void);
  454. /* named_colr.c */
  455. int G_color_values(const char *, float *, float *, float *);
  456. const char *G_color_name(int);
  457. /* nl_to_spaces.c */
  458. void G_newlines_to_spaces(char *);
  459. /* nme_in_mps.c */
  460. int G_name_is_fully_qualified(const char *, char *, char *);
  461. char *G_fully_qualified_name(const char *, const char *);
  462. int G_unqualified_name(const char *, const char *, char *, char *);
  463. /* open.c */
  464. int G_open_new(const char *, const char *);
  465. int G_open_old(const char *, const char *, const char *);
  466. int G_open_update(const char *, const char *);
  467. FILE *G_fopen_new(const char *, const char *);
  468. FILE *G_fopen_old(const char *, const char *, const char *);
  469. FILE *G_fopen_append(const char *, const char *);
  470. FILE *G_fopen_modify(const char *, const char *);
  471. /* open_misc.c */
  472. int G_open_new_misc(const char *, const char *, const char *);
  473. int G_open_old_misc(const char *, const char *, const char *, const char *);
  474. int G_open_update_misc(const char *, const char *, const char *);
  475. FILE *G_fopen_new_misc(const char *, const char *, const char *);
  476. FILE *G_fopen_old_misc(const char *, const char *, const char *,
  477. const char *);
  478. FILE *G_fopen_append_misc(const char *, const char *, const char *);
  479. FILE *G_fopen_modify_misc(const char *, const char *, const char *);
  480. /* overwrite.c */
  481. int G_check_overwrite(int argc, char **argv);
  482. /* pager.c */
  483. FILE *G_open_pager(struct Popen *);
  484. void G_close_pager(struct Popen *);
  485. FILE *G_open_mail(struct Popen *);
  486. void G_close_mail(struct Popen *);
  487. /* parser.c */
  488. void G_disable_interactive(void);
  489. struct GModule *G_define_module(void);
  490. struct Flag *G_define_flag(void);
  491. struct Option *G_define_option(void);
  492. struct Option *G_define_standard_option(int);
  493. struct Flag *G_define_standard_flag(int);
  494. int G_parser(int, char **);
  495. void G_usage(void);
  496. char *G_recreate_command(void);
  497. void G_add_keyword(const char *);
  498. void G_set_keywords(const char *);
  499. int G_get_overwrite();
  500. char *G_option_to_separator(const struct Option *);
  501. FILE *G_open_option_file(const struct Option *);
  502. void G_close_option_file(FILE *);
  503. /* parser_dependencies.c */
  504. void G_option_rule(int, int, void **);
  505. void G_option_exclusive(void *, ...);
  506. void G_option_required(void *, ...);
  507. void G_option_requires(void *, ...);
  508. void G_option_requires_all(void *, ...);
  509. void G_option_excludes(void *, ...);
  510. void G_option_collective(void *, ...);
  511. /* paths.c */
  512. int G_mkdir(const char *);
  513. int G_is_dirsep(char);
  514. int G_is_absolute_path(const char *);
  515. char *G_convert_dirseps_to_host(char *);
  516. char *G_convert_dirseps_from_host(char *);
  517. int G_lstat(const char *, struct stat *);
  518. int G_stat(const char *, struct stat *);
  519. int G_owner(const char *);
  520. /* percent.c */
  521. void G_percent(long, long, int);
  522. void G_percent_reset(void);
  523. void G_progress(long, int);
  524. void G_set_percent_routine(int (*) (int));
  525. void G_unset_percent_routine(void);
  526. /* popen.c */
  527. void G_popen_clear(struct Popen *);
  528. FILE *G_popen_write(struct Popen *, const char *, const char **);
  529. FILE *G_popen_read(struct Popen *, const char *, const char **);
  530. void G_popen_close(struct Popen *);
  531. /* plot.c */
  532. void G_setup_plot(double, double, double, double, int (*)(int, int),
  533. int (*)(int, int));
  534. void G_setup_fill(int);
  535. void G_plot_where_xy(double, double, int *, int *);
  536. void G_plot_where_en(int, int, double *, double *);
  537. void G_plot_point(double, double);
  538. void G_plot_line(double, double, double, double);
  539. void G_plot_line2(double, double, double, double);
  540. int G_plot_polygon(const double *, const double *, int);
  541. int G_plot_area(double *const *, double *const *, int *, int);
  542. void G_plot_fx(double (*)(double), double, double);
  543. /* pole_in_poly.c */
  544. int G_pole_in_polygon(const double *, const double *, int);
  545. /* progrm_nme.c */
  546. const char *G_program_name(void);
  547. const char *G_original_program_name(void);
  548. void G_set_program_name(const char *);
  549. /* proj1.c */
  550. int G_projection(void);
  551. /* proj2.c */
  552. int G_projection_units(int);
  553. const char *G_projection_name(int);
  554. /* proj3.c */
  555. const char *G_database_unit_name(int);
  556. int G_database_unit();
  557. const char *G_database_projection_name(void);
  558. const char *G_database_datum_name(void);
  559. const char *G_database_ellipse_name(void);
  560. double G_database_units_to_meters_factor(void);
  561. const char *G_database_epsg_code(void);
  562. /* put_window.c */
  563. int G_put_window(const struct Cell_head *);
  564. int G_put_element_window(const struct Cell_head *, const char *, const char *);
  565. /* putenv.c */
  566. void G_putenv(const char *, const char *);
  567. /* radii.c */
  568. double G_meridional_radius_of_curvature(double, double, double);
  569. double G_transverse_radius_of_curvature(double, double, double);
  570. double G_radius_of_conformal_tangent_sphere(double, double, double);
  571. /* rd_cellhd.c */
  572. void G__read_Cell_head(FILE *, struct Cell_head *, int);
  573. void G__read_Cell_head_array(char **, struct Cell_head *, int);
  574. /* remove.c */
  575. int G_remove(const char *, const char *);
  576. int G_remove_misc(const char *, const char *, const char *);
  577. int G_recursive_remove(const char *);
  578. /* rename.c */
  579. int G_rename_file(const char *, const char *);
  580. int G_rename(const char *, const char *, const char *);
  581. /* rhumbline.c */
  582. int G_begin_rhumbline_equation(double, double, double, double);
  583. double G_rhumbline_lat_from_lon(double);
  584. /* rotate.c */
  585. void G_rotate_around_point(double, double, double *, double *, double);
  586. void G_rotate_around_point_int(int, int, int *, int *, double);
  587. /* seek.c */
  588. off_t G_ftell(FILE *);
  589. void G_fseek(FILE *, off_t, int);
  590. /* set_window.c */
  591. void G_get_set_window(struct Cell_head *);
  592. void G_set_window(struct Cell_head *);
  593. void G_unset_window();
  594. /* short_way.c */
  595. void G_shortest_way(double *, double *);
  596. /* sleep.c */
  597. void G_sleep(unsigned int);
  598. /* snprintf.c */
  599. int G_snprintf(char *, size_t, const char *, ...)
  600. __attribute__ ((format(printf, 3, 4)));
  601. /* strings.c */
  602. int G_strcasecmp(const char *, const char *);
  603. int G_strncasecmp(const char *, const char *, int);
  604. char *G_store(const char *);
  605. char *G_store_upper(const char *);
  606. char *G_store_lower(const char *);
  607. char *G_strchg(char *, char, char);
  608. char *G_str_replace(const char *, const char *, const char *);
  609. void G_strip(char *);
  610. char *G_chop(char *);
  611. void G_str_to_upper(char *);
  612. void G_str_to_lower(char *);
  613. int G_str_to_sql(char *);
  614. void G_squeeze(char *);
  615. char *G_strcasestr(const char *, const char *);
  616. /* tempfile.c */
  617. void G_init_tempfile(void);
  618. char *G_tempfile(void);
  619. char *G_tempfile_pid(int);
  620. void G_temp_element(char *);
  621. void G__temp_element(char *, int);
  622. /* mkstemp.c */
  623. char *G_mktemp(char *);
  624. int G_mkstemp(char *, int, int);
  625. FILE *G_mkstemp_fp(char *, int, int);
  626. /* timestamp.c */
  627. void G_init_timestamp(struct TimeStamp *);
  628. void G_set_timestamp(struct TimeStamp *, const struct DateTime *);
  629. void G_set_timestamp_range(struct TimeStamp *, const struct DateTime *,
  630. const struct DateTime *);
  631. int G_write_timestamp(FILE *, const struct TimeStamp *);
  632. void G_get_timestamps(const struct TimeStamp *, struct DateTime *, struct DateTime *, int *);
  633. int G_format_timestamp(const struct TimeStamp *, char *);
  634. int G_scan_timestamp(struct TimeStamp *, const char *);
  635. int G_has_raster_timestamp(const char *, const char *);
  636. int G_read_raster_timestamp(const char *, const char *, struct TimeStamp *);
  637. int G_write_raster_timestamp(const char *, const struct TimeStamp *);
  638. int G_remove_raster_timestamp(const char *);
  639. int G_has_vector_timestamp(const char *, const char *, const char *);
  640. int G_read_vector_timestamp(const char *, const char *, const char *, struct TimeStamp *);
  641. int G_write_vector_timestamp(const char *, const char *, const struct TimeStamp *);
  642. int G_remove_vector_timestamp(const char *, const char *);
  643. int G_has_raster3d_timestamp(const char *, const char *);
  644. int G_read_raster3d_timestamp(const char *, const char *, struct TimeStamp *);
  645. int G_remove_raster3d_timestamp(const char *);
  646. int G_write_raster3d_timestamp(const char *, const struct TimeStamp *);
  647. /* token.c */
  648. char **G_tokenize(const char *, const char *);
  649. char **G_tokenize2(const char *, const char *, const char *);
  650. int G_number_of_tokens(char **);
  651. void G_free_tokens(char **);
  652. /* trim_dec.c */
  653. void G_trim_decimal(char *);
  654. /* units.c */
  655. double G_meters_to_units_factor(int);
  656. double G_meters_to_units_factor_sq(int);
  657. const char *G_get_units_name(int, int, int);
  658. int G_units(const char *);
  659. int G_is_units_type_spatial(int);
  660. int G_is_units_type_temporal(int);
  661. /* user_config.c */
  662. #ifndef __MINGW32__
  663. char *G_rc_path(const char *, const char *);
  664. #endif
  665. /* verbose.c */
  666. int G_verbose(void);
  667. int G_verbose_min(void);
  668. int G_verbose_std(void);
  669. int G_verbose_max(void);
  670. int G_set_verbose(int);
  671. /* view.c */
  672. void G_3dview_warning(int);
  673. int G_get_3dview_defaults(struct G_3dview *, struct Cell_head *);
  674. int G_put_3dview(const char *, const char *, const struct G_3dview *,
  675. const struct Cell_head *);
  676. int G_get_3dview(const char *, const char *, struct G_3dview *);
  677. /* whoami.c */
  678. const char *G_whoami(void);
  679. /* wind_2_box.c */
  680. void G_adjust_window_to_box(const struct Cell_head *, struct Cell_head *, int,
  681. int);
  682. /* wind_format.c */
  683. void G_format_northing(double, char *, int);
  684. void G_format_easting(double, char *, int);
  685. void G_format_resolution(double, char *, int);
  686. /* wind_in.c */
  687. int G_point_in_region(double, double);
  688. int G_point_in_window(double, double, const struct Cell_head *);
  689. /* wind_limits.c */
  690. int G_limit_east(double *, int);
  691. int G_limit_west(double *, int);
  692. int G_limit_north(double *, int);
  693. int G_limit_south(double *, int);
  694. /* wind_overlap.c */
  695. int G_window_overlap(const struct Cell_head *, double, double, double,
  696. double);
  697. double G_window_percentage_overlap(const struct Cell_head *, double, double,
  698. double, double);
  699. /* wind_scan.c */
  700. int G_scan_northing(const char *, double *, int);
  701. int G_scan_easting(const char *, double *, int);
  702. int G_scan_resolution(const char *, double *, int);
  703. /* window_map.c */
  704. double G_adjust_east_longitude(double, double);
  705. double G_adjust_easting(double, const struct Cell_head *);
  706. void G__init_window(void);
  707. /* worker.c */
  708. void G_begin_execute(void (*func)(void *), void *, void **, int);
  709. void G_end_execute(void **);
  710. void G_init_workers(void);
  711. void G_finish_workers(void);
  712. /* wr_cellhd.c */
  713. void G__write_Cell_head(FILE *, const struct Cell_head *, int);
  714. void G__write_Cell_head3(FILE *, const struct Cell_head *, int);
  715. /* writ_zeros.c */
  716. void G_write_zeros(int, size_t);
  717. /* xdr.c */
  718. void G_xdr_get_int(int *, const void *);
  719. void G_xdr_put_int(void *, const int *);
  720. void G_xdr_get_float(float *, const void *);
  721. void G_xdr_put_float(void *, const float *);
  722. void G_xdr_get_double(double *, const void *);
  723. void G_xdr_put_double(void *, const double *);
  724. /* zero.c */
  725. void G_zero(void *, int);
  726. /* zone.c */
  727. int G_zone(void);
  728. #endif /* GRASS_GISDEFS_H */