Loading...
Searching...
No Matches
error.c File Reference

GIS Library - Error messages functions. More...

`#include <stdlib.h>`
`#include <string.h>`
`#include <setjmp.h>`
`#include <unistd.h>`
`#include <time.h>`
`#include <stdarg.h>`
`#include <sys/types.h>`
`#include <grass/glocale.h>`
`#include <grass/gis.h>`
`#include "gis_local_proto.h"`
Include dependency graph for gis/error.c:

Go to the source code of this file.

## Macros

#define | MSG 0
| A message.
#define | WARN 1
| A warning message.
#define | ERR 2
| A fatal error message.

## Functions

jmp_buf * | G_fatal_longjmp (int enable)
void | G_message (const char *msg,...)
| Print a message to stderr.
void | G_verbose_message (const char *msg,...)
| Print a message to stderr but only if module is in verbose mode.
void | G_important_message (const char *msg,...)
| Print a message to stderr even in brief mode (verbosity=1).
void | G_fatal_error (const char *msg,...)
| Print a fatal error message to stderr.
void | G_warning (const char *msg,...)
| Print a warning message to stderr.
int | G_suppress_warnings (int flag)
| Suppress printing a warning message to stderr.
int | G_sleep_on_error (int flag)
| Turn on/off no_sleep flag.
void | G_set_error_routine (int(*error_routine)(const char *, int))
| Establishes error_routine as the routine that will handle the printing of subsequent error messages.
void | G_unset_error_routine (void)
| After this call subsequent error messages will be handled in the default method.
void | G_init_logging (void)
int | G_info_format (void)
| Get current message format.

## Detailed Description

GIS Library - Error messages functions.

(C) 1999-2011 by the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Author
  USACERL and many others

Definition in file gis/error.c.

## Macro Definition Documentation

## ERR

#define ERR 2

A fatal error message.

Definition at line 44 of file gis/error.c.

Referenced by G_fatal_error().

## MSG

#define MSG 0

A message.

Definition at line 32 of file gis/error.c.

Referenced by G_important_message(), G_message(), and G_verbose_message().

## WARN

#define WARN 1

A warning message.

Definition at line 38 of file gis/error.c.

Referenced by G_warning().

## Function Documentation

## G_fatal_error()

void G_fatal_error | ( | const char * | msg,
|  |  | ... )

Print a fatal error message to stderr.

The output format depends on environment variable GRASS_MESSAGE_FORMAT

By default, the message is handled by an internal routine which prints the message to the screen. Using G_set_error_routine() the programmer can have the message handled by another routine. This is especially useful if the message should go to a particular location on the screen when using curses or to a location on a graphics device (monitor).

Parameters

  msg | string (cannot be NULL)

Returns
  Terminates with an exit status of EXIT_FAILURE if no external routine is specified by G_set_error_routine()

Definition at line 159 of file gis/error.c.

References ERR, G__call_error_handlers(), and G_verbose().

