17 #ifndef GRASS_GISDEFS_H 18 #define GRASS_GISDEFS_H 40 # if (defined(__unix__) || defined(unix)) && !defined(USG) 41 # include <sys/param.h> 54 # define G_alloca(n) alloca(n) 57 # define G_alloca(n) G_malloc(n) 58 # define G_freea(p) G_free(p) 68 #include <sys/types.h> 82 #if defined(__MINGW32__) && HAVE_GDAL 83 # include <gdal_version.h> 84 # if GDAL_VERSION_NUM < 2030000 85 # include <cpl_config.h> 88 # if HAVE_LONG_LONG_INT && !defined(HAVE_LONG_LONG) 89 # define HAVE_LONG_LONG 1 100 #define G_incr_void_ptr(ptr, size) \ 101 ((void *)((const unsigned char *)(ptr) + (size))) 103 void *
G__malloc(
const char *,
int,
size_t);
104 void *
G__calloc(
const char *,
int,
size_t,
size_t);
105 void *
G__realloc(
const char *,
int,
void *,
size_t);
107 #ifndef G_incr_void_ptr 112 #define G_malloc(n) G__malloc(RELDIR "/" __FILE__, __LINE__, (n)) 113 #define G_calloc(m, n) G__calloc(RELDIR "/" __FILE__, __LINE__, (m), (n)) 114 #define G_realloc(p, n) G__realloc(RELDIR "/" __FILE__, __LINE__, (p), (n)) 116 #define G_malloc(n) G__malloc("<ctypesgen>", 0, (n)) 117 #define G_calloc(m, n) G__calloc("<ctypesgen>", 0, (m), (n)) 118 #define G_realloc(p, n) G__realloc("<ctypesgen>", 0, (p), (n)) 161 int G_rasprintf(
char **,
size_t *,const
char *, ...)
168 int G_snaprintf(
char *,
size_t, const
char *, ...);
172 int G_vsnaprintf(
char *,
size_t, const
char *, va_list);
212 int G_compress(
unsigned char *,
int,
unsigned char *,
int,
int);
213 int G_expand(
unsigned char *,
int,
unsigned char *,
int,
int);
220 G_no_expand(
unsigned char *src,
int src_sz,
unsigned char *dst,
225 G_rle_compress(
unsigned char *src,
int src_sz,
unsigned char *dst,
228 G_rle_expand(
unsigned char *src,
int src_sz,
unsigned char *dst,
236 G_zlib_expand(
unsigned char *src,
int src_sz,
unsigned char *dst,
241 G_lz4_compress(
unsigned char *src,
int src_sz,
unsigned char *dst,
244 G_lz4_expand(
unsigned char *src,
int src_sz,
unsigned char *dst,
249 G_bz2_compress(
unsigned char *src,
int src_sz,
unsigned char *dst,
252 G_bz2_expand(
unsigned char *src,
int src_sz,
unsigned char *dst,
260 G_zstd_expand(
unsigned char *src,
int src_sz,
unsigned char *dst,
295 double G_distance(
double,
double,
double,
double);
297 double,
double,
double,
double);
310 const
char *
G_getenv2(const
char *,
int);
313 void G_setenv(const
char *, const
char *);
314 void G_setenv2(const
char *, const
char *,
int);
349 char *
G_file_name(
char *, const
char *, const
char *, const
char *);
352 char *
G_file_name_tmp(
char *, const
char *, const
char *, const
char *);
355 const
char *
G_find_file(const
char *,
char *, const
char *);
356 const
char *
G_find_file2(const
char *, const
char *, const
char *);
357 const
char *
G_find_file_misc(const
char *, const
char *,
char *, const
char *);
408 int G_getl(
char *,
int, FILE *);
409 int G_getl2(
char *,
int, FILE *);
438 double,
double,
double *,
double *,
double *,
475 int (*)(const
char *, const
char *, const
char *));
476 char **
G_list(
int, const
char *, const
char *, const
char *);
486 void G_lat_parts(
double,
int *,
int *,
double *,
char *);
487 void G_lon_parts(
double,
int *,
int *,
double *,
char *);
508 char **
G_ls2(const
char *,
int *);
509 void G_ls(const
char *, FILE *);
520 int G_make_location(
const char *,
struct Cell_head *,
const struct Key_Value *,
521 const struct Key_Value *);
523 const struct Key_Value *,
const struct Key_Value *);
525 const struct Key_Value *,
const struct Key_Value *,
526 const char *,
const char *);
530 const struct Key_Value *,
const struct Key_Value *);
579 int G_open_old(
const char *,
const char *,
const char *);
582 FILE *
G_fopen_old(
const char *,
const char *,
const char *);
588 int G_open_old_misc(
const char *,
const char *,
const char *,
const char *);
637 int G_lstat(
const char *,
struct stat *);
638 int G_stat(
const char *,
struct stat *);
655 void G_setup_plot(
double,
double,
double,
double,
int (*)(
int,
int),
664 int G_plot_area(
double *
const *,
double *
const *,
int *,
int);
665 void G_plot_fx(
double (*)(
double),
double,
double);
696 void G_putenv(
const char *,
const char *);
708 int G_remove(
const char *,
const char *);
714 int G_rename(
const char *,
const char *,
const char *);
726 void G_fseek(FILE *, off_t,
int);
740 int G_snprintf(
char *,
size_t,
const char *, ...)
750 char *
G_str_replace(const
char *, const
char *, const
char *);
751 char *
G_str_concat(const
char **,
int, const
char *,
int);
776 const struct DateTime *);
778 void G_get_timestamps(const struct TimeStamp *, struct DateTime *, struct DateTime *,
int *);
795 char **
G_tokenize(const
char *, const
char *);
796 char **
G_tokenize2(const
char *, const
char *, const
char *);
813 char *
G_rc_path(
const char *,
const char *);
827 const struct Cell_head *);
void G_init_debug(void)
Initiate debugging.
int G_getl2(char *, int, FILE *)
Gets a line of text from a file of any pedigree.
int G_strncasecmp(const char *, const char *, int)
String compare ignoring case (upper or lower) - limited number of characters.
void G_unset_error_routine(void)
After this call subsequent error messages will be handled in the default method.
int G_is_location(const char *)
Test if specified directory is location.
int G_make_mapset(const char *, const char *, const char *)
Create a new mapset.
void G_rotate_around_point(double, double, double *, double *, double)
Rotate point (double version)
char * G_file_name_misc(char *, const char *, const char *, const char *, const char *)
Builds full path names to GIS misc data files.
int G_getl(char *, int, FILE *)
Gets a line of text from a file.
void G_remove_commas(char *)
Removes commas from number string.
const char * G_find_file2(const char *, const char *, const char *)
Searches for a file from the mapset search list or in a specified mapset. (look but don't touch) ...
char * G_file_name(char *, const char *, const char *, const char *)
Builds full path names to GIS data files.
const char * G_program_name(void)
Return module name.
FILE * G_fopen_append_misc(const char *, const char *, const char *)
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
void G_free_list(char **)
Free list.
char * G_str_concat(const char **, int, const char *, int)
String concatenation.
int G_owner(const char *)
Get owner id of path.
int G_remove(const char *, const char *)
Remove a database file.
int G_num_standard_colors(void)
Get number of named colors (RGB triplets)
void void void G_important_message(const char *,...) __attribute__((format(printf
char * G_color_rules_description_type(void)
Get color rules description for Option->descriptions.
void G_get_timestamps(const struct TimeStamp *, struct DateTime *, struct DateTime *, int *)
Copy TimeStamp into [two] Datetimes structs.
int G_zone(void)
Query cartographic zone.
int G_mapset_permissions2(const char *, const char *, const char *)
Check for user mapset permission.
int G_verbose(void)
Get current verbosity level.
FILE * G_popen_write(struct Popen *, const char *, const char **)
const char * G_whoami(void)
Gets user's name.
double G_radius_of_conformal_tangent_sphere(double, double, double)
Radius of conformal tangent sphere.
int G_vsaprintf(char *, const char *, va_list)
vsprintf() version of G_aprintf(). See G_aprintf() for more details.
void G_percent_reset(void)
Reset G_percent() to 0%; do not add newline.
void G_end_execute(void **)
const char * G_get_env_name(int)
Get variable name for index n.
int G_is_mapset_in_search_path(const char *)
Check if given mapset is in search path.
struct Key_Value * G_read_key_value_file(const char *)
Read key/values pairs from file.
int G_write_compressed(int, unsigned char *, int, int)
int G_scan_timestamp(struct TimeStamp *, const char *)
Fill a TimeStamp structure from a datetime string.
void G_setenv_nogisrc(const char *, const char *)
Set environment name to value (doesn't update .gisrc)
void G_putenv(const char *, const char *)
Sets the UNIX environment variable name to value.
double G_area_for_zone_on_sphere(double, double)
Calculates area between latitudes.
int G_check_compressor(int)
void G_set_ls_filter(int(*)(const char *, void *), void *)
void G_setenv_nogisrc2(const char *, const char *, int)
Set environment name to value from specific place (doesn't update .gisrc)
struct Key_Value * G_get_projinfo(void)
Gets projection information for location.
void G_done_msg(const char *,...) __attribute__((format(printf
double G_geodesic_distance_lon_to_lon(double, double)
Calculates geodesic distance.
const char * G_lon_format_string(void)
int G_verbose_min(void)
Get min verbosity level.
void G_init_env(void)
Initialize variables.
int G_llres_scan(const char *, double *)
void G_begin_geodesic_distance(double, double)
Begin geodesic distance.
int G_vaprintf(const char *, va_list)
vprintf() version of G_aprintf(). See G_aprintf() for more details.
void G__read_gisrc_env(void)
Force to read the GISRC environment file.
void G_unsetenv(const char *)
Remove name from environment.
const char * G_find_vector2(const char *, const char *)
Find a vector map (look but don't touch)
int G_pole_in_polygon(const double *, const double *, int)
Check if pole is in polygon.
void G_unset_percent_routine(void)
After this call subsequent percentage progress messages will be handled in the default method...
void G_option_required(void *,...)
Sets the options to be required.
const char * G_getenv_nofatal2(const char *, int)
Get environment variable from specific place.
int G_get_3dview(const char *, const char *, struct G_3dview *)
Gets a 3D View.
FILE * G_mkstemp_fp(char *, int, int)
Returns a file descriptor.
void G_set_geodesic_distance_lat1(double)
Sets geodesic distance lat1.
char * G_generate_basename(const char *, double, size_t, size_t)
Generate the format string.
int G_read_ellipsoid_table(int)
Read ellipsoid table.
void G_init_logging(void)
2D/3D raster map header (used also for region)
void G_option_requires_all(void *,...)
Define additionally required options for an option.
const char * G_gisdbase(void)
Get name of top level database directory.
int G_get_gisrc_mode(void)
Get info where variables are stored.
int G_no_expand(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
int G_rename_file(const char *, const char *)
Rename a file or a directory in the filesystem.
void G_set_distance_to_line_tolerance(double)
void G_ls(const char *, FILE *)
Prints a directory listing to a stream, in prettified column format.
int G_compress_bound(int, int)
int G_open_new_misc(const char *, const char *, const char *)
open a new database misc file
char * G_basename(char *, const char *)
Truncates filename to the base part (before the last '.') if it matches the extension, otherwise leaves it unchanged.
double G_distance_between_line_segments(double, double, double, double, double, double, double, double)
Returns distance between two line segments in meters.
int G_projection(void)
Query cartographic projection.
int G_get_datumparams_from_projinfo(const struct Key_Value *, char *, char *)
struct Key_Value * G_fread_key_value(FILE *)
Read key/values pairs from file.
int G_is_units_type_temporal(int)
Check if the unit is of temporal type.
void G_list_color_rules(FILE *)
Print color rules.
void G_unset_window()
Unset current region.
void G_ascii_check(char *)
Removes non-ascii characters from buffer.
void G__no_gisinit(const char *)
Initialize GIS Library.
int G_unqualified_name(const char *, const char *, char *, char *)
Returns unqualified map name (without @ mapset)
void G_setenv2(const char *, const char *, int)
Set environment variable from specific place (updates .gisrc)
void G_xdr_get_int(int *, const void *)
void G_rotate_around_point_int(int, int, int *, int *, double)
Rotate point (int version)
int G_put_3dview(const char *, const char *, const struct G_3dview *, const struct Cell_head *)
Saves info to a 3d.view file.
int G_zstd_expand(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
int G_mapset_permissions(const char *)
Check for user mapset permission.
const char * G_ellipsoid_name(int)
Get ellipsoid name.
int G_default_compressor(void)
FILE * G_fopen_modify(const char *, const char *)
Open a database file for update (r+ mode)
void G__gisinit(const char *, const char *)
Initialize GIS Library and ensures a valid mapset is available.
int G_make_mapset_object_group_tmp(const char *)
Create directory for type of objects in the temporary directory.
void G_add_mapset_to_search_path(const char *)
Add mapset to the list of mapsets in search path.
void G_free(void *)
Free allocated memory.
int G_lz4_expand(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
int G_is_mapset(const char *)
Test if specified directory is mapset.
void G_set_error_routine(int(*)(const char *, int))
Establishes error_routine as the routine that will handle the printing of subsequent error messages...
const char * G_ellipsoid_description(int)
Get description for nth ellipsoid.
char * G_location_path(void)
Get current location UNIX-like path.
int G_no_compress(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
void G_sleep(unsigned int)
int G_format_timestamp(const struct TimeStamp *, char *)
Create text string from TimeStamp structure.
struct Flag * G_define_standard_flag(int)
Create standardised Flag structure.
void G_set_ls_exclude_filter(int(*)(const char *, void *), void *)
int G__make_mapset_element_misc(const char *, const char *)
Create misc element in the current mapset.
double G_transverse_radius_of_curvature(double, double, double)
Transverse radius of curvature.
void G_setup_fill(int)
Set row_fill routine to row_solid_fill or row_dotted_fill.
void G_progress(long, int)
Print progress info messages.
void G_add_keyword(const char *)
Add keyword to the list.
int G_vfaprintf(FILE *, const char *, va_list)
vfprintf() version of G_aprintf(). See G_aprintf() for more details.
int G_write_timestamp(FILE *, const struct TimeStamp *)
Output TimeStamp structure to a file as a formatted string.
int G_adjust_window_ll(struct Cell_head *cellhd)
Adjust window for lat/lon.
#define G_incr_void_ptr(ptr, size)
int G_sleep_on_error(int)
Turn on/off no_sleep flag.
double G_drand48(void)
Generate a floating-point value in the range [0,1)
int G_open_new(const char *, const char *)
Open a new database file.
void G_xdr_put_int(void *, const int *)
double G_ellipsoid_polygon_area(const double *, const double *, int)
Area of lat-long polygon.
void G_strip(char *)
Removes all leading and trailing white space from string.
char ** G_ls2(const char *, int *)
Stores a sorted directory listing in an array.
FILE * G_open_pager(struct Popen *)
Structure that stores module info.
const char * G_find_raster3d(const char *, const char *)
Search for a 3D raster map in current search path or in a specified mapset.
int G_make_location_crs(const char *, struct Cell_head *, const struct Key_Value *, const struct Key_Value *, const char *, const char *)
Create a new location.
char ** G_tokenize(const char *, const char *)
Tokenize string.
const char * G_original_program_name(void)
Return original path of the executed program.
double G_distance2_point_to_line(double, double, double, double, double, double)
int G_counter_next(struct Counter *)
int G_lookup_key_value_from_file(const char *, const char *, char[], int)
Look up for key in file.
void G_finish_workers(void)
int G_plot_area(double *const *, double *const *, int *, int)
Plot multiple polygons.
int G_saprintf(char *, const char *,...)
sprintf() version of G_aprintf(). See G_aprintf() for more details.
char * G_toucase(char *)
convert string to upper case
char * G_join_basename_strings(const char **, size_t)
join an array of strings using the basename separator
void G_temp_element(char *)
Populates element with a path string.
int G_make_mapset_element_tmp(const char *)
Create element in the temporary directory.
void G__write_Cell_head3(FILE *, const struct Cell_head *, int)
Write 3D cell header or window.
const char * G_database_epsg_code(void)
Get EPGS code for the current location.
int G_remove_misc(const char *, const char *, const char *)
Remove a database misc file.
int G_vasprintf(char **, const char *, va_list)
Safe replacement for asprintf().
int G_read_raster_timestamp(const char *, const char *, struct TimeStamp *)
Read timestamp from raster map.
const char * G_find_vector(char *, const char *)
Finds a vector map.
void G_initialize_done(int *)
int G_check_overwrite(int argc, char **argv)
Check for overwrite mode.
void G_format_northing(double, char *, int)
Northing to ASCII.
int G_remove_vector_timestamp(const char *, const char *)
Remove timestamp from vector map.
void G_close_mail(struct Popen *)
double G_rhumbline_lat_from_lon(double)
Calculates rhumbline latitude.
int G_zstd_compress(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
void G_format_resolution(double, char *, int)
Resolution to ASCII.
size_t G_get_num_decimals(const char *)
Get number of decimals from a string.
int G_remove_raster_timestamp(const char *)
Remove timestamp from raster map.
int G_lz4_compress(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
void G_format_easting(double, char *, int)
Easting to ASCII.
int G_begin_polygon_area_calculations(void)
Begin polygon area calculations.
char * G_compressor_name(int)
void G_str_to_upper(char *)
Convert string to upper case.
int G_faprintf(FILE *, const char *,...)
fprintf() version of G_aprintf(). See G_aprintf() for more details.
void * G_ls_regex_filter(const char *, int, int, int)
void G_begin_zone_area_on_sphere(double, double)
Initialize calculations for sphere.
int G_write_projwkt(const char *, const char *)
Write WKT definition to file.
void G_adjust_window_to_box(const struct Cell_head *, struct Cell_head *, int, int)
Adjusts window to a rectangular box.
struct Key_Value * G_get_projunits(void)
Gets units information for location.
int G_copy_file(const char *, const char *)
Copies one file to another.
void G_set_gisrc_mode(int)
Set where to find/store variables.
long G_srand48_auto(void)
Seed the pseudo-random number generator from the time and PID.
double G_meters_to_units_factor_sq(int)
Units conversion from square meters to square units.
void G_llres_format(double, char *)
int G_compare_projections(const struct Key_Value *, const struct Key_Value *, const struct Key_Value *, const struct Key_Value *)
Compare projections including units.
int G_vsnaprintf(char *, size_t, const char *, va_list)
vsnprintf() version of G_aprintf(). See G_aprintf() for more details.
int G_get_datum_by_name(const char *)
void G_read_datum_table(void)
int G_write_unompressed(int, unsigned char *, int)
void G_reset_mapsets(void)
Reset number of mapsets.
void G_message(const char *,...) __attribute__((format(printf
int G_open_old_misc(const char *, const char *, const char *, const char *)
open a database misc file for reading
void G_set_window(struct Cell_head *)
Establishes window as the current working window (region).
int G_open_old(const char *, const char *, const char *)
Open a database file for reading.
int G_get_overwrite()
Get overwrite value.
int G_database_unit()
Get units id for the current location.
char * G_double_to_basename_format(double, size_t, size_t)
Convert a double to a string substituting the dot with underscore 12.3456 => '12_3456'.
const char * G_home(void)
Get user's home directory.
const char * G_database_ellipse_name(void)
Get ellipsoid name for the current location.
void G_popen_close(struct Popen *)
void G_init_workers(void)
struct Option * G_define_standard_option(int)
Create standardised Option structure.
const char * G_get_units_name(int, int, int)
Get localized units name.
void G_ilist_add(struct ilist *, int)
Add item to ilist.
char * G_get_basename_separator()
Return the environmental basename variable or the default value.
const char * G_lat_format_string(void)
char * G_recreate_command(void)
Creates command to run non-interactive.
int G_write_raster_timestamp(const char *, const struct TimeStamp *)
Write timestamp of raster map.
void G__temp_element(char *, int)
Populates element with a path string (internal use only!)
int G_open_update(const char *, const char *)
Open a database file for update.
void G_option_collective(void *,...)
Sets the options to be collective.
void G__write_Cell_head(FILE *, const struct Cell_head *, int)
Write cell header or window.
int G_has_vector_timestamp(const char *, const char *, const char *)
Check if timestamp for vector map exists.
int G_has_raster_timestamp(const char *, const char *)
Check if timestamp for raster map exists.
void G_plot_where_en(int, int, double *, double *)
Converts x,y to east,north.
const char * G_location(void)
Get current location name.
void G_init_all(void)
Initialize environment.
double G_geodesic_lat_from_lon(double)
int int G_strcasecmp(const char *, const char *)
String compare ignoring case (upper or lower)
FILE * G_fopen_new(const char *, const char *)
Open a new database file.
double G_planimetric_polygon_area(const double *, const double *, int)
Calculates planimetric polygon area.
int G_make_location_epsg(const char *, struct Cell_head *, const struct Key_Value *, const struct Key_Value *, const struct Key_Value *)
Create a new location.
char * G_fully_qualified_name(const char *, const char *)
Get fully qualified element name.
char * G_str_replace(const char *, const char *, const char *)
Replace all occurrences of old_str in buffer with new_str.
void * G__malloc(const char *, int, size_t)
Memory allocation.
void G_list_color_rules_description_type(FILE *, char *)
Print color rules with description and type.
int G_scan_easting(const char *, double *, int)
ASCII easting to double.
void G_option_requires(void *,...)
Define a list of options from which at least one option is required if first option is present...
void G_create_alt_env(void)
Set up alternative environment variables.
int G_get_ellipsoid_by_name(const char *, double *, double *)
Get ellipsoid parameters by name.
int G_recursive_copy(const char *, const char *)
Copy recursively source directory to destination directory.
int G_scan_resolution(const char *, double *, int)
ASCII resolution to double.
const char * G_projection_name(int)
Get projection name.
const char * G_datum_ellipsoid(int)
void G_plot_point(double, double)
Plot point.
const char * G_color_name(int)
char * G_option_to_separator(const struct Option *)
Get separator string from the option.
struct GModule * G_define_module(void)
Initializes a new module.
char * G_tempfile(void)
Returns a temporary file name.
double G_darea0_on_sphere(double)
Calculates integral for area between two latitudes.
double G_geodesic_distance(double, double, double, double)
Calculates geodesic distance.
int G_begin_rhumbline_equation(double, double, double, double)
Start rhumbline calculations.
int G_parser(int, char **)
Parse command line.
FILE * G_fopen_old_misc(const char *, const char *, const char *, const char *)
open a database misc file for reading
void G_lat_parts(double, int *, int *, double *, char *)
int G_check_input_output_name(const char *, const char *, int)
Check input and output file names.
char ** G_get_available_mapsets(void)
Get list of available mapsets for current location.
FILE * G_open_option_file(const struct Option *)
Get an input/output file pointer from the option. If the file name is omitted or '-', it returns either stdin or stdout based on the gisprompt.
struct Option * G_define_option(void)
Initializes an Option struct.
int G_bz2_expand(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
int G_compress(unsigned char *, int, unsigned char *, int, int)
int G_write_raster3d_timestamp(const char *, const struct TimeStamp *)
Write timestamp of 3D raster map.
int G_remove_raster3d_timestamp(const char *)
Remove timestamp from 3D raster map.
void * G__calloc(const char *, int, size_t, size_t)
Memory allocation.
void G_begin_ellipsoid_polygon_area(double, double)
Begin area calculations.
void G_shortest_way(double *, double *)
Shortest way between two eastings.
void G_srand48(long)
Seed the pseudo-random number generator.
char * G_mapset_path(void)
Get current mapset UNIX-like path.
char * G_get_projwkt(void)
Get WKT information for the current location.
int G_number_of_tokens(char **)
Return number of tokens.
void G_setup_plot(double, double, double, double, int(*)(int, int), int(*)(int, int))
Initialize plotting routines.
void int G_suppress_warnings(int)
Suppress printing a warning message to stderr.
void G_write_zeros(int, size_t)
Writes n bytes of 9 to file descriptor fd
void * G_ls_glob_filter(const char *, int, int)
void G__read_Cell_head_array(char **, struct Cell_head *, int)
Read window from NULL terminated array of strings (for internal use only)
char * G_strcasestr(const char *, const char *)
Finds the first occurrence of the sub-string in the null-terminated string ignoring case (upper or lo...
void G_xdr_put_double(void *, const double *)
void G_xdr_put_float(void *, const float *)
Structure that stores flag info.
void G_switch_search_path(void)
Switch mapset search path.
void void void void __attribute__((noreturn))
int G_is_dirsep(char)
Checks if a specified character is a valid directory separator character on the host system...
int G_make_mapset_dir_object(const char *, const char *)
Create directory for an object of a given type.
int G_limit_west(double *, int)
Function not yet implemented...
void G_bresenham_line(int, int, int, int, int(*)(int, int))
Bresenham line algorithm.
void G_option_rule(int, int, void **)
Set generic option rule.
int G_legal_filename(const char *)
Check for legal database file name.
void G_fseek(FILE *, off_t, int)
Change the file position of the stream.
char * G_store_lower(const char *)
Copy string to allocated memory and convert copied string to lower case.
void G_init_counter(struct Counter *, int)
void G_set_key_value(const char *, const char *, struct Key_Value *)
Set value for given key.
void G_close_pager(struct Popen *)
int int int G_aprintf(const char *,...)
Adjust the width of string specifiers to the display space instead of the number of bytes for wide ch...
void G_xdr_get_float(float *, const void *)
double G_window_percentage_overlap(const struct Cell_head *, double, double, double, double)
Determines percentage of box is contained in the window.
FILE * G_fopen_old(const char *, const char *, const char *)
Open a database file for reading.
void G_get_set_window(struct Cell_head *)
Get the current working window (region)
int G_get_3dview_defaults(struct G_3dview *, struct Cell_head *)
Sets default for v based on w.
double G_distance_point_to_line_segment(double, double, double, double, double, double)
Returns distance between a point and line segment in meters.
FILE * G_fopen_modify_misc(const char *, const char *, const char *)
char ** G_tokenize2(const char *, const char *, const char *)
Tokenize string.
int int G_rasprintf(char **, size_t *, const char *,...) __attribute__((format(printf
void G_adjust_Cell_head(struct Cell_head *, int, int)
Adjust cell header.
int G_put_element_window(const struct Cell_head *, const char *, const char *)
Write the region.
void G_str_to_lower(char *)
Convert string to lower case.
void G_write_key_value_file(const char *, const struct Key_Value *)
Write key/value pairs to file.
void G_plot_line2(double, double, double, double)
Plot line between latlon coordinates (slowline)
void G_option_exclusive(void *,...)
Sets the options to be mutually exclusive.
int G_rename(const char *, const char *, const char *)
Rename a database file.
void G_set_program_name(const char *)
Set program name.
int G_zlib_compress(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
char * G_get_projsrid(void)
Get srid (spatial reference id) for the current location.
void G_plot_line(double, double, double, double)
Plot line between latlon coordinates (fastline)
int G_rle_compress(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
void G_unsetenv2(const char *, int)
Remove name from environment from specific place.
void G_remove_error_handler(void(*)(void *), void *)
Remove existing error handler.
int G_begin_cell_area_calculations(void)
Begin cell area calculations.
int G_read_raster3d_timestamp(const char *, const char *, struct TimeStamp *)
Read timestamp from 3D raster map.
const char * G_getenv2(const char *, int)
Get variable from specific place.
int G_write_projsrid(const char *, const char *)
Write srid (spatial reference id) to file.
char * G_color_rules_descriptions(void)
Get color rules description for Option->descriptions.
int G_point_in_window(double, double, const struct Cell_head *)
Returns TRUE if coordinate is within the given map region.
int G_rle_expand(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
int G_compressor_number(char *)
const char * G_database_projection_name(void)
Query cartographic projection for the current location.
jmp_buf * G_fatal_longjmp(int)
void G_percent(long, long, int)
Print percent complete messages.
const char * G_llres_format_string(void)
int G_stat(const char *, struct stat *)
Get file status.
void G_list_element(const char *, const char *, const char *, int(*)(const char *, const char *, const char *))
General purpose list function.
void G_plot_where_xy(double, double, int *, int *)
Converts east,north to x,y.
double G_adjust_easting(double, const struct Cell_head *)
Returns east not smaller than west.
const char * G_find_file_misc(const char *, const char *, char *, const char *)
Searches for a misc file from the mapset search list or in a specified mapset.
const char * G_find_raster(char *, const char *)
Find a raster map.
void * G__realloc(const char *, int, void *, size_t)
Memory reallocation.
int G_lat_scan(const char *, double *)
off_t G_ftell(FILE *)
Get the current file position of the stream.
char * G_color_rules_options(void)
Get list of color rules for Option->options.
int G_fwrite_key_value(FILE *, const struct Key_Value *)
Write key/value pairs to file.
char * G_chop(char *)
Chop leading and trailing white spaces.
char * G_file_name_tmp(char *, const char *, const char *, const char *)
Builds full path names to GIS data files in temporary directory (for internal use only) ...
void G_disable_interactive(void)
Disables the ability of the parser to operate interactively.
int int G_begin_distance_calculations(void)
Begin distance calculations.
int G_find_color_rule(const char *)
Check if color rule is defined.
void G_update_key_value_file(const char *, const char *, const char *)
Update file, set up value for given key.
int G_get_ellipsoid_parameters(double *, double *)
get ellipsoid parameters
int G_is_initialized(int *)
const char * G_find_file2_misc(const char *, const char *, const char *, const char *)
Searches for a misc file from the mapset search list or in a specified mapset. (look but don't touch)...
int G_intersect_line_segments(double, double, double, double, double, double, double, double, double *, double *, double *, double *)
void G__init_window(void)
Initialize window (region).
FILE * G_fopen_new_misc(const char *, const char *, const char *)
open a new database misc file
void G_set_percent_routine(int(*)(int))
Establishes percent_routine as the routine that will handle the printing of percentage progress messa...
int G_is_units_type_spatial(int)
Check if the unit is of spatial type.
int G_begin_geodesic_equation(double, double, double, double)
int G_projection_units(int)
Get projection units code (for internal use only)
const char * G_find_file(const char *, char *, const char *)
Searches for a file from the mapset search list or in a specified mapset.
const char * G_mapset(void)
Get current mapset name.
void G_set_keywords(const char *)
Set keywords from the string.
double G_meters_to_units_factor(int)
Units conversion from meters to units.
void G_set_geodesic_distance_lat2(double)
Sets geodesic distance lat2.
int G_set_verbose(int)
Set verbosity level.
int G_limit_south(double *, int)
Limit south (y) coordinate.
double G_adjust_east_longitude(double, double)
Adjust east longitude.
void G_zero(void *, int)
Zero out a buffer, buf, of length i.
int G_str_to_sql(char *)
Make string SQL compliant.
char ** G_list(int, const char *, const char *, const char *)
List specified type of elements. Application must release the allocated memory.
void G_init_timestamp(struct TimeStamp *)
Initialize timestamp structure.
int G_make_location(const char *, struct Cell_head *, const struct Key_Value *, const struct Key_Value *)
Create a new location.
int G_snprintf(char *, size_t, const char *,...) __attribute__((format(printf
int G_is_gisbase(const char *)
Test if specified directory is GISBASE.
int G_open_update_misc(const char *, const char *, const char *)
open a database misc file for update
void G_create_alt_search_path(void)
Define alternative mapset search path.
void G_setenv(const char *, const char *)
Set environment variable (updates .gisrc)
const char * G_gisbase(void)
Get full path name of the top level module directory.
const char * G_config_path(void)
Get user's config path directory.
void G_free_tokens(char **)
Free memory allocated to tokens.
void G_warning(const char *,...) __attribute__((format(printf
void G_begin_zone_area_on_ellipsoid(double, double, double)
Begin area calculations for ellipsoid.
double G_database_units_to_meters_factor(void)
Conversion to meters.
void G_lat_format(double, char *)
const char * G_datum_description(int)
struct Flag * G_define_flag(void)
Initializes a Flag struct.
int G_plot_polygon(const double *, const double *, int)
Plot filled polygon with n vertices.
void G_plot_fx(double(*)(double), double, double)
Plot f(east1) to f(east2)
int G_mkdir(const char *)
Creates a new directory.
char * G_tolcase(char *)
convert string to lower case
long G_mrand48(void)
Generate an integer in the range [-2^31, 2^31)
int G_window_overlap(const struct Cell_head *, double, double, double, double)
Determines if a box overlays a map window.
Structure that stores option information.
void G_set_timestamp(struct TimeStamp *, const struct DateTime *)
int G_insert_commas(char *)
Inserts commas into a number string.
void G__read_Cell_head(FILE *, struct Cell_head *, int)
Read cell header (for internal use only)
double G_distance(double, double, double, double)
Returns distance in meters.
char * G_convert_dirseps_from_host(char *)
Converts directory separator characters in a string from the native host character to the GRASS separ...
int G_info_format(void)
Get current message format.
int G_make_mapset_element(const char *)
Create element in the current mapset.
char * G_store_upper(const char *)
Copy string to allocated memory and convert copied string to upper case.
char * G_myname(void)
Returns location title.
int G_mkstemp(char *, int, int)
Returns a file descriptor.
void G_close_option_file(FILE *)
Close an input/output file returned by G_open_option_file(). If the file pointer is stdin...
void int G_is_little_endian(void)
Tests for little ENDIAN.
const char * G_getenv_nofatal(const char *)
Get environment variable.
int G_verbose_std(void)
Get standard verbosity level.
int G_write_vector_timestamp(const char *, const char *, const struct TimeStamp *)
Write timestamp of vector map.
void G_get_default_window(struct Cell_head *)
Get the default region.
void G_adjust_Cell_head3(struct Cell_head *, int, int, int)
Adjust cell header for 3D values.
const char * G_find_raster2(const char *, const char *)
Find a raster map (look but don't touch)
char * G_store(const char *)
Copy string to allocated memory.
const char * G_database_datum_name(void)
Get datum name for the current location.
void G_switch_env(void)
Switch environments.
char * G_rc_path(const char *, const char *)
Returns path to element and item.
void G_free_ls_filter(void *)
int G_limit_east(double *, int)
Function not yet implemented...
int G_verbose_max(void)
Get max verbosity level.
int G_limit_north(double *, int)
Limit north (y) coordinate.
void G_3dview_warning(int)
Turns 3D View warnings on and off.
int G_point_in_region(double, double)
Returns TRUE if coordinate is within the current region settings.
struct Key_Value * G_create_key_value(void)
Allocate and initialize Key_Value structure.
int G_units(const char *)
Get units code by name.
char * G_mktemp(char *)
Opens a temporary file.
void G_lon_parts(double, int *, int *, double *, char *)
int G_color_values(const char *, float *, float *, float *)
char * G_strchg(char *, char, char)
Replace all occurrences of character in string bug with new.
int G_asprintf(char **, const char *,...) __attribute__((format(printf
int G_get_spheroid_by_name(const char *, double *, double *, double *)
Get spheroid parameters by name.
double G_meridional_radius_of_curvature(double, double, double)
Meridional radius of curvature.
void G_init_tempfile(void)
Initialize environment for creating tempfiles.
void G_begin_execute(void(*func)(void *), void *, void **, int)
int G_bz2_compress(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
char * G_convert_dirseps_to_host(char *)
Converts directory separator characters in a string to the native host separator character (/ on Unix...
int G_has_raster3d_timestamp(const char *, const char *)
Check if timestamp for 3D raster map exists.
void G_usage(void)
Command line help/usage message.
int G_read_vector_timestamp(const char *, const char *, const char *, struct TimeStamp *)
Read timestamp from vector map.
double G_area_of_cell_at_row(int)
Cell area in specified row.
char * G_tempfile_pid(int)
Create tempfile from process id.
struct ilist * G_new_ilist()
Return a new integer list.
void G__read_gisrc_path(void)
Read or read again the GISRC (session) environment variable.
long G_lrand48(void)
Generate an integer in the range [0, 2^31)
void G_lon_format(double, char *)
int G_name_is_fully_qualified(const char *, char *, char *)
Check if map name is fully qualified (map @ mapset)
double G_darea0_on_ellipsoid(double)
Calculate integral for area between two latitudes.
void void G_verbose_message(const char *,...) __attribute__((format(printf
const char * G_database_unit_name(int)
Get units (localized) name for the current location.
int G_put_window(const struct Cell_head *)
Writes the region (window)
int G_zlib_expand(unsigned char *src, int src_sz, unsigned char *dst, int dst_sz)
FILE * G_open_mail(struct Popen *)
char * G_find_etc(const char *)
searches for a file from the etc search list in GRASS_ADDON_ETC returns the full path to where the fi...
void G_get_window(struct Cell_head *)
Get the current region.
int G_snaprintf(char *, size_t, const char *,...)
snprintf() version of G_aprintf(). See G_aprintf() for more details.
void G_option_excludes(void *,...)
Exclude selected options.
int G_recursive_remove(const char *)
Recursively remove all files in given directory.
int G_read_compressed(int, int, unsigned char *, int, int)
int G_debug(int, const char *,...) __attribute__((format(printf
void G_squeeze(char *)
Remove superfluous white space.
int G_is_absolute_path(const char *)
Checks if a specified path looks like an absolute path on the host system.
double G_area_for_zone_on_ellipsoid(double, double)
Calculates area between latitudes.
void G__read_mapset_env(void)
Force to read the mapset environment file VAR.
void G_init_ilist(struct ilist *)
Init an integer list and free allocated memory.
FILE * G_popen_read(struct Popen *, const char *, const char **)
double G_area_of_polygon(const double *, const double *, int)
Area in square meters of polygon.
void G_ls_format(char **, int, int, FILE *)
Prints a listing of items to a stream, in prettified column format.
void G_free_ilist(struct ilist *)
Free allocated memory of an integer list.
const char * G_date(void)
Current date and time.
void G_free_key_value(struct Key_Value *)
Free allocated Key_Value structure.
void G_popen_clear(struct Popen *)
const char * G_datum_name(int)
void G_add_error_handler(void(*)(void *), void *)
Add new error handler.
struct Key_Value * G_get_projepsg(void)
Gets EPSG information for the current location.
int G_make_mapset_object_group(const char *)
Create directory for group of elements of a given type.
const char * G_get_mapset_name(int)
Get name of the n'th mapset from the current mapset search path.
void G_get_element_window(struct Cell_head *, const char *, const char *, const char *)
Get region for selected element (raster, vector, window, etc.)
int G_expand(unsigned char *, int, unsigned char *, int, int)
void G_set_timestamp_range(struct TimeStamp *, const struct DateTime *, const struct DateTime *)
const char * G_find_key_value(const char *, const struct Key_Value *)
Find given key (case sensitive)
void G_xdr_get_double(double *, const void *)
int G_scan_northing(const char *, double *, int)
ASCII northing to double.
int G_lon_scan(const char *, double *)
int G_lstat(const char *, struct stat *)
Get file status.
FILE * G_fopen_append(const char *, const char *)
Open a database file for update (append mode)
const char * G_getenv(const char *)
Get environment variable.
void G_trim_decimal(char *)
Removes trailing zeros from decimal number.
void G_newlines_to_spaces(char *)