gis.h 28 KB

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