Referenced by AS_class_apply_algorithm(), AS_class_equiprob(), AS_option_to_algorithm(), Cairo_begin_raster(), Cairo_Bitmap(), Cairo_Graph_set(), cairo_read_bmp(), cairo_read_ppm(), cairo_read_xid(), cairo_write_bmp(), cairo_write_ppm(), cairo_write_xid(), check_create_import_opts(), clean_dir(), font_init(), G__calloc(), G__check_option_rules(), G__describe_option_rules(), G__describe_option_rules_xml(), G__first_required_option_from_rules(), G__gisinit(), G__malloc(), G__no_gisinit(), G__read_Cell_head_array(), G__read_gisrc_path(), G__realloc(), G_adjust_Cell_head(), G_adjust_Cell_head3(), G_adjust_window_ll(), G_bz2_compress(), G_bz2_expand(), G_check_input_output_name(), G_compress(), G_compress_bound(), G_config_path(), G_expand(), G_get_element_window(), G_get_projsrid(), G_get_projwkt(), G_getenv(), G_getenv2(), G_home(), G_list(), G_location_path(), G_ls2(), G_make_mapset(), G_mapset(), G_mapset_path(), G_math_cholesky_sband_decomposition(), G_math_solver_pcg_sband(), G_mkstemp(), G_open_option_file(), G_option_to_color_format(), G_option_to_separator(), G_owner(), G_parser(), G_read_ellipsoid_table(), G_read_key_value_file(), G_set_omp_num_threads(), G_srand48_auto(), G_vector_norm_euclid(), G_vector_norm_maxval(), G_write_key_value_file(), G_write_projsrid(), G_write_projwkt(), G_write_zeros(), G_zstd_compress(), G_zstd_compress_bound(), G_zstd_expand(), GK_print_keys(), Gp_load_sites(), Gp_load_sites_thematic(), GPJ__get_ellipsoid_params(), GPJ_init_transform(), GPJ_transform(), GPJ_transform_array(), GS_load_att_map(), Gv_load_vect_thematic(), HTML_Graph_set(), IL_create_bitmask(), IL_interp_segments_2d_parallel(), IL_output_2d(), IL_resample_output_2d(), IL_vector_input_data_2d(), IL_write_point_2d(), IL_write_temp_2d(), kdtree_dnn(), kdtree_knn(), M_do_list(), M_do_remove(), M_read_list(), main(), N_alloc_array_2d(), N_alloc_array_3d(), N_assemble_les_2d_param(), N_assemble_les_3d_param(), N_compute_gradient_field_2d(), N_compute_gradient_field_3d(), N_compute_gradient_field_components_2d(), N_compute_gradient_field_components_3d(), N_copy_array_2d(), N_copy_array_3d(), N_math_array_2d(), N_math_array_3d(), N_norm_array_2d(), N_norm_array_3d(), N_read_rast3d_to_array_3d(), N_read_rast_to_array_2d(), N_write_array_2d_to_rast(), N_write_array_3d_to_rast3d(), Nviz_create_render_window(), P_Sparse_Points(), pj_get_kv(), pj_get_string(), PS_Graph_set(), read_bmp(), read_ellipsoid_table(), read_image(), read_pgm(), read_png(), read_ppm(), seg_seek_fast(), seg_seek_slow(), write_bmp(), write_image(), write_pgm(), write_png(), and write_ppm().

## G_fatal_longjmp()

jmp_buf * G_fatal_longjmp | ( | int | enable | ) |

Definition at line 66 of file gis/error.c.

## G_important_message()

void G_important_message | ( | const char * | msg,
|  |  | ... )

Print a message to stderr even in brief mode (verbosity=1).

Usually just G_percent()/G_clicker() would be shown at this level. This allows important non-error/warning messages to display as well.

The output format depends on environment variables GRASS_MESSAGE_FORMAT and GRASS_VERBOSE

Parameters

  msg | string (cannot be NULL)

Definition at line 130 of file gis/error.c.

References G_verbose(), G_verbose_min(), and MSG.

Referenced by G__calloc(), G__malloc(), G__realloc(), GPJ_init_transform(), and IL_vector_input_data_2d().

## G_info_format()

int G_info_format | ( | void |  | ) |

Get current message format.

Maybe set to either "standard" or "gui" (normally GRASS takes care)

Returns
  grass_info_format value

Definition at line 540 of file gis/error.c.

References G_init_logging().

Referenced by G_clicker(), G_percent(), and G_progress().

## G_init_logging()

void G_init_logging | ( | void |  | ) |

Definition at line 355 of file gis/error.c.

References G__home(), G_init_counter(), G_initialize_done(), G_is_initialized(), G_store(), and G_strcasecmp().

Referenced by G_info_format(), and G_init_all().

## G_message()

void G_message | ( | const char * | msg,
|  |  | ... )

Print a message to stderr.

The output format depends on environment variable GRASS_MESSAGE_FORMAT

Parameters

  msg | string (cannot be NULL)

Definition at line 89 of file gis/error.c.

References G_verbose(), G_verbose_std(), and MSG.

Referenced by G_done_msg(), G_math_solver_cholesky(), G_math_solver_gauss(), G_math_solver_gs(), G_math_solver_jacobi(), G_math_solver_lu(), G_math_solver_sparse_gs(), G_math_solver_sparse_jacobi(), G_matrix_print(), Gp_load_sites(), Gp_load_sites_thematic(), Gs_loadmap_as_bitmap(), Gs_loadmap_as_char(), Gs_loadmap_as_float(), Gs_loadmap_as_int(), Gs_loadmap_as_short(), Gs_pack_colors(), Gs_pack_colors_float(), Gv_load_vect(), Gv_load_vect_thematic(), GVL_load_vol(), IL_create_bitmask(), IL_interp_segments_2d_parallel(), IL_vector_input_data_2d(), M_do_copy(), M_do_remove(), M_do_rename(), N_gwflow_2d_calc_water_budget(), N_gwflow_3d_calc_water_budget(), N_read_rast3d_to_array_3d(), N_read_rast_to_array_2d(), N_write_array_2d_to_rast(), N_write_array_3d_to_rast3d(), and show_colormode().

## G_set_error_routine()

void G_set_error_routine | ( | int(* | error_routine )(const char *, int) | ) |

Establishes error_routine as the routine that will handle the printing of subsequent error messages.

Parameters

  error_routine | routine will be called like this: error_routine(msg, fatal)

Returns

Definition at line 260 of file gis/error.c.

## G_sleep_on_error()

int G_sleep_on_error | ( | int | flag | ) |

Turn on/off no_sleep flag.

If flag is 0, then no pause will occur after printing an error or warning message. Otherwise the pause will occur.

Parameters

  flag | if non-zero/zero value is given G_sleep() will be activated/deactivated

Returns
  previous no_sleep value

Definition at line 242 of file gis/error.c.

## G_suppress_warnings()

int G_suppress_warnings | ( | int | flag | ) |

Suppress printing a warning message to stderr.

Parameters

  flag | a warning message will be suppressed if non-zero value is given

Returns
  previous flag

Definition at line 222 of file gis/error.c.

Referenced by G_parser().

## G_unset_error_routine()

void G_unset_error_routine | ( | void |  | ) |

After this call subsequent error messages will be handled in the default method.

Error messages are printed directly to the screen: ERROR: message or WARNING: message

Returns
  0

Definition at line 274 of file gis/error.c.

## G_verbose_message()

void G_verbose_message | ( | const char * | msg,
|  |  | ... )

Print a message to stderr but only if module is in verbose mode.

The output format depends on environment variables GRASS_MESSAGE_FORMAT and GRASS_VERBOSE

Parameters

  msg | string (cannot be NULL)

Definition at line 108 of file gis/error.c.

References G_verbose(), G_verbose_std(), and MSG.

Referenced by G_adjust_Cell_head(), G_adjust_Cell_head3(), G_adjust_window_ll(), G_set_omp_num_threads(), HTML_Graph_set(), IL_resample_output_2d(), IL_vector_input_data_2d(), M_do_copy(), M_do_remove(), M_do_rename(), PNG_Graph_set(), PS_Graph_set(), and Segment_open().

## G_warning()

void G_warning | ( | const char * | msg,
|  |  | ... )

Print a warning message to stderr.

The output format depends on environment variable GRASS_MESSAGE_FORMAT

A warning message can be suppressed by G_suppress_warnings()

Parameters

  msg | string (cannot be NULL)

Returns

Definition at line 203 of file gis/error.c.

References G_verbose(), and WARN.

Referenced by AS_class_equiprob(), clean_dir(), close_g3d_file(), err(), G__check_gisinit(), G__gisinit(), G__matrix_add(), G__no_gisinit(), G__wps_print_process_description(), G_bz2_compress(), G_bz2_expand(), G_check_compressor(), G_check_input_output_name(), G_copy_file(), G_debug(), G_distance_point_to_line_segment(), G_fopen_append(), G_fopen_append_misc(), G_fopen_modify(), G_fopen_modify_misc(), G_get_3dview(), G_get_projinfo(), G_get_projunits(), G_legal_filename(), G_lz4_compress(), G_lz4_expand(), G_math_cholesky_decomposition(), G_math_solver_cholesky(), G_matrix_copy(), G_matrix_init(), G_matrix_inverse(), G_matrix_LU_solve(), G_matrix_product(), G_matrix_read(), G_matrix_scalar_mul(), G_matrix_set(), G_matrix_set_element(), G_matvect_extract_vector(), G_matvect_get_column(), G_matvect_get_row(), G_matvect_product(), G_open_update(), G_open_update_misc(), G_parser(), G_plot_area(), G_plot_polygon(), G_put_3dview(), G_read_compressed(), G_read_datum_table(), G_read_ellipsoid_table(), G_read_vector_timestamp(), G_set_omp_num_threads(), G_vector_copy(), G_vector_init(), G_vector_norm1(), G_vector_product(), G_vector_set(), G_vector_sub(), G_write_compressed(), G_write_uncompressed(), G_write_vector_timestamp(), G_zstd_compress(), G_zstd_expand(), get_pj_area(), get_pj_object(), gk_make_framesfromkeys(), gk_make_linear_framesfromkeys(), GK_update_frames(), Gp_load_sites(), Gp_load_sites_thematic(), GP_str_to_marker(), GPJ_get_datum_transform_by_name(), GPJ_grass_to_osr(), GPJ_init_transform(), GPJ_osr_to_grass(), GPJ_transform(), GPJ_transform_array(), Gs_build_256lookup(), gs_err(), Gs_get_cat_label(), Gs_load_3dview(), GS_load_att_map(), Gs_loadmap_as_bitmap(), Gs_loadmap_as_char(), Gs_loadmap_as_float(), Gs_loadmap_as_int(), Gs_loadmap_as_short(), gs_malloc_lookup(), Gs_numtype(), Gs_pack_colors(), Gs_pack_colors_float(), gs_put_label(), GS_write_ppm(), GS_write_tif(), GS_write_zoom(), gsd_put_legend(), gsd_rot(), gsd_wall(), gsdrape_set_surface(), Gv_load_vect(), Gv_load_vect_thematic(), Gvl_load_colors_data(), I_cluster_exec(), IL_grid_calc_2d(), IL_interp_segments_2d(), IL_interp_segments_2d_parallel(), IL_output_2d(), IL_resample_output_2d(), IL_vector_input_data_2d(), kdtree_remove(), M_do_copy(), M_do_remove(), M_do_rename(), main(), N_gwflow_2d_calc_water_budget(), N_gwflow_3d_calc_water_budget(), Nviz_color_from_str(), Nviz_create_render_window(), Nviz_make_current_render_window(), Nviz_new_light(), Nviz_new_map_obj(), Nviz_set_focus_state(), open_g3d_file(), P_Create_Aux2_Table(), P_Create_Aux4_Table(), P_popmatrix(), P_pushmatrix(), parse_fontcap(), pj_do_proj(), pj_do_transform(), pj_get_kv(), pj_get_string(), process_point(), rbtree_create(), rbtree_debug(), rbtree_traverse_start(), read_coor(), read_datum_table(), read_ellipsoid_table(), Rowio_setup(), S_read(), seg_pagein(), seg_pageout(), seg_setup(), Segment_get_row(), Segment_init(), Segment_open(), Segment_put(), and Segment_put_row